[Haskell-cafe] Monadifying pickler combinators
joelr1 at gmail.com
Mon Nov 7 11:32:18 EST 2005
I'm trying to monadify http://research.microsoft.com/~akenn/fun/
appU is easy but I can't figure out the appP. Is it actually
possible? The clever trick seems to be the passing of (b -> a) into
sequ for use in appP.
instance Monad (PU s) where
return a = PU snd (\s -> (a, s))
-- how do I do appP below?
pa >>= k = PU (\(b, s) -> let pb = k a
in appP pa (a, ???
-- this is good
(\s -> let (a, s1) = appU pa s
pb = k a
in appU pb s1)
More information about the Haskell-Cafe