Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Stephan Friedrichs
Hello Brian, Brian Hurt wrote: [...] So today's question is: why isn't there a Strict monad? Something like: data Strict a = X a instance Monad Strict where ( = ) (X m) f = let x = f m in x `seq` (X x) return a = a `seq` (X a) unless I am mistaken, this violates the first

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Luke Palmer
On Thu, Jan 1, 2009 at 12:25 PM, Brian Hurt bh...@spnz.org wrote: First off, let me apologize for this ongoing series of stupid newbie questions. Haskell just recently went from that theoretically interesting language I really need to learn some day to a language I actually kinda understand

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Jonathan Cast
On Thu, 2009-01-01 at 14:25 -0500, Brian Hurt wrote: First off, let me apologize for this ongoing series of stupid newbie questions. Haskell just recently went from that theoretically interesting language I really need to learn some day to a language I actually kinda understand and can

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread David Menendez
2009/1/1 Luke Palmer lrpal...@gmail.com: So that's the answer: there already is a Strict monad. And an attempt to make a lazier one strict just results in breaking the monad laws. There is at least one transformer that will make a strict monad out of a non-strict monad. newtype CPS m a = CPS

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Luke Palmer
On Thu, Jan 1, 2009 at 1:31 PM, David Menendez d...@zednenem.com wrote: 2009/1/1 Luke Palmer lrpal...@gmail.com: So that's the answer: there already is a Strict monad. And an attempt to make a lazier one strict just results in breaking the monad laws. There is at least one transformer

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread David Menendez
On Thu, Jan 1, 2009 at 3:44 PM, Luke Palmer lrpal...@gmail.com wrote: On Thu, Jan 1, 2009 at 1:31 PM, David Menendez d...@zednenem.com wrote: newtype CPS m a = CPS { unCPS :: forall b. (a - m b) - m b } I have heard this called the codensity monad (and it appears under that name in

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Jonathan Cast
On Thu, 2009-01-01 at 13:44 -0700, Luke Palmer wrote: On Thu, Jan 1, 2009 at 1:31 PM, David Menendez d...@zednenem.com wrote: 2009/1/1 Luke Palmer lrpal...@gmail.com: So that's the answer: there already is a Strict monad. And an attempt to make a

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Luke Palmer
On Thu, Jan 1, 2009 at 2:30 PM, Jonathan Cast jonathancc...@fastmail.fmwrote: On Thu, 2009-01-01 at 13:44 -0700, Luke Palmer wrote: On Thu, Jan 1, 2009 at 1:31 PM, David Menendez d...@zednenem.com wrote: 2009/1/1 Luke Palmer lrpal...@gmail.com: So that's the

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread David Menendez
On Thu, Jan 1, 2009 at 4:30 PM, Jonathan Cast jonathancc...@fastmail.fm wrote: On Thu, 2009-01-01 at 13:44 -0700, Luke Palmer wrote: In my reply I missed the important consideration of the strictness of (=), irrsepective of the values. While you can not force values to be strict in a monad

Re: [Haskell-cafe] Stupid question #852: Strict monad

2009-01-01 Thread Jonathan Cast
On Thu, 2009-01-01 at 17:03 -0500, David Menendez wrote: On Thu, Jan 1, 2009 at 4:30 PM, Jonathan Cast jonathancc...@fastmail.fm wrote: On Thu, 2009-01-01 at 13:44 -0700, Luke Palmer wrote: In my reply I missed the important consideration of the strictness of (=), irrsepective of the