Rebindable syntax for monads and arrows
Simon Peyton-Jones
simonpj at microsoft.com
Mon Apr 4 08:14:19 EDT 2005
Ross, Amr,
OK. I've done rebindable syntax for do-notation, in the HEAD. Care to
try it? What this means is that, with -fno-implicit-prelude,
do { pat <- e; Q }
has the same static semantics as
e >>= (\x -> case x of { pat -> do { Q }; other -> fail "urk")
where the (>>=) is whatever (>>=) happens to be in scope at that point.
The situation for arrows is unchanged; no rebindable syntax. (Partly
because the detailed spec is unclear.)
It does *not* work for mdo, because mdo uses (>>=) at a polymorphic
type. Just do-notation. Which is, I hope, enough for you.
Simon
| -----Original Message-----
| From: Amr A Sabry [mailto:sabry at cs.indiana.edu]
| Sent: 24 January 2005 19:40
| To: Simon Peyton-Jones
| Cc: Amr A Sabry; ross at soi.city.ac.uk
| Subject: Re: Rebindable syntax for monads and arrows
|
| > You've convinced me about the monad one; GHC doesn't implement its
own
| > manual! And it's not hard to fix. So it's on my to-do list.
|
| :-)
|
| > Meanwhile, I'd like to know: if I did the monad thing, would that be
| > useful to you, or just a generally good thing. And if the former,
how
| > useful? That is, how hard should I try to get to it?!
|
| It would definitely be useful but not critical at this point.
|
| Thanks. --Amr
More information about the Glasgow-haskell-users
mailing list