Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Ivan Lazar Miljenovic
zaxis writes: >>>Why do you bother with the interior definition of f in there? > Because i want to try a C code style not layout style without `do` syntax > sugar . Haskell /= C, so stop trying to code as if it is. If you like C so much, then use C. -- Ivan Lazar Miljenovic ivan.miljeno...@g

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread wren ng thornton
David Menendez wrote: On Sat, Mar 27, 2010 at 12:56 AM, Thomas DuBuisson wrote: Using bang patterns didn't help almost anything here. Using rem instead of mod made the time go from 45s to 40s. Now, using -fvia-C really helped (when I used rem but not using mod). It went down to 10s. Bang patte

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread zaxis
>>Why do you bother with the interior definition of f in there? Because i want to try a C code style not layout style without `do` syntax sugar . Yusaku Hashimoto wrote: > >>> fac n = let {  f = foldr (*) 1 [1..n] } in f >> >> Why do you bother with the interior definition of f in there? >> >>

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread zaxis
I just start ghci from shell and do nothing else. In fact, i really donot know `Monad ((->) a) ` . Would you mind expplain it ? Yusaku Hashimoto wrote: > > Did you import the module includes the instance of Monad ((->) e) > somewhere in your code loaded in ghci? > > I tried this on a fresh ghc

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread David Menendez
On Sat, Mar 27, 2010 at 12:56 AM, Thomas DuBuisson wrote: >> Using bang patterns didn't help almost anything here. Using rem >> instead of mod made the time go from 45s to 40s. Now, using -fvia-C >> really helped (when I used rem but not using mod). It went down to >> 10s. > > Bang patterns should

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Thomas DuBuisson
> Using bang patterns didn't help almost anything here. Using rem > instead of mod made the time go from 45s to 40s. Now, using -fvia-C > really helped (when I used rem but not using mod). It went down to > 10s. Bang patterns should have helped tons - it isn't GHC thats at fault here and yes it do

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Rafael Almeida
On Fri, Mar 26, 2010 at 6:49 PM, Jason Dagit wrote: > > > On Fri, Mar 26, 2010 at 2:33 PM, Bryan O'Sullivan > wrote: >> >> On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida >> wrote: >>> >>> During a talk with a friend I came up with two programs, one written in >>> C and another in hask

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Rafael Almeida
On Fri, Mar 26, 2010 at 10:42 PM, Bernie Pope wrote: > On 27 March 2010 04:46, Rafael Cunha de Almeida wrote: > >> During a talk with a friend I came up with two programs, one written in >> C and another in haskell. > > snip > >> The Haskell version: >> real    0m45.335s >> user    0m45.275s >> s

Re: [Haskell-cafe] Garbage collecting pointers

2010-03-26 Thread Carter Schonwald
I have to Point out that any such scheme as is being described would need to be done quite carefully as to not break pass by reference data semantics that Haskell enjoys/ the wealth of sharing Moreover, as I understand it, something like this only is feasible in general for statically sized data s

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Thomas DuBuisson
On Fri, Mar 26, 2010 at 6:16 PM, Felipe Lessa wrote: > I'd guess that the LLVM backend could generate code that is at least > as fast as gcc. It would be nice if you could test it. NCG done with GHC 6.12.1 w/ -O3 LLVM using a version of HEAD w/ -O3 GCC version 4.4.3 w/ -O3 Please take note Johns

[Haskell-cafe] Randomized N-Queens

