[Haskell] Re: Converting a 'streaming' monad into a list

apfelmus at quantentunnel.de apfelmus at quantentunnel.de
Sun Dec 31 14:10:10 EST 2006


Ross Paterson wrote:
> On Sat, Dec 30, 2006 at 10:31:30PM +0000, Chris Kuklewicz wrote:
>> But WriterT is not lazy enough.  So I put a lazier version up on the wiki:
>>
>> http://haskell.org/haskellwiki/New_monads/LazyWriterT
> 
> Interesting.  Writer is lazy but WriterT Identity isn't.  I imagine that
> both lazy and strict variants would be useful.  Same for State/StateT.

Is there a compelling reason why I should want a "strict" version? Here,
strictness only means that the pattern match on (,) may fail which
implies that the pair is _|_ anyway. Strictness here does *not* mean
that the stuff written out is evaluated strictly, only that the pair
constructor is matched by a refutable pattern. In other words, is there
an example where one would prefer (foo (a,b) = ...) over (foo ~(a,b) =
...) for reasons of time and space? If not, then I think it's a bug.

Regards,
apfelmus



More information about the Haskell mailing list