On Sun, 27 May 2007, Andrew Coppin wrote: > such that a Reader is created with an initial list, and the read > function fetches 1 element out of that list. That is, the expression "x > <- read" will take the head element of the list and put it into x, > keeping the tail to be read later. > > (Oh yeah - and apparently that clashes with Prelude.read. Oh well!) > > I can't figure out how to implement this... The closest I managed was to > make a Reader object also contain a function that tells (>>=) what to do > to the Reader object you're binding against... But that seems to be > horribly buggy.
Confusingly MonadReader and MonadWriter in the Monad Template Library are not quite counterparts. Reader does not consume its input, Writer does not overwrite its output. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe