[Haskell-cafe] Error monads (was: Call for comments: neither package)

Vo Minh Thu noteed at gmail.com
Tue Jun 29 10:26:06 EDT 2010


2010/6/29 Roman Cheplyaka <roma at ro-che.info>:
> * Stephen Tetley <stephen.tetley at gmail.com> [2010-06-29 12:02:45+0100]
>> The "Applicative Programming with Effects Paper" has the "monodial
>> accumulating" applicative instance on a sum type Conor McBride and
>> Ross Paterson call Except:
>>
>> data Except err a = OK a | Failed err
>>
>> The names are nice and to the point, but they would equally describes
>> the other exception model (monadic - exit on first fail) and having
>> both might be particularly confusing to newcomers: two error types -
>> one with an obvious name, one with an unfamiliar one, the unfamiliar
>> one might be the one they need most often...
>
> On a slightly related note, in my projects I tend to define my own
> Error-like types with descriptive names, often more than one failure
> mode and apropriate instances. For an example of this approach, see
> http://github.com/feuerbach/loker/blob/master/testingtool.hs#L33

>From a quick glance at it, I believe it would be easier to use

Either MyError MyResult

and then have

data MyError = All | The | Possible | Descriptive | Errors

Cheers,
Thu


More information about the Haskell-Cafe mailing list