
1 Dec
2004
1 Dec
'04
6:56 a.m.
Jules Bean
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@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/