[Ur] Implementing StateMonad transformer

Sergey Mironov grrwlf at gmail.com
Fri Dec 13 11:26:17 EST 2013


OK, state monad now works as it should.

https://github.com/grwlf/urweb-monad-state

details here

https://github.com/grwlf/urweb-monad-state/blob/master/state.ur
https://github.com/grwlf/urweb-monad-state/blob/master/test/Test4.ur

ML functors are great, they really make it possible to avoid
Type-to-Type kinds in datatypes. In Haskell we often use language
features to add the polymorphism to every function exported by a
module, looks like this is another way - we may just add parameters to
module itself. Not sure which way is better in general, but this
particular task looks simpler with ML functors. Reimplementing
Haskell's mtl in UrWeb is just a matter of time:) Seriously, there are
tricky monads there, continuation monad and monadFix may require
laziness, but maybe I'll try to write them one day.

> You're not the first to ask for this feature. :)  Here's the open issue:
>     http://www.impredicative.com/mantis/view.php?id=48
>
> Someone else sketched a solution, but somehow I haven't found the motivation
> to implement it.  I'd love to accept a related patch by someone else!
>
> [There are elements of the Ur/Web toolset that I eventually get tired of
> improving.  So far these seem to have focused on parsing and the Emacs mode.
> :)]

Understand that. I would not call UrWeb syntax easy with all it's
anti-quotations and type-level programming..

Regards,
Sergey



More information about the Ur mailing list