newbie: running a state transformer in context of a state rea der
Marcin 'Qrczak' Kowalczyk
qrczak@knm.org.pl
21 Feb 2001 07:00:39 GMT
Tue, 20 Feb 2001 17:52:33 -0800, Konst Sushenko <konsu@microsoft.com> pisze:
> lookahead p = do { s <- fetch
> ; lift (evalState p s)
> }
>
> is typed as
>
> lookahead:: State MyState Maybe a -> State MyState Maybe (a,MyState)
>
> but i need
>
> lookahead:: State MyState Maybe a -> State MyState Maybe a
myEvalState = liftM fst yourEvalState
Andy Gill's monadic modules provide evalState as a wrapper for runState,
which throws away the state component returned.
--
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK