multiple methods pattern bug(?)
Ch. A. Herrmann
herrmann at fmi.uni-passau.de
Thu Apr 11 09:48:15 EDT 2002
Hi,
the following instance declaration doesn't work any
more with ghc-5.02.3, it worked before.
> newtype ST state a = ST { unST :: state -> (a,state) }
>
> instance Monad (ST c) where
> return x = ST (\state -> (x,state))
> (m >>= f) = ST (\state -> let (x,state1) = unST m state
> (y,state2) = unST (f x) state1
> in (y,state2))
Error message:
Can't handle multiple methods defined by one pattern binding
(m >>= f)
= ST (\ state
-> let
(y, state2) = ...
(x, state1) = ...
in (y, state2))
What can I do instead?
--
Christoph
More information about the Glasgow-haskell-bugs
mailing list