Re: [Haskell-cafe] Compiling arbitrary Haskell code

2013-10-11 Thread Aleksey Khudyakov
On 12.10.2013 00:30, Christopher Done wrote: Is there a definitive list of things in GHC that are unsafe to _compile_ if I were to take an arbitrary module and compile it? E.g. off the top of my head, things that might be dangerous: * TemplateHaskell/QuasiQuotes -- obviously * Are rules safe?

Re: [Haskell-cafe] Optimization flag changing result of code execution

2013-07-18 Thread Aleksey Khudyakov
On 17.07.2013 16:11, Brian Lewis wrote: On 2013.07.17, at 08:03, Jan-Willem Maessen wrote: This has all the marks of a 64-bit-only code running on a 32 bit machine. This discussion is interesting, but I'm not sure why so much of it is taking place here instead of on the mwc-random issue

Re: [Haskell-cafe] Optimization flag changing result of code execution

2013-07-17 Thread Aleksey Khudyakov
On 10 July 2013 14:10, kudah kudahkuka...@gmail.com wrote: Yes, it does. Without optimizations the result is ndgorsfesnywaiqraloa, while with optimizations the result is always aabb. Sorry for taking so long. So problem is uniformR. You can reproduce bug reliably and I cannot.

Re: [Haskell-cafe] Possible extension to Haskell overloading behavior

2013-07-09 Thread Aleksey Khudyakov
On 08.07.2013 23:54, Chris Smith wrote: So I've been thinking about something, and I'm curious whether anyone (in particular, people involved with GHC) think this is a worthwhile idea. I'd like to implement an extension to GHC to offer a different behavior for literals with polymorphic types.

Re: [Haskell-cafe] Optimization flag changing result of code execution

2013-07-09 Thread Aleksey Khudyakov
On 09.07.2013 22:10, kudah wrote: Same here, I used mwc-random to generate random strings. It works in ghci and when compiled with -O0, but with -O1 and -O2 I've been getting exclusively a's and b's. It looks like MWC generates only 0 and 1 for some reason. I've tried to write simple test but

Re: [Haskell-cafe] Possible extension to Haskell overloading behavior

2013-07-09 Thread Aleksey Khudyakov
On 10.07.2013 01:13, Chris Smith wrote: Ugh... I take back the never mind. So if I replace Prelude with an alternate definition, but don't use RebindableSyntax, and then hide the base package, GHC still uses fromInteger and such from base even though it should be inaccessible. But if I do use

Re: [Haskell-cafe] Optimization flag changing result of code execution

2013-07-09 Thread Aleksey Khudyakov
On 10.07.2013 01:38, kudah wrote: I've attached the script that I had trouble with. It tries to replicate one directory structure in another directory, while replacing filenames and file contents with random data. When compiled with -O1 or -O2 resulting file and directory names are composed only

Re: [Haskell-cafe] Numerics and Warnings

2013-04-10 Thread Aleksey Khudyakov
On 10 April 2013 22:25, Roman Cheplyaka r...@ro-che.info wrote: * Barak A. Pearlmutter ba...@cs.nuim.ie [2013-04-10 15:38:35+0100] In fiddling around with some numeric code in Haskell, I noticed some issues. Basically, you get warnings if you write energy mass = mass * c^2 but not if you

Re: [Haskell-cafe] Numerics and Warnings

2013-04-10 Thread Aleksey Khudyakov
On 10 April 2013 23:26, Tom Ellis tom-lists-haskell-cafe-2...@jaguarpaw.co.uk wrote: On Wed, Apr 10, 2013 at 11:20:15PM +0400, Aleksey Khudyakov wrote: This IS rather annoying problem for numeric code. Raising value to positive power is quite common operation yet ^ operator generally couldn't

Re: [Haskell-cafe] Numerics and Warnings

2013-04-10 Thread Aleksey Khudyakov
On 11 April 2013 00:11, Roman Cheplyaka r...@ro-che.info wrote: * Aleksey Khudyakov alexey.sklad...@gmail.com [2013-04-10 23:20:15+0400] On 10 April 2013 22:25, Roman Cheplyaka r...@ro-che.info wrote: This IS rather annoying problem for numeric code. Raising value to positive power is quite

Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-05 Thread Aleksey Khudyakov
On 5 April 2013 12:20, Andrew Butterfield andrew.butterfi...@scss.tcd.ie wrote: On 4 Apr 2013, at 22:53, Aleksey Khudyakov wrote: If we are going to change haddock syntax we should add ability to add math formulae to documentation. It's not currently possible and it makes documenting numeric

Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-04 Thread Aleksey Khudyakov
On 4 April 2013 20:49, Johan Tibell johan.tib...@gmail.com wrote: Hi all, Haddock's current markup language leaves something to be desired once you want to write more serious documentation (e.g. several paragraphs of introductory text at the top of the module doc). Several features are

Re: [Haskell-cafe] Optimization flag changing result of code execution

2013-03-18 Thread Aleksey Khudyakov
On 17 March 2013 21:49, Dominic Steinitz domi...@steinitz.org wrote: Aleksey Khudyakov alexey.skladnoy at gmail.com writes: I've tried to run you program and I've got approximately same results regardless of optimization level. Which versions of GHC, mwc-random, vector and primitive do you

Re: [Haskell-cafe] Optimization flag changing result of code execution

2013-03-17 Thread Aleksey Khudyakov
On 16.03.2013 13:31, Azeem -ul-Hasan wrote: Nope that isn't the case either. Even if I make use of defaultSeed through create the problem still remains. The problem seems to be in the generation of a vector of (a,a) i.e in the part V.generateM ((round $ p*(fromIntegral $ l*z)) `div` 2) (\i-

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Aleksey Khudyakov
On 27 February 2013 12:01, Raphael Gaschignard dasur...@gmail.com wrote: I think it might be impossible with type families. I don't think it's possible to differentiate with type families something like T a a, and T a b, with b different from a. It's indeed impossible to write such type

Re: [Haskell-cafe] Help to write type-level function

2013-02-27 Thread Aleksey Khudyakov
On 27.02.2013 17:35, Dmitry Kulagin wrote: Hi Aleksey, Unfortunately, your solution does not work for me (ghc 7.6.2). I reduced the problem to: -- | Type class for type equality. class TypeEq (a :: α) (b :: α) (eq :: Bool) | a b - eq instance TypeEq a a True -- instance TypeEq a

Re: [Haskell-cafe] When the gauge depends on what it measures

2013-02-14 Thread Aleksey Khudyakov
On 14 February 2013 13:11, Alexander Bernauer acop...@gmail.com wrote: Hi, I am currently working on benchmarking the pretty library. ... skip ... What is the right way to handle this scenario? I simply create symlink to source tree and build benchmark with ghc --make ...

Re: [Haskell-cafe] performance question

2013-02-13 Thread Aleksey Khudyakov
On 10.02.2013 02:30, Nicolas Bock wrote: Hi Aleksey, could you show me how I would use ByteString? I can't get the script to compile. It's complaining that: No instance for (RegexContext Regex Data.ByteString.ByteString (AllTextSubmatches [] a0)) which is too cryptic

Re: [Haskell-cafe] performance question

2013-02-13 Thread Aleksey Khudyakov
On 13.02.2013 21:41, Brandon Allbery wrote: On Wed, Feb 13, 2013 at 11:32 AM, Nicolas Bock nicolasb...@gmail.com mailto:nicolasb...@gmail.com wrote: Since I have very little experience with Haskell and am not used to Haskell-think yet, I don't quite understand your statement that

Re: [Haskell-cafe] performance question

2013-02-08 Thread Aleksey Khudyakov
On 08.02.2013 23:26, Nicolas Bock wrote: Hi list, I wrote a script that reads matrix elements from standard input, parses the input using a regular expression, and then bins the matrix elements by magnitude. I wrote the same script in python (just to be sure :) ) and find that the python

Re: [Haskell-cafe] performance question

2013-02-08 Thread Aleksey Khudyakov
On 09.02.2013 01:02, Nicolas Bock wrote: Yes, a histogram. The binning code is really a little awkward. I haven't gotten used to thinking in terms of inmutable objects yet and this list appending is really a pretty bad hack to kind of allow me to increment the bin counts. How would one do this

Re: [Haskell-cafe] fixed-length bit-vectors

2012-11-22 Thread Aleksey Khudyakov
On 22 November 2012 03:22, Greg Fitzgerald gari...@gmail.com wrote: Hi all, My goal, eliminate the failure case in 'byte': https://gist.github.com/4128503 I don't want my 'byte' function to fail at runtime or return $ Left vector not 8 bits. I want it to return a Word8 for an 8-bit

Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-15 Thread Aleksey Khudyakov
The blacklisting approach has one major disadvantage that noone has mentioned yet: Adding more restrictive constraints does not work, the broken package will be on hackage forever, while adding a new version with relaxed constraints works well. That illustrate real problem It's not possible

Re: [Haskell-cafe] ANN: fixed-vector

2012-11-12 Thread Aleksey Khudyakov
I have a lot of one-off code where I've defined these myself. Is it possible to e.g. define vectors in R^2 and R^3, and write the p-norm functions only once? Yes. it's possible. {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} import

Re: [Haskell-cafe] Possible bug in Criterion or Statistics package

2012-10-02 Thread Aleksey Khudyakov
On 01.10.2012 02:14, Ben Gamari wrote: Aleksey Khudyakovalexey.sklad...@gmail.com writes: On 13.08.2012 19:43, Ryan Newton wrote: Terrible! Quite sorry that this seems to be a bug in the monad-par library. I'm copying some of the other monad-par authors and we hopefully can get to the

Re: [Haskell-cafe] Possible bug in Criterion or Statistics package

2012-08-13 Thread Aleksey Khudyakov
On 13.08.2012 19:43, Ryan Newton wrote: Terrible! Quite sorry that this seems to be a bug in the monad-par library. I'm copying some of the other monad-par authors and we hopefully can get to the bottom of this. If it's not possible to create a smaller reproducer, is it possible to share the

Re: [Haskell-cafe] Possible bug in Criterion or Statistics package

2012-08-13 Thread Aleksey Khudyakov
On 13.08.2012 20:26, Till Berger wrote: Terrible! Quite sorry that this seems to be a bug in the monad-par library. I'm copying some of the other monad-par authors and we hopefully can get to the bottom of this. If it's not possible to create a smaller reproducer, is it possible to share the

Re: [Haskell-cafe] Possible bug in Criterion or Statistics package

2012-08-12 Thread Aleksey Khudyakov
On 10.08.2012 22:20, Till Berger wrote: So I am not sure if this is a bug in Criterion itself, the Statistics package or any dependency or if I am doing something obviously wrong. I would be grateful if someone could look into this as it is holding me back from using Criterion for benchmarking

Re: [Haskell-cafe] Possible bug in Criterion or Statistics package

2012-08-09 Thread Aleksey Khudyakov
On 07.08.2012 19:15, Aleksey Khudyakov wrote: On 07.08.2012 18:16, Till Berger wrote: Dear all, So I am not sure if this is a bug in Criterion itself, the Statistics package or any dependency or if I am doing something obviously wrong. I would be grateful if someone could look

Re: [Haskell-cafe] Possible bug in Criterion or Statistics package

2012-08-07 Thread Aleksey Khudyakov
On 07.08.2012 18:16, Till Berger wrote: Dear all, I may have stumbled upon a bug in the Criterion package. When running the attached Haskell program (Benchmark.hs, a simple test case) on multiple cores (with +RTS -N, +RTS -N2, +RTS -N3 etc.) it sooner or later crashes with the following

Re: [Haskell-cafe] Is protocol-buffers package maintainer reachable?

2012-04-23 Thread Aleksey Khudyakov
On 23.04.2012 17:01, Paul Graphov wrote: Hello Cafe! I am using protocol-buffers and hprotoc packages but they fail to compile with recent GHC due to trivial errors. Hackage names Christopher Edward Kuklewicz as their maintainer. I've sent him patches more than a month ago but neiter they were

Re: [Haskell-cafe] Mathematics and Statistics libraries

2012-03-28 Thread Aleksey Khudyakov
There is the plot[1] library which provides for updateable plots from GHCi REPL and has a gnuplot-like interface.  I wrote it for this very reason, a mathematics/statistics development environment. It uses Data.Vector.Storable, which provides for compatability with both statistics and

Re: [Haskell-cafe] ghci can't load file whose name contains non-ASCII chars?

2012-03-28 Thread Aleksey Khudyakov
On Wed, Mar 28, 2012 at 11:49 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 28 March 2012 18:44, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote: I must be making some obvious mistake here, but I'm not seeing it. The file name contains O-umlaut, and the OS handles it

Re: [Haskell-cafe] Mathematics and Statistics libraries

2012-03-25 Thread Aleksey Khudyakov
On 25.03.2012 14:52, Tom Doris wrote: Hi Heinrich, If we compare the GHCi experience with R or IPython, leaving aside any GUIs, the help system they have at the repl level is just a lot more intuitive and easy to use, and you get access to the full manual entries. For example, compare what you

Re: [Haskell-cafe] Mathematics and Statistics libraries

2012-03-21 Thread Aleksey Khudyakov
On 21.03.2012 21:24, Ben Jones wrote: I am a student currently interested in participating in Google Summer of Code. I have a strong interest in Haskell, and a semester's worth of coding experience in the language. I am a mathematics and cs double major with only a semester left and I am looking

Re: [Haskell-cafe] Stack overflow while programming imperatively

2012-03-18 Thread Aleksey Khudyakov
On 18.03.2012 22:32, Clark Gaebel wrote: Hey list. I was recently fixing a space leak by dropping down to imperative programming in a section of my code, when it started developing space leaks of its own. I found the problem though - it was my for loop: http://hpaste.org/65514 Can anyone

