[Haskell-cafe] Error Monad and strings

Gregory Crosswhite gcross at phys.washington.edu
Tue Jul 27 18:49:42 EDT 2010


It is for the very annoying reason that in order for Error to be a monad
it has to implement the "fail" method, which means it has to know how to
turn an arbitrary string into a value of your error type.

Cheers,
Greg

On 07/27/10 15:32, Gerald Gutierrez wrote:
>
> Reading the Control.Monad.Error documentation, I see that the Error
> class has noMsg and strMsg as its only two functions.
>
> Now, I understand that you can define your own Error instances such as
> in example 1 of the documentation, so why the need to always support
> strings via noMsg/strMsg ? What uses these? And if in my code, I will
> never throw an error with a string, am I supposed to implement these
> functions and then ignore them?
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100727/bbc0adfb/attachment.html


More information about the Haskell-Cafe mailing list