[Haskell-cafe] Re: not possible with monad transformers ?
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Wed Dec 1 06:56:31 EST 2004
Jules Bean <jules at jellybean.co.uk> writes:
>> When writing a compiler, it makes sense to collect errors as by the
>> writer monad, and not abort anything - producing dummy values instead
>> (except perhaps some fatal errors when it's inconvenient).
>
> Or you could use the monad:
>
> data Perhaps a = Success a | Failure a [Error]
> This is just a special case of the writer monad, I think.
It's the same as the writer monad, with redundant encoding of the case
when there are no errors.
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Haskell-Cafe
mailing list