Re: [Haskell-cafe] Too much inlining on text package

2012-03-16 Thread Aleksey Khudyakov
On 16.03.2012 17:41, Felipe Almeida Lessa wrote: Does anyone have any ideas why GHC is inlining so much code everywhere? While everything I said here was tested on GHC 7.0, we have evidence that GHC 7.4 suffers from the same problem. We don't know about GHC 6.12, though. This seems to be a

Re: [Haskell-cafe] Too much inlining on text package

2012-03-16 Thread Aleksey Khudyakov
On 17.03.2012 01:51, wren ng thornton wrote: On 3/16/12 12:22 PM, Aleksey Khudyakov wrote: Disclaimer. I'm no expert in text internals. Because it's told to do so. This is an unfortunate feature of stream fusion. It does eliminate intermediate data structures but it requires that everything

Re: [Haskell-cafe] Too much inlining on text package

2012-03-16 Thread Aleksey Khudyakov
On 17.03.2012 02:24, Johan Tibell wrote: I suggest you file a bug. :) I'm way too lazy for that. Also I don't want to steal joy of reporting a bug from people who actually suffer from it ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Mersenne-random and standard random API

2012-02-10 Thread Aleksey Khudyakov
On 10.02.2012 18:38, Yves Parès wrote: I just thought about something: basically all these APIs provides a IO [a] (where a is a randomly generable type) function. Is there a problem with the approach that is to rely on lazy evaluation to pass to pure code (either explicitely or through State)

Re: [Haskell-cafe] Mersenne-random and standard random API

2012-02-09 Thread Aleksey Khudyakov
On 09.02.2012 01:56, Yves Parès wrote: Hi, I've been in the past told that mersenne-random was much better than the standard random package. ... So is it possible to use the fast and efficient mersenne generator with the convenient and general random API? I think design of Random type class

Re: [Haskell-cafe] Mersenne-random and standard random API

2012-02-09 Thread Aleksey Khudyakov
On 09.02.2012 15:32, Jerzy Karczmarczuk wrote: Aleksey Khudyakov : 1. Mersenne Twister, AND congruential generators AND the Marsaglia stuff, all use some kind of seed, all are stateful. There are no miracles. Just look the agressive monadization, the form of defaultSeed, etc. within MWC.hs

Re: [Haskell-cafe] Mersenne-random and standard random API

2012-02-09 Thread Aleksey Khudyakov
On 09.02.2012 18:27, Duncan Coutts wrote: Actually it is not true that the state has to be copied. Using the lazy ST monad we can implement this interface and internally use mutable ST arrays. See for example

Re: [Haskell-cafe] Mersenne-random and standard random API

2012-02-09 Thread Aleksey Khudyakov
On 09.02.2012 17:28, Jerzy Karczmarczuk wrote: Aleksey Khudyakov: On 09.02.2012 15:32, Jerzy Karczmarczuk wrote: 1. Mersenne Twister, AND congruential generators AND the Marsaglia stuff, all use some kind of seed, all are stateful. There are no miracles. Just look the agressive monadization

Re: [Haskell-cafe] Vector (or List) to CArray?

2012-01-19 Thread Aleksey Khudyakov
On 19.01.2012 22:15, Dominic Espinosa wrote: Hello, I'm trying to use the fftw binding, and its functions operate on CArrays of Complex. My data is coming from hsndfile, so it starts out as a Vector of Double. How do I convert this data to CArray? The API functions in the CArray module don't

Re: [Haskell-cafe] partial type annotations

2012-01-19 Thread Aleksey Khudyakov
On 20.01.2012 00:37, Nicholas Tung wrote: Dear all, I wanted to voice support for a partial type annotations. Here's my usage scenario: I have a monad for an imperative EDSL, which has an associated expression data type, I wanted such extension more than once. For me it's useful when

Re: [Haskell-cafe] All the random packages

2012-01-08 Thread Aleksey Khudyakov
On 08.01.2012 11:18, Eugene Kirpichov wrote: Hi, I came across the beautiful algorithm for O(1) generation of rational discrete distributions http://www.keithschwarz.com/darts-dice-coins/ and though it'd be fun to implement it in Haskell and put on Hackage, but then it turned out that there's

Re: [Haskell-cafe] matrix manipulations and calculations

2011-09-09 Thread Aleksey Khudyakov
On Fri, Sep 9, 2011 at 3:13 PM, Thomas Friedrich i...@suud.de wrote: I started of using hmatrix [1] now.  However, I eventually would like to use some functions from the statisics-package [2].  They both use different types for their vector representations.  In hmatrix a vector is of type