[Haskell-cafe] RebindableSyntax on individual do blocks
Sumit Sahrawat, Maths & Computing, IIT (BHU)
sumit.sahrawat.apm13 at iitbhu.ac.in
Mon Jun 22 18:56:36 UTC 2015
I don't know anything about indexed monads, but it seems that you can use
the 'where' keyword to rebind (>>) and return for any block you want [1].
An example from [1]:
addNumbers = do
80
60
10
where (>>) = (+)
It might be possible to generate this where block using TH.
There is also a quasi-quoter available for indexed-do-notation [2].
[1]:
https://ocharles.org.uk/blog/guest-posts/2014-12-06-rebindable-syntax.html
[2]: https://github.com/fumieval/indexed-do-notation
On 23 June 2015 at 00:09, Mark Roberts <markandrusroberts at gmail.com> wrote:
> I have a program that uses both monads and indexed monads, and I'd like to
> use do-notation for each in the same source file. Is there a way to rebind
> syntax for only the do blocks that make use of an indexed monad?
>
> Thanks,
> Mark
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
--
Regards
Sumit Sahrawat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150623/29f45451/attachment.html>
More information about the Haskell-Cafe
mailing list