Re: [Haskell-cafe] what does the '~' mean ?

2010-04-16 Thread Ivan Miljenovic
On 16 April 2010 15:59, zaxis z_a...@163.com wrote: instance (BinaryDefer a, BinaryDefer b) = BinaryDefer (a,b) where    put (a,b) = put2 a b    get = get2 (,)    size x = let ~(a,b) = x in size a + size b    putFixed (a,b) = putFixed2 a b    getFixed = getFixed2 (,) in `size` function,

Re: [Haskell-cafe] what does the '~' mean ?

2010-04-16 Thread Stefan Holdermans
Ivan, in `size` function, what does the `~` mean ? A lazy pattern match: http://en.wikibooks.org/wiki/Haskell/Laziness (there is a better name for it, but I can't remember). Irrefutable pattern? ;-) Cheers, Stefan ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] what does the '~' mean ?

2010-04-16 Thread Magnus Therning
On 16/04/10 07:09, Ivan Miljenovic wrote: On 16 April 2010 15:59, zaxis z_a...@163.com wrote: instance (BinaryDefer a, BinaryDefer b) = BinaryDefer (a,b) where put (a,b) = put2 a b get = get2 (,) size x = let ~(a,b) = x in size a + size b putFixed (a,b) = putFixed2 a b

Re: [Haskell-cafe] Re: instance Eq (a - b)

2010-04-16 Thread Ketil Malde
Ashley Yakeley ash...@semantic.org writes: There's an impedance mismatch between the IEEE notion of equality (under which -0.0 == 0.0), and the Haskell notion of equality (where we'd want x == y to imply f x == f y). Do we also want to modify equality for lazy bytestrings, where equality is

[Haskell-cafe] Re: True Random Numbers

2010-04-16 Thread Ertugrul Soeylemez
Yitzchak Gale g...@sefer.org wrote: Since they weren't mentioned in this thread, I'll point out that there are better sources of entropy than /dev/random, /dev/urandom, and the Windows API. For example, the two sites https://random.org/integers

[Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread Mathieu Boespflug
Dear haskell-cafe, I implemented the Floyd Warshall algorithm for finding the shortest path in a dense graph in Haskell, but noted the performance was extremely poor compared to C. Even using mutable unboxed arrays it was running about 30 times slower. I rewrote the program several times, to

Re: [Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread Bulat Ziganshin
Hello Mathieu, Friday, April 16, 2010, 12:06:06 PM, you wrote: actions and then running them using sequence_. But still this program runs 3 times slower than it's C counterpart: ghc low-level code optimization cannot be compared with best modern C compilers that's result of 20 years of

Re: [Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread Mathieu Boespflug
Hi Bulat, ghc low-level code optimization cannot be compared with best modern C compilers that's result of 20 years of optimization. ghc generates machine code in rather simple idiomatic way, so it should be compared to non-optimizing C compiler Sure. But I was curious if to see whether

Re[2]: [Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread Bulat Ziganshin
Hello Mathieu, Friday, April 16, 2010, 12:42:29 PM, you wrote: Sure. But I was curious if to see whether there was some optimization I had missed, seeing as other similarly low level programs, such as the nsieve benchmark of the language shootout, or the word counting program, manage to run

Re: [Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread Max Bolingbroke
For what is is worth: $ ghc -cpp -O2 -ddump-asm Main.hs Main.s $ time ./a.out Allocating ... Allocating ... done real0m39.487s user0m39.258s sys 0m0.150s $ ~/Programming/Checkouts/ghc.llvm/inplace/bin/ghc-stage2 -cpp -fllvm -O2 Main.hs $ time ./a.out Allocating ... Allocating ...

Re: [Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread Roman Leshchinskiy
On 16/04/2010, at 18:06, Mathieu Boespflug wrote: shortestPath :: [(Int, Int, Int)] - UArray Int Int shortestPath g = runSTUArray $ do let mnew = newArray (0, SIZE * SIZE) 1 mread arr i j = unsafeRead arr (i * SIZE + j) mwrite arr i j x = unsafeWrite arr (i * SIZE + j) x

[Haskell-cafe] ghc package problem

2010-04-16 Thread Phyx
Hi all, I'm having a rather weird problem, Ghc-pkg list shows a package installed but doing a ghc -make will give an error saying that It can't find a module that's supposed to be in the installed package. And cabal install always reinstall all the dependencies on every change. It

[Haskell-cafe] Ocaml for Haskellers tutorial

2010-04-16 Thread José Iborra
As a Haskeller who is forced to switch to Ocaml by the job market (or at least by the job interview market), I could really use a Ocaml for Haskellers tutorial. I was wondering if there are others who have been in this situation recently and can share a few pointers, or better yet, write a blog

Re: [Haskell-cafe] ghc package problem

2010-04-16 Thread Daniel Fischer
Am Freitag 16 April 2010 11:28:54 schrieb Phyx: Hi all, I'm having a rather weird problem, Ghc-pkg list shows a package installed but doing a ghc -make will give an error saying that It can't find a module that's supposed to be in the installed package. And cabal install always

Re: [Haskell-cafe] Ocaml for Haskellers tutorial

2010-04-16 Thread Stephen Tetley
Hi Ocaml's a fine alternative to Haskell, you could be 'forced' to use say PHP, now that wouldn't be quite so nice... For instance, I have heard that Ocaml is only fast when one uses loops instead of folds, but I wonder if this is an overstatement. Maybe this notion is from the standard

RE: [Haskell-cafe] ghc package problem

2010-04-16 Thread Phyx
(sorry for the duplication, forgot to reply to the mailing list too) Well, I did, I've completely unregistered the package, Did a check and recache, both completed with no problem. In detail what's happening is, I'm building a tool that requires Haskell-src-exts, So I upgraded to the 1.9.0

RE: [Haskell-cafe] Ocaml for Haskellers tutorial

2010-04-16 Thread Sittampalam, Ganesh
Stephen Tetley wrote: I suspect the difference between the ML module system vs. typeclasses will be as important as lazy vs. strict. As a style point, Ocaml programmers don't seem too prone to combinator mania - so I think golf is a bit less popular over there. Both the lack of laziness

Re: [Haskell-cafe] ghc package problem

2010-04-16 Thread Daniel Fischer
Am Freitag 16 April 2010 14:06:16 schrieb Phyx: (sorry for the duplication, forgot to reply to the mailing list too) Well, I did, I've completely unregistered the package, Did a check and recache, both completed with no problem. In detail what's happening is, I'm building a tool that

RE: [Haskell-cafe] ghc package problem

2010-04-16 Thread Phyx
I'm using cabal install, $ ghc --make -O2 WinDll WinDll\Lib\NativeMapping.hs:51:18: Could not find module `Language.Haskell.Exts': Use -v to see a list of the files searched for. Is the error message I get when I try to just compile it normally While $ ghc-pkg find-module

Re: [Haskell-cafe] ghc package problem

2010-04-16 Thread Ivan Lazar Miljenovic
What does ghc-pkg check say? You probably have inconsistent deps; as such rebuild all packages that are broken. A package wrapped in braces in the ghc-pkg list output means the same thing. Phyx loneti...@gmail.com writes: (sorry for the duplication, forgot to reply to the mailing list too)

Re: [Haskell-cafe] Ocaml for Haskellers tutorial

2010-04-16 Thread aditya siram
forced to switch to Ocaml That like saying that you broke up with Miss America and started going out with the runner-up. Sucks to be you :) I experimented with Ocaml for a little while and among other things I found that technology stack that comes with GHC (compared to Ocaml) is quite a bit

Re: [Haskell-cafe] what does the '~' mean ?

2010-04-16 Thread Ivan Lazar Miljenovic
Stefan Holdermans ste...@vectorfabrics.com writes: Irrefutable pattern? ;-) Ahhh, yes, that's it. I knew it started with `i', but that's about it... -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe

Re: [Haskell-cafe] ghc package problem

2010-04-16 Thread Daniel Fischer
Am Freitag 16 April 2010 15:06:55 schrieb Phyx: I'm using cabal install, $ ghc --make -O2 WinDll WinDll\Lib\NativeMapping.hs:51:18: Could not find module `Language.Haskell.Exts': Use -v to see a list of the files searched for. Is the error message I get when I try to just

RE: [Haskell-cafe] ghc package problem

2010-04-16 Thread Phyx
For the first part $ cat foo.hs module Main (main) where import Language.Haskell.Exts main :: IO () main = print $ readExtensions BangPatterns $ ghc --make foo.hs foo.hs:3:8: Could not find module `Language.Haskell.Exts': Use -v to see a list of the files searched for. So same

Re: [Haskell-cafe] ghc package problem

2010-04-16 Thread Daniel Fischer
Am Freitag 16 April 2010 15:40:38 schrieb Phyx: For the first part $ cat foo.hs module Main (main) where import Language.Haskell.Exts main :: IO () main = print $ readExtensions BangPatterns $ ghc --make foo.hs foo.hs:3:8: Could not find module `Language.Haskell.Exts': Use

[Haskell-cafe] Re: Ocaml for Haskellers tutorial

2010-04-16 Thread Pierre-Etienne Meunier
Hi, Strangely enough, I did the opposit some time ago. Ocaml is way simpler than haskell, in fact. There is no referential transparency, no laziness (though it can be simulated with fun ()-x, but the type of a lazy expression is not the same as the reduced expressions), no parallelism (the GC

Re: [Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread John Lato
From: Mathieu Boespflug mb...@tweag.net Dear haskell-cafe, I implemented the Floyd Warshall algorithm for finding the shortest path in a dense graph in Haskell, but noted the performance was extremely poor compared to C. Even using mutable unboxed arrays it was running about 30 times

Re: [Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread Mathieu Boespflug
Hi John, your transformation on the original program amounts to replacing all occurrences of a Haskell literal with a Haskell variable. You will therefore end up with something that looks like this : loop sIZE = return () loop j = ... sIZE is now a pattern variable, that is, the pattern of the

Re[2]: [Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread Bulat Ziganshin
Hello John, Friday, April 16, 2010, 7:41:06 PM, you wrote: sIZE = 1500 and all references from SIZE to sIZE, something ... changes. A lot. this one too? :D let loop2 SIZE = return () -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re: [Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread Daniel Fischer
Am Freitag 16 April 2010 17:41:06 schrieb John Lato: From: Mathieu Boespflug mb...@tweag.net Dear haskell-cafe, I implemented the Floyd Warshall algorithm for finding the shortest path in a dense graph in Haskell, but noted the performance was extremely poor compared to C. Even using

Re: [Haskell-cafe] Floyd Warshall performance (again)

2010-04-16 Thread John Lato
On Fri, Apr 16, 2010 at 5:02 PM, Daniel Fischer daniel.is.fisc...@web.de wrote: Am Freitag 16 April 2010 17:41:06 schrieb John Lato: From: Mathieu Boespflug mb...@tweag.net Dear haskell-cafe, I implemented the Floyd Warshall algorithm for finding the shortest path in a dense graph in

[Haskell-cafe] statistics build error

2010-04-16 Thread Keith Sheppard
Hello, I ran into this error while trying to install statistics. Does this indicate that I need to upgrade my GHC before I can install? k...@catskill:~/projects/ cabal update Downloading the latest package list from hackage.haskell.org k...@catskill:~/projects/ cabal install statistics

[Haskell-cafe] Re: statistics build error

2010-04-16 Thread Keith Sheppard
Sorry, I forgot to add my ghc version is 6.10.1 on OSX k...@catskill:~/projects/ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.10.1 On Fri, Apr 16, 2010 at 1:08 PM, Keith Sheppard keiths...@gmail.com wrote: Hello, I ran into this error while trying to install

Re: [Haskell-cafe] Re: statistics build error

2010-04-16 Thread Daniel Fischer
Am Freitag 16 April 2010 19:11:13 schrieb Keith Sheppard: Sorry, I forgot to add my ghc version is 6.10.1 on OSX k...@catskill:~/projects/ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.10.1 On Fri, Apr 16, 2010 at 1:08 PM, Keith Sheppard keiths...@gmail.com wrote:

[Haskell-cafe] US Patent for the idea of using Haskell to implement UAX #9

2010-04-16 Thread Brian Hulley
Hi everyone, It's been a long time since I last posted to this list since I'm currently working on something that is not directly Haskell-related, but it still relates to functional programming in general. Anyway imagine my surprise when an innocent search for some keywords (I can't remember

Re: [Haskell-cafe] ghc package problem

2010-04-16 Thread Ben Millwood
On Fri, Apr 16, 2010 at 2:40 PM, Phyx loneti...@gmail.com wrote: So same error. This isn't just limited to HSE though, it can't find packages like random,time etc either. Keeps reinstalling them on every cabal install.

Re: [Haskell-cafe] US Patent for the idea of using Haskell to implement UAX #9

2010-04-16 Thread Daniel Fischer
Am Freitag 16 April 2010 20:50:25 schrieb Brian Hulley: revealed a link to a US Patent (7120900) for the idea of implementing the Unicode Bidirectional Algorithm (UAX #9 http://www.unicode.org/reports/tr9) in Haskell, making use, as far as I can tell, of nothing more than the normal approach

[Haskell-cafe] Re: US Patent for the idea ...

2010-04-16 Thread jerzy . karczmarczuk
Brian Hulley reports a search similar to : haskell unicode bidirectional revealed a link to a US Patent (7120900) for the idea of implementing the Unicode Bidirectional Algorithm (UAX #9 http://www.unicode.org/reports/tr9) in Haskell, making use, as far as I can tell, of nothing more

Re: [Haskell-cafe] GHC, odd concurrency space leak

2010-04-16 Thread Jesper Louis Andersen
On Thu, Apr 15, 2010 at 1:33 AM, Daniel Fischer daniel.is.fisc...@web.de wrote: Can some core expert please look at these and explain the difference? I'm interested in an explanation too. +1 The behaviour is consistent. GHC 6.8.3, 6.10.4, 6.12.1 and 6.13-20100416 all agree on the space

Re: [Haskell-cafe] GHC, odd concurrency space leak

2010-04-16 Thread Jason Dagit
. +1 The behaviour is consistent. GHC 6.8.3, 6.10.4, 6.12.1 and 6.13-20100416 all agree on the space leak. Here is the minimal program I have with the leak: Myself and others posted simpler programs that had similar bad behavior, including the space leak (depending on optimizations flags). I

RE: [Haskell-cafe] ghc package problem

2010-04-16 Thread Phyx
Well, it's in the user list because it can't find them in the global list. With the exception of Haskell-src-exts all the other packages are already available in my global list. I'll try installing global and see -Original Message- From: thebenmach...@googlemail.com

RE: [Haskell-cafe] ghc package problem

2010-04-16 Thread Phyx
Well, when I try compiling using -package I get $ ghc -package haskell-src-exts foo.hs command line: cannot satisfy -package haskell-src-exts: haskell-src-exts-1.9.0-1e9f470ed15bddc8bf59f4d012a82687 is unusable due to m issing or recursive dependencies:

RE: [Haskell-cafe] ghc package problem

2010-04-16 Thread Phyx
I've tried your suggestion, and with the --global flag it does work, but only if I keep using the global flag, when I just install as user again same thing happens. Maybe something's wrong with the user package conf. Unfortunately installing as global requires admin rights and installs the tools

Re: [Haskell-cafe] ghc package problem

2010-04-16 Thread Ivan Lazar Miljenovic
Stupid question: are you trying to build this package/use ghci as the same user that has haskell-src-exts installed as a user? Phyx loneti...@gmail.com writes: I've tried your suggestion, and with the --global flag it does work, but only if I keep using the global flag, when I just install as

Re: [Haskell-cafe] Simple binary-protocol through network test

2010-04-16 Thread Limestraël
By the way, I happen to have a little problem when I try to add data compression/decompression. Since its impossible to add binary treatments (I call binary treatment a function which type is: ByteString - ByteString, e.g. compression), I made my own package binary-communicator. (can be found on

RE: [Haskell-cafe] ghc package problem

2010-04-16 Thread Phyx
Yes I am, I'm running it all as the same user. -Original Message- From: Ivan Lazar Miljenovic [mailto:ivan.miljeno...@gmail.com] Sent: Saturday, April 17, 2010 00:45 To: Phyx Cc: 'Ben Millwood'; haskell-cafe@haskell.org; daniel.is.fisc...@web.de Subject: Re: [Haskell-cafe] ghc package

Re: [Haskell-cafe] Strange error with type classes + associated types

2010-04-16 Thread Conal Elliott
Hi Brent, I'm sorry to hear that the non-injectivity issue bit you. It's bitten me also at times, leading me to choose associated data types (injective) instead of associated synonyms (potentially non-injective). And sometimes, the data types route is problematic, as the new types aren't

Re: [Haskell-cafe] Ocaml for Haskellers tutorial

2010-04-16 Thread jeff p
Hello, One major thing I haven't seen explicitly mentioned yet in this thread is tail recursion. You have to write tail recursively in OCaml (or any strict language) or you will blow the stack. While tail recursion is often wrong (in terms of efficiency) in Haskell, it is always right in OCaml.

[Haskell-cafe] Re: Weird behaviour with positional parameters in HDBC-mysql

2010-04-16 Thread Chris Waterson
Hi Martijn, I can reproduce the problem and investigate. My guess is that something is getting garbage collected that shouldn't be... I'll let you know what I figure out. thanks, chris On Apr 7, 2010, at 3:02 PM, Martijn van Steenbergen wrote: Dear café (CC John and Chris), I'm having

[Haskell-cafe] vector recycling

2010-04-16 Thread Ben
hello -- this is mostly a question for roman, or don, i guess. suppose i have a list of similarly-sized vectors, and i want to add them up (possibly with coefficients), to yield a result vector. something like module Main where import qualified Data.Vector.Generic as V import qualified

Re: [Haskell-cafe] Ocaml for Haskellers tutorial

2010-04-16 Thread C K Kashyap
I am a little surprised by the shortcomings of Haskell mentioned in the thread. I was under the impression that Haskell was closest to Nirvana on the usefulness vs safety graph. In the paper Why FP matters - Laziness is stated as one of the two key features of FP that allows conceptual

[Haskell-cafe] Re: Weird behaviour with positional parameters in HDBC-mysql

2010-04-16 Thread Chris Waterson
I think that this should be fixed with the latest version of the driver (0.6.2). I was incorrectly squirreling away pointers that I'd acquired using with or withCString. This worked -- sometimes. :) Please let me know if you see any other problems. thanks, chris On Apr 7, 2010, at 3:02 PM,

Re: [Haskell-cafe] vector recycling

2010-04-16 Thread Jason Dagit
On Fri, Apr 16, 2010 at 8:32 PM, Ben midfi...@gmail.com wrote: hello -- this is mostly a question for roman, or don, i guess. suppose i have a list of similarly-sized vectors, and i want to add them up (possibly with coefficients), to yield a result vector. something like module Main