[ghc-steering-committee] #216: Qualified Do, recommendation: accept
Joachim Breitner
mail at joachim-breitner.de
Wed Mar 11 18:36:44 UTC 2020
Dear Committe,
Proposal:
https://github.com/tweag/ghc-proposals/blob/local-do/proposals/0000-local-do.rst
Discussion: https://github.com/ghc-proposals/ghc-proposals/pull/216
Summary:
last June we looked at a “local do” proposal that would be a more
targetted variant of RebindableSyntax, just for “do”. After an initial
acceptance recommendation from me we had some good discussion, and
eventually sent it back for revision. One problem, among many, was that
the story around type inference wasn’t as good as with normal “do”.
All attempts to give meaning to “do” via a local value (e.g. a record,
or type classes etc.) were unsatisfying in one way or another. (Often
something about mumble impredicative types mumble.)
Anyways, Facundo Domínguez joined the author team and the discussion
steered towards a less ambitious, but simpler and cleaner proposal:
Qualified do. The idea is simply to treat a module qualifier on the do
keyword as a qualified on all the implicit :
M.do { x <- u; stmts } = (M.>>=) u (\x -> M.do { stmts })
and similar for the other monad desugaring rules.
Recommendation:
This seems simple, convenient and easy to understand, so I recommend
accepting the proposal.
Comment:
There was some discussion if
M.do { return x } = M.return x
but it seems that changing the meaning of more than `do` it self may be
more confusing than helpful, so the proposal as it stands does _not_
propose it (see Alternatives). I wish we had a better story here, and
welcome ideas from the committee.
WDYAT?
Cheers,
Joachim
--
Joachim Breitner
mail at joachim-breitner.de
http://www.joachim-breitner.de/
More information about the ghc-steering-committee
mailing list