2010-03-26 Thread Ronald Guida
Hi, I'm trying to solve the N-queens problem, but with a catch: I want to generate solutions in a random order. I know how to solve the N-queens problem; my solver (below) generates all possible solutions. What I am trying to do is generate solutions in a random order by somehow randomizing the

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Bernie Pope
On 27 March 2010 04:46, Rafael Cunha de Almeida wrote: > During a talk with a friend I came up with two programs, one written in > C and another in haskell. snip > The Haskell version: > real    0m45.335s > user    0m45.275s > sys     0m0.004s > > against the C version: > real    0m6.021s > use

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 9:13 PM, Ivan Lazar Miljenovic wrote: > David Menendez writes: >> On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic >> wrote: >>> Some definitions and exports got changed, so in 6.12 the (-> a) Monad >>> instance is exported whereas in 6.10 it isn't. >> >> What? Fro

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Yusaku Hashimoto
>> fac n = let {  f = foldr (*) 1 [1..n] } in f > > Why do you bother with the interior definition of f in there? > > fac = product . enumFromTo 1 let fac = do is_zero <- (==0); if is_zero then return 1 else liftM2 (*) id (fac . pred) -nwn On Sat, Mar 27, 2010 at 9:59 AM, Ivan Lazar Miljenovic

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Felipe Lessa
I'd guess that the LLVM backend could generate code that is at least as fast as gcc. It would be nice if you could test it. -- Felipe. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Ivan Lazar Miljenovic
David Menendez writes: > On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic > wrote: >> Some definitions and exports got changed, so in 6.12 the (-> a) Monad >> instance is exported whereas in 6.10 it isn't. > > What? From where? > > I thought the whole reason the Monad ((->) a) instance was

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 8:59 PM, Ivan Lazar Miljenovic wrote: > zaxis writes: >> In 6.10.4_1 under freebsd >>> let f x y z = x + y + z >> *Money> :t f >> f :: (Num a) => a -> a -> a -> a >> >>> :t (>>=) . f >> (>>=) . f  :: (Monad ((->) a), Num a) => a -> ((a -> a) -> a -> b) -> a -> b >>> ((>>=)

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Ivan Lazar Miljenovic
zaxis writes: > In 6.10.4_1 under freebsd >> let f x y z = x + y + z > *Money> :t f > f :: (Num a) => a -> a -> a -> a > >> :t (>>=) . f > (>>=) . f :: (Monad ((->) a), Num a) => a -> ((a -> a) -> a -> b) -> a -> b >> ((>>=) . f) 1 (\f x -> f x) 2 > > :1:1: > No instance for (Monad ((->) a))

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread Yusaku Hashimoto
Did you import the module includes the instance of Monad ((->) e) somewhere in your code loaded in ghci? I tried this on a fresh ghci 6.12, but I got "No instance" error. -nwn On Sat, Mar 27, 2010 at 9:20 AM, zaxis wrote: > > In 6.12.1 under archlinux >>let f x y z = x + y + z >> :t f > f :: (N

Re: [Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 8:20 PM, zaxis wrote: > > In 6.12.1 under archlinux >>let f x y z = x + y + z >> :t f > f :: (Num a) => a -> a -> a -> a > >> :t (>>=) . f > (>>=) . f :: (Num a) => a -> ((a -> a) -> a -> b) -> a -> b >> ((>>=) . f) 1 (\f x -> f x) 2 > 5 > > In 6.10.4_1 under freebsd >> let

[Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

2010-03-26 Thread zaxis
In 6.12.1 under archlinux >let f x y z = x + y + z > :t f f :: (Num a) => a -> a -> a -> a > :t (>>=) . f (>>=) . f :: (Num a) => a -> ((a -> a) -> a -> b) -> a -> b > ((>>=) . f) 1 (\f x -> f x) 2 5 In 6.10.4_1 under freebsd > let f x y z = x + y + z *Money> :t f f :: (Num a) => a -> a -> a ->

Re: [Haskell-cafe] Garbage collecting pointers

2010-03-26 Thread Sebastian Sylvan
On Fri, Mar 26, 2010 at 10:52 PM, Mads Lindstrøm wrote: > Hi > > On Fri, 2010-03-26 at 21:33 +, Sebastian Sylvan wrote: > > > > > > > Reorganizing data on the fly sounds like it may be a pretty sensible > > idea now that cache misses are so bad (in comparison). The fact that > > Haskell data i

Re: [Haskell-cafe] Garbage collecting pointers

2010-03-26 Thread Mads Lindstrøm
Hi On Fri, 2010-03-26 at 21:33 +, Sebastian Sylvan wrote: > > > Reorganizing data on the fly sounds like it may be a pretty sensible > idea now that cache misses are so bad (in comparison). The fact that > Haskell data is generally immutable helps too. > However, I think your scheme sounds

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Jason Dagit
On Fri, Mar 26, 2010 at 2:33 PM, Bryan O'Sullivan wrote: > On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida < > almeida...@gmail.com> wrote: > >> >> During a talk with a friend I came up with two programs, one written in >> C and another in haskell. > > > Your Haskell code builds a huge t

Re: [Haskell-cafe] Garbage collecting pointers

2010-03-26 Thread Mads Lindstrøm
Hi On Fri, 2010-03-26 at 21:24 +, Sebastian Sylvan wrote: > > > On Fri, Mar 26, 2010 at 9:21 PM, Brandon S. Allbery KF8NH > wrote: > On Mar 26, 2010, at 16:28 , Mads Lindstrøm wrote: > For some time I have been thinking about an idea, > which could li

Re: [Haskell-cafe] GSOC idea: Haskell JVM bytecode library

2010-03-26 Thread Chris Eidhof
On 26 mrt 2010, at 22:37, Alexandru Scvortov wrote: > How stable is it? I don't know. I remember that we didn't have to change anything and that everything just worked. > Was it easy to use? Actually yes, because: > Did it have enough documentation? I think we used the Java documentation. Th

Re: [Haskell-cafe] GSOC idea: Haskell JVM bytecode library

2010-03-26 Thread Alexandru Scvortov
How stable is it? Was it easy to use? Did it have enough documentation? Do you think it could use a rewrite? If so, what should be done differently? Could it be extended into something more? (sorry for the barrage of questions, but you're the one person I've seen so far, apart from the origi

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Bryan O'Sullivan
On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida < almeida...@gmail.com> wrote: > > During a talk with a friend I came up with two programs, one written in > C and another in haskell. Your Haskell code builds a huge thunked accumulator value, so of course it's slow (put bang patterns on

Re: [Haskell-cafe] Garbage collecting pointers

2010-03-26 Thread Sebastian Sylvan
On Fri, Mar 26, 2010 at 8:28 PM, Mads Lindstrøm wrote: > Hi > > For some time I have been thinking about an idea, which could limit > Haskell's memory footprint. I don't know if the idea is crazy or clever, > but I would love to hear peoples thoughts about it. The short story is, > I propose that

Re: [Haskell-cafe] GSOC idea: Haskell JVM bytecode library

2010-03-26 Thread Chris Eidhof
We've used this library to generate a prototype JVM backend for UHC about a year ago, and it Just Worked. That was probably on 6.10 or 6.8. -chris On 26 mrt 2010, at 21:33, Brian Alliet wrote: > On Fri, Mar 26, 2010 at 08:01:57PM +, Alexandru Scvortov wrote: >> I'm thinking of writing a lib

[Haskell-cafe] Garbage collecting pointers

2010-03-26 Thread Max Rabkin
On Fri, Mar 26, 2010 at 11:21 PM, Brandon S. Allbery KF8NH wrote: > On Mar 26, 2010, at 16:28 , Mads Lindstrøm wrote: >> >> For some time I have been thinking about an idea, which could limit >> Haskell's memory footprint. I don't know if the idea is crazy or clever, > > This is called pointer tag

Re: [Haskell-cafe] Garbage collecting pointers

2010-03-26 Thread Sebastian Sylvan
On Fri, Mar 26, 2010 at 9:21 PM, Brandon S. Allbery KF8NH < allb...@ece.cmu.edu> wrote: > On Mar 26, 2010, at 16:28 , Mads Lindstrøm wrote: > >> For some time I have been thinking about an idea, which could limit >> Haskell's memory footprint. I don't know if the idea is crazy or clever, >> > > Th

Re: [Haskell-cafe] haskell platform questions

2010-03-26 Thread Brandon S. Allbery KF8NH
On Mar 26, 2010, at 16:29 , Warren Harris wrote: FWIW, downloading the haskell-platform-2010.1.0.0 tarball and building it on my 10.5.8 system (with ghc 6.12.1 installed from the dmg) worked just fine. Didn't take too long either. Unfortunately I don't see any telltale linker options in the

Re: [Haskell-cafe] Garbage collecting pointers

2010-03-26 Thread Brandon S. Allbery KF8NH
On Mar 26, 2010, at 16:28 , Mads Lindstrøm wrote: For some time I have been thinking about an idea, which could limit Haskell's memory footprint. I don't know if the idea is crazy or clever, This is called pointer tagging. The original STG design avoided it because of the perceived perform

Re: [Haskell-cafe] GSOC idea: Haskell JVM bytecode library

2010-03-26 Thread Brian Alliet
On Fri, Mar 26, 2010 at 08:01:57PM +, Alexandru Scvortov wrote: > I'm thinking of writing a library for analyzing/generating/manipulating JVM > bytecode. To be clear, this library would allow one to load and work with > JVM > classfiles; it wouldn't be a compiler, interpretor or a GHC backe

Re: [Haskell-cafe] haskell platform questions

2010-03-26 Thread Warren Harris
FWIW, downloading the haskell-platform-2010.1.0.0 tarball and building it on my 10.5.8 system (with ghc 6.12.1 installed from the dmg) worked just fine. Didn't take too long either. Unfortunately I don't see any telltale linker options in the build logs. Warren On Mar 26, 2010, at 7:38 AM

[Haskell-cafe] Garbage collecting pointers

2010-03-26 Thread Mads Lindstrøm
Hi For some time I have been thinking about an idea, which could limit Haskell's memory footprint. I don't know if the idea is crazy or clever, but I would love to hear peoples thoughts about it. The short story is, I propose that the garbage collector should not just reclaim unused memory, it sho

Re: [Haskell-cafe] GSOC idea: Haskell JVM bytecode library

2010-03-26 Thread John Meacham
This is certainly something I could use. John -- John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] GSOC idea: Haskell JVM bytecode library

2010-03-26 Thread Alexandru Scvortov
Hi, I've got an idea for a Summer of Code project and I'd really appreciate some feedback on it. If people generally find it interesting, I'll go into more detail. GSoC: Haskell JVM bytecode library == What I'm thinking of writing a library for analyzing

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-03-26 Thread Isaac Dupree
On 03/25/10 12:36, Simon Marlow wrote: I'd also be amenable to having block/unblock count nesting levels instead, I don't think it would be too hard to implement and it wouldn't require any changes at the library level. Wasn't there a reason that it didn't nest? I think it was that operations

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-26 Thread John Meacham
Here are jhc's timings for the same programs on my machine. gcc and ghc both used -O3 and jhc had its full standard optimizations turned on. jhc: ./hs.out 5.12s user 0.07s system 96% cpu 5.380 total gcc: ./a.out 5.58s user 0.00s system 97% cpu 5.710 total ghc: ./try 31.11s user 0.00s system 9

Re: [Haskell-cafe] GHC vs GCC

2010-03-26 Thread Jason Dagit
On Fri, Mar 26, 2010 at 10:46 AM, Rafael Cunha de Almeida < almeida...@gmail.com> wrote: > Hello, > > During a talk with a friend I came up with two programs, one written in > C and another in haskell. > > Haskell >main :: IO () >main = print $ rangeI 0 0 > >rangeK :: Int -

[Haskell-cafe] GHC vs GCC

2010-03-26 Thread Rafael Cunha de Almeida
Hello, During a talk with a friend I came up with two programs, one written in C and another in haskell. Haskell main :: IO () main = print $ rangeI 0 0 rangeK :: Int -> Int -> Int -> Int -> Int rangeK i j k acc | k < 1000 = if

[Haskell-cafe] Re: Patch for library (new feature) - how to deal with it

2010-03-26 Thread Maciej Piechotka
On Fri, 2010-03-26 at 17:06 +, Duncan Coutts wrote: > On Fri, 2010-03-26 at 16:50 +, Maciej Piechotka wrote: > > On Fri, 2010-03-26 at 13:29 +, Duncan Coutts wrote: > > > On Fri, 2010-03-26 at 02:11 +, Maciej Piechotka wrote: > > > > Hello, > > > > > > > > I have written patch (at

[Haskell-cafe] Re: Patch for library (new feature) - how to deal with it

2010-03-26 Thread Maciej Piechotka
On Fri, 2010-03-26 at 13:29 +, Duncan Coutts wrote: > On Fri, 2010-03-26 at 02:11 +, Maciej Piechotka wrote: > > Hello, > > > > I have written patch (attached) which introduce new API for zlib - > > personally I wrote it to have easy implementation of > > compression/decompression in itera

Re: [Haskell-cafe] Asynchronous exception wormholes kill modularity

2010-03-26 Thread Bas van Dijk
On Fri, Mar 26, 2010 at 3:43 PM, Gregory Collins wrote: > Matthew Brecknell writes: > >> And is confirmed by a simple test (with GHC 6.10.4 on Linux): >> >> import Prelude hiding(catch) >> import Control.Concurrent >> import Control.Exception >> >> main = do >>   chan <- newEmptyMVar >>   done <-

Re: [Haskell-cafe] ANN: data-category, restricted categories

2010-03-26 Thread David Menendez
On Fri, Mar 26, 2010 at 11:07 AM, Edward Kmett wrote: > > On Fri, Mar 26, 2010 at 11:04 AM, Edward Kmett wrote: >> >> -- as long as you're ignoring 'seq' >> terminateSeq :: a -> Unit >> terminateSeq a = a `seq` unit >> > > Er ignore that language about seq. a `seq` unit is either another bottom o

Re: [Haskell-cafe] ANN: data-category, restricted categories

2010-03-26 Thread Edward Kmett
On Fri, Mar 26, 2010 at 11:04 AM, Edward Kmett wrote: > > -- as long as you're ignoring 'seq' > terminateSeq :: a -> Unit > terminateSeq a = a `seq` unit > > Er ignore that language about seq. a `seq` unit is either another bottom or undefined, so there remains one canonical morphism even in the

Re: [Haskell-cafe] ANN: data-category, restricted categories

2010-03-26 Thread Edward Kmett
On Mon, Mar 22, 2010 at 12:33 PM, Sjoerd Visscher wrote: > > Of course the are still a lot of things missing, especially in the details. > And I'm a category theory beginner, so there will probably be some mistakes > in there as well. F.e. Edward Kmett doesn't like () being the terminal > object i

Re: [Haskell-cafe] Patch for library (new feature) - how to deal with it

2010-03-26 Thread Gregory Collins
Maciej Piechotka writes: > Hello, > > I have written patch (attached) which introduce new API for zlib - > personally I wrote it to have easy implementation of > compression/decompression in iteratee (example file - no yet working > -attached). +1, I need this also, and was planning on writing s

Re: [Haskell-cafe] Takusen sqlite3 insert is very slow

2010-03-26 Thread David Sankel
This FAQ on the sqlite website seems relevant: http://www.sqlite.org/faq.html#q19 David On Wed, Mar 24, 2010 at 5:34 PM, Vasyl Pasternak wrote: > Hi Jason, > > Your recommendations worked for me. When I enclosed updating into > single transaction, the code executed in less than 0.5 seconds, whi

Re: [Haskell-cafe] Asynchronous exception wormholes kill modularity

2010-03-26 Thread Gregory Collins
Matthew Brecknell writes: > And is confirmed by a simple test (with GHC 6.10.4 on Linux): > > import Prelude hiding(catch) > import Control.Concurrent > import Control.Exception > > main = do > chan <- newEmptyMVar > done <- newEmptyMVar > kill <- block $ forkIO $ do > (takeMVar chan >>

Re: [Haskell-cafe] haskell platform questions

2010-03-26 Thread Gregory Collins
Malcolm Wallace writes: >> It's a known issue, and it's mine. If you (naively) just expect to link on >> Snow Leopard without passing any special backwards- >> compatibility flags, and have things work on Leopard, well, Apple has news >> for you. > > gcc -mmacox-version-min=10.5.8 ? Something

Re: [Haskell-cafe] haskell platform questions

2010-03-26 Thread Malcolm Wallace
It's a known issue, and it's mine. If you (naively) just expect to link on Snow Leopard without passing any special backwards- compatibility flags, and have things work on Leopard, well, Apple has news for you. gcc -mmacox-version-min=10.5.8 ? Regards, Malcolm

Re: [Haskell-cafe] Windows version of Haskell Platform containing ghc 6.12

2010-03-26 Thread Ivan Lazar Miljenovic
Han Joosten writes: > Last weekend a new version of the haskell platform has been released. I was > expecting that also for windows the ghc 6.12 would be in it. However, when I > follow the link: > > http://hackage.haskell.org/platform/windows.html > > I still get the 'old' version (2009.2.0.2) w

[Haskell-cafe] Windows version of Haskell Platform containing ghc 6.12

2010-03-26 Thread Han Joosten
Last weekend a new version of the haskell platform has been released. I was expecting that also for windows the ghc 6.12 would be in it. However, when I follow the link: http://hackage.haskell.org/platform/windows.html I still get the 'old' version (2009.2.0.2) which contains ghc 6.10 Is this