#1537: do notation translation
--------------------------------------+-------------------------------------
Reporter: Isaac Dupree | Owner: simonpj
Type: bug | Status: closed
Priority: normal | Milestone: 6.10 branch
Component: Compiler (Type checker) | Version: 6.7
Severity: normal | Resolution: fixed
Keywords: | Difficulty: Unknown
Testcase: rebindable8, rebindable9 | Architecture: Unknown
Os: Unknown |
--------------------------------------+-------------------------------------
Comment (by simonpj):
Oleg remarks:
It seems this fix should make the do notation work both for restricted
and parameterized monads. The article mentioned in the ticket did not
make it clear that the restricted and parameterized monads are
distinct. Here is the interface that should work both for
parameterized and restricted monads:
{{{
class MonadB m1 m2 m3 a b | m1 m2 -> m3 where
bind:: m1 a -> (a -> m2 b) -> m3 b
class MonadR m a where
ret:: a -> m a
fail:: String -> m a
}}}
Parameterized monads parameterize on `m` (or `m1`, `m2`, `m3`) whereas
restricted monads specialize 'a' or 'b' (one can imagine `monads' that
do both).
Incidentally,
http://okmij.org/ftp/Haskell/RestrictedMonad.lhs
http://okmij.org/ftp/Computation/VarStateM.hs
can be used (with small adjustments) as tests of the new do-notation.
The adjustments is in replacing `bind2/ret2` or `gbind/gret` and the
corresponding infix operators with the do-notation.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1537#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs