
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
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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Regards Sumit Sahrawat