[Haskell-cafe] Are there standard idioms for lazy, pure error handling?

Ketil Malde ketil at malde.org
Thu Dec 3 06:34:05 EST 2009


Duncan Coutts <duncan.coutts at googlemail.com> writes:

>> [1] http://hackage.haskell.org/package/failable-list

> Nice.

I agree this is needed (or rather, would be nice to standardise).  

Although I don't care for the cutesy naming suggested in the 'Train'
datatype, failable-list could be made more general.  Why is there a
specific constructor 'Done', instead of just allowing the user to select
a value of type 'e' (using 'Maybe b' if nothing else works)?

Perhaps we could also consider an infix notation, like:

  data TerminatedList a e = Then a (TerminatedList a e)
                          | Finally e

(So you could do e.g:  4 `Then` 5 `Then` 1 `Finally` "success!". Of
course, you might prefer symbols instead.) 

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list