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

Roman Cheplyaka roma at ro-che.info
Tue Jun 29 15:49:29 EDT 2010


* Vo Minh Thu <noteed at gmail.com> [2010-06-29 16:26:06+0200]
> 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

I would have to have separate constructor for satisfying Error class
constraint, which I don't want to deal with later.

-- 
Roman I. Cheplyaka :: http://ro-che.info/
"Don't let school get in the way of your education." - Mark Twain


More information about the Haskell-Cafe mailing list