2009/3/13 Marcin Kosiba <marcin.kos...@gmail.com>: > Hi, > I've already checked those out. I tried using your yield > implementation and > while it works, I couldn't get it to work with the state monad. > So while: > data RecPair a b = Nil | RP (b, a -> RecPair a b) > yield x = Cont $ \k -> RP (x, k) > > got me half-way to my goal, I couldn't figure out how to make > something like: > > yield' = do > state <- get > state' <- yield state > put state'
Basically, the yield is built upon the Cont monad which has a transformer counter part, ContT. You could try and re-implement the yield under ContT instead of just Cont then you can stack ContT on top of State (or StateT if you need more monads) and have a state (i.e. get/put) and the yield. Hope this helps. Cristiano _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe