[Haskell-cafe] Re: Optimizing 'sequence'

2008-07-23 Thread Gracjan Polak
Chaddaï Fouché chaddai.fouche at gmail.com writes: 2008/7/22 Luke Palmer lrpalmer at gmail.com: A little formal reasoning reveals that sequence1 = sequence2 exactly when (=) is strict in its left argument. There are four common monads which are _not_: Identity, Reader, Writer, State (and

Re: [Haskell-cafe] Re: Optimizing 'sequence'

2008-07-23 Thread Janis Voigtlaender
Gracjan Polak wrote: How do I reason if = for parsers is lazy in its first argument? Well, to quote from the abstract of the paper I already mentioned (http://citeseer.ist.psu.edu/704350.html): By testing before proving we avoid wasting time trying to prove statements that are not valid. I

Re: [Haskell-cafe] Re: Optimizing 'sequence'

2008-07-23 Thread Don Stewart
gracjanpolak: Chaddaï Fouché chaddai.fouche at gmail.com writes: 2008/7/22 Luke Palmer lrpalmer at gmail.com: A little formal reasoning reveals that sequence1 = sequence2 exactly when (=) is strict in its left argument. There are four common monads which are _not_: Identity, Reader,

Re: [Haskell-cafe] Re: Optimizing 'sequence'

2008-07-23 Thread Andrew Coppin
Janis Voigtlaender wrote: How about some QuickChecking in connection with the Chasing bottoms library (http://citeseer.ist.psu.edu/704350.html)? Ah, finally a reference to what this curios phrase is actually about...! ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: Optimizing 'sequence'

2008-07-22 Thread Gracjan Polak
Antoine Latter aslatter at gmail.com writes: The function runIdentity is found in Control.Monad.Identity in the mtl package. Thanks, I see it now! Laziness is not there! But still... Identity is a bit special monad. What other monads need full laziness in sequence? As far as I know IO is

Re: [Haskell-cafe] Re: Optimizing 'sequence'

2008-07-22 Thread Janis Voigtlaender
Gracjan Polak wrote: Initially I spotted this possible optimization in context of monadic parser. I am not really sure if I need this property there or not. How do I prove this to myself? How about some QuickChecking in connection with the Chasing bottoms library

Re: [Haskell-cafe] Re: Optimizing 'sequence'

2008-07-22 Thread Luke Palmer
On Tue, Jul 22, 2008 at 1:15 AM, Gracjan Polak [EMAIL PROTECTED] wrote: Antoine Latter aslatter at gmail.com writes: The function runIdentity is found in Control.Monad.Identity in the mtl package. But still... Identity is a bit special monad. What other monads need full laziness in

Re: [Haskell-cafe] Re: Optimizing 'sequence'

2008-07-22 Thread Chaddaï Fouché
2008/7/22 Luke Palmer [EMAIL PROTECTED]: A little formal reasoning reveals that sequence1 = sequence2 exactly when (=) is strict in its left argument. There are four common monads which are _not_: Identity, Reader, Writer, State (and RWS by extension). Still if that makes that much of a