[Haskell-cafe] Sequencing Operations in a Monad

2007-09-15 Thread Dominic Steinitz
If you arrange the types to try to do all the operations inside the IO monad you can't chain together more than 1 binary operation. eg. do S - A + B Z - Q * S vs do S - Q * (A + B) Are there any suggestions for this dilemma? Am I using the wrong monad for this task?

Re: [Haskell-cafe] Sequencing Operations in a Monad

2007-09-15 Thread SevenThunders
Dominic Steinitz wrote: If you arrange the types to try to do all the operations inside the IO monad you can't chain together more than 1 binary operation. eg. do S - A + B Z - Q * S vs do S - Q * (A + B) Are there any suggestions for this dilemma? Am I using

Re: [Haskell-cafe] Building production stable software in Haskell

2007-09-15 Thread Adrian Hey
David Roundy wrote: I long for a Data.Map.Strict, for instance, because it's so hard to use Data.Map without producing memory leaks... It's at times like this that I really wonder why on earth I bother working hard on libs for the benefit of the community. But I guess I'm not alone in that.

Re: [Haskell-cafe] Sequencing Operations in a Monad

2007-09-15 Thread Ronald Guida
SevenThunders wrote: OK so check out what really happens with liftM2. Suppose I have an IO containing an involved matrix computation called s. For simplicity we might assume that s :: IO (Int) and the Int is an index into an array containing a bunch of matrices in C land. Assume

[Haskell-cafe] Re: Sequencing Operations in a Monad

2007-09-15 Thread apfelmus
SevenThunders wrote: Ryan Ingram wrote: As long as the FFI calls don't make destructive updates to existing matrices, you can do what you want. For example, assuming you have: -- adds the second matrix to the first overwrites the first matrixAddIO :: MatrixIO - MatrixIO - IO () -- creates a

Re: [Haskell-cafe] Sequencing Operations in a Monad

2007-09-15 Thread Paul Johnson
SevenThunders wrote: Unfortunately if I wrap my matrix references in the IO monad, then at best computations like S = A + B are themselves IO computations and thus whenever they are 'invoked' the computation ends up getting performed repeatedly contrary to my intentions. This sounds like a

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-15 Thread Sven Panne
On Tuesday 11 September 2007 09:17, Don Stewart wrote: Just in case people didn't see, the `binary' package lives on http://darcs.haskell.org/binary/ However, Lennart Kolmodin, Duncan and I are actively maintaining and reviewing patches, so send them to one (or all) of us for review.

[Haskell-cafe] Type-Marking finite/infinte lists?

2007-09-15 Thread Joachim Breitner
Hi, today while mowing the lawn, I thought how to statically prevent some problems with infinte lists. I was wondering if it is possible to somehow mark a list as one of finite/infinite/unknown and to mark list-processing functions as whether they can handle infinte lists. For example, it is

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-15 Thread Stefan O'Rear
On Sat, Sep 15, 2007 at 01:20:57PM +0200, Sven Panne wrote: On Tuesday 11 September 2007 09:17, Don Stewart wrote: Just in case people didn't see, the `binary' package lives on http://darcs.haskell.org/binary/ However, Lennart Kolmodin, Duncan and I are actively maintaining and

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-15 Thread Sven Panne
On Saturday 15 September 2007 20:09, Stefan O'Rear wrote: packages is only for those libraries that are shipped with GHC. First of all, this fact would be new to me, furthermore this would be a highly volatile categorization. Should URLs change when a package suddenly gets into or was thrown

Re: [Haskell-cafe] Type-Marking finite/infinte lists?

2007-09-15 Thread David Menendez
On 9/15/07, Joachim Breitner [EMAIL PROTECTED] wrote: today while mowing the lawn, I thought how to statically prevent some problems with infinte lists. I was wondering if it is possible to somehow mark a list as one of finite/infinite/unknown and to mark list-processing functions as whether

[Haskell-cafe] Re: [Haskell] question about a failure to generalize

2007-09-15 Thread Tim Chevalier
[replying to haskell-cafe] On 9/15/07, Norman Ramsey [EMAIL PROTECTED] wrote: Dear Haskellers, I've had a Haskell program rejected for reasons I don't understand. Here's the relevant bit of code; the problem is that I expected the type-inference engine to generalize the abbreviation 'fold'

Re: [Haskell-cafe] Re: [Haskell] question about a failure to generalize

2007-09-15 Thread Neil Mitchell
Hi Monomorphism restriction? Replacing fold with foldRegsUsed would work because there's a type signature for foldRegsUsed. That looks like it. Another solution would be: fold = foldRegsUsed becomes: fold x = foldRegsUsed x Now the monomorphism restriction doesn't kick in because fold

[Haskell-cafe] How can I stop GHCi from calling show for IO actions?

2007-09-15 Thread Ryan Ingram
Prelude let inf = repeat 1 Prelude inf [1,1,(lots of output until I press ctrl-c),Interrupted. (I expect this to happen) Prelude let x = inf (no output here!) Prelude :t x x :: [Integer] Prelude return inf [1,1,(lots of output until I press ctrl-c),Interrupted. (I also expect this to happen)

Re: [Haskell-cafe] How can I stop GHCi from calling show for IO actions?

2007-09-15 Thread Stefan O'Rear
On Sat, Sep 15, 2007 at 08:35:02PM -0700, Ryan Ingram wrote: Prelude let inf = repeat 1 Prelude inf [1,1,(lots of output until I press ctrl-c),Interrupted. (I expect this to happen) Prelude let x = inf (no output here!) Prelude :t x x :: [Integer] Prelude return inf [1,1,(lots of output

Re: [Haskell-cafe] How can I stop GHCi from calling show for IO actions?

2007-09-15 Thread Sam Hughes
Ryan Ingram wrote: Prelude let inf = repeat 1 Prelude inf [1,1,(lots of output until I press ctrl-c),Interrupted. (I expect this to happen) Prelude let x = inf (no output here!) Prelude :t x x :: [Integer] Prelude return inf [1,1,(lots of output until I press ctrl-c),Interrupted. (I also expect

[Haskell-cafe] unknown RTS option: -N2

2007-09-15 Thread Gregory Propf
I've built a program with the -threaded option using ghc. This option is supposed to link your program to the threaded runtime with support for multicore CPUS (mine is a dual core). The program pukes with the message in the subject line when I try to use the -N option to tell it to use both

Re: [Haskell-cafe] unknown RTS option: -N2

2007-09-15 Thread Stefan O'Rear
On Sat, Sep 15, 2007 at 09:49:56PM -0700, Gregory Propf wrote: I've built a program with the -threaded option using ghc. This option is supposed to link your program to the threaded runtime with support for multicore CPUS (mine is a dual core). The program pukes with the message in the