[Haskell] ANNOUNCE: generator 0.5.1

Yair Chuchem yairchu at gmail.com
Thu Jul 16 03:54:51 EDT 2009


On Jul 16, 2009, at 10:18 AM, Bas van Dijk wrote:
> I see you define ListT as a datatype:
>
> http://hackage.haskell.org/packages/archive/generator/0.5.1/doc/html/src/Control-Monad-ListT.html#ListT
>
> Can't you better define it as a newtype
I should had done that, and next released version will fix it.

> BTW, note that your ListT is also similar to my StreamT:
> http://code.haskell.org/~basvandijk/code/stream/Control/Monad/StreamT.hs
> (not on Hackage)

It seems like StreamT is an infinite-list version of ListT.

another difference is that StreamT redefines scanl, transpose, etc
and for ListT I created a List class (for which regular lists are an  
instance)
for which the standard list functions are defined: filter, takeWhile,  
everything which keeps items in the list
for functions which don't keep the item in the list I define similar  
functions (because the result is in the item monad the type is  
different)

so you can do

import Data.List.Class (takeWhile)
import Prelude hiding (takeWhile)

and still use takeWhile for lists (except maybe mine isn't as  
efficient as Data.List's and maybe doesn't bring its useful rewrite  
rules to play)

thanks to SequenceT I also found http://www.haskell.org/haskellwiki/ListT_done_right 
  which at its core is just like my ListT



More information about the Haskell mailing list