[Haskell-cafe] Unique monad?

Andrew Coppin andrewcoppin at btinternet.com
Mon Mar 30 15:29:14 EDT 2009


Maybe I'm just being blind here, but I don't see a monad transformer (or 
even a monad) in the standard libraries for producing "unique" values. 
Have I missed something?

Related, I don't see a monad for gradually consuming input. We've got 
the Reader monad, but that appears to just give you global access to a 
single monolithic value. That value could be some kind of collection, 
but there's no way to track where you've read up to (or efficiently 
access that point). We've got Parsec, which is a pretty efficient and 
powerful text parser. But what if you don't need full parsing 
capabilities? You just need to consume input, but you're not exactly 
sure where you're going to consume it? The Writer monad seems to let you 
incrimentally write values out, but there's no matching monad for 
incrimentally reading stuff back in.

(I guess ultimately you can build all these specialised monads out of 
the general State monad if you want. I'm just surprised they're not 
already defined somewhere...)




More information about the Haskell-Cafe mailing list