[Ur] Implementing StateMonad transformer

Sergey Mironov grrwlf at gmail.com
Thu Dec 12 11:43:30 EST 2013


>> datatype state m st a = State of (st ->  m (st * a))
>>
>
> You can still abstract a datatype over arbitrary kinds using functors (in
> the module system), though.  Let me know if that isn't a clear enough hint!

OK, I thought about functors too. I'll learn them and try.

By the way, a long term feature-request: if I understand correctly,
pattern matching doesn't work with  left-hand values of '<-'. So I had
to write code like

  r <- return aPair; (* returns (a,b)  *)
  let
    val (a,b) = r
  in
     .. use a and b ..
  end

It would be cool if we were able to write it directly instead

(a,b) <- return aPair;
.. use a and b ..

Regards,
Sergey



More information about the Ur mailing list