[Ur] Troubles writing error monad
Adam Chlipala
adamc at csail.mit.edu
Tue Jun 9 19:29:45 EDT 2015
On 06/09/2015 07:19 PM, Sergey Mironov wrote:
> Hi. I am trying to write an [Error] monad. So far I've managed to
> write the code (see below), which is rejected by the compiler
It's just a case of incompleteness in type inference. An extra
annotation sorts it all out. In particular, this line of code
> val monad_error = fn [e ::: Type] => (mkMonad { Return = @@mreturn [e], Bind = @@mbind [e] })
can be changed to this one:
val monad_error = fn [e ::: Type] => (@@mkMonad [error e] { Return =
@@mreturn [e], Bind = @@mbind [e] })
More information about the Ur
mailing list