Jules Bean <[EMAIL PROTECTED]> 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
   \__/       [EMAIL PROTECTED]
    ^^     http://qrnik.knm.org.pl/~qrczak/
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to