On Mon, Aug 19, 2013 at 2:09 PM, Brandon Allbery <allber...@gmail.com>wrote:

> Alternatively, have you considered using your own ADT? `data Validity =
> Success | Failure String` would give you more readable / comprehensible
> code without needing to worry about assumptions or common usage.


Or possibly Valid and Invalid as the constructors....

This also means you can easily extend it later to include multiple errors,
or position information, or other annotations. You could also use it with
Monoid and/or the Writer monad to track success/failure in the most
appropriate way for your project, instead of being constrained to the
behavior of an existing instance.

-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to