[Ur] Troubles writing error monad

Sergey Mironov grrwlf at gmail.com
Wed Jun 10 16:11:15 EDT 2015


Thanks, it works now!

Sergey

2015-06-10 2:29 GMT+03:00 Adam Chlipala <adamc at csail.mit.edu>:
> 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] })
>
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur



More information about the Ur mailing list