[Haskell-beginners] Using Either and Maybe

Kim-Ee Yeoh ky3 at atamo.com
Tue May 6 18:16:04 UTC 2014


On Mon, May 5, 2014 at 7:34 AM, John M. Dlugosz <ngnr63q02 at sneakemail.com>wrote:

> I'm following this thread, and the only "smart destructors" I turned up
> with Google is this post: <http://stackoverflow.com/
> questions/10161009/input-checks-in-haskell-data-constructors>
>

I think parent was thinking of smart constructors and mixed them up with
catamorphisms, which, partly due to the mystique of category theory and how
seemingly only smart people get it, can be seen as smart destructors.

The thing to note is that they aren't smart in the same way as smart
constructors are.

Catas are just dumb destructors, dumb in the same way as plain vanilla
"dumb" constructors.

The catas for lists, Maybe, and Either are respectively, foldr, maybe,
either.

There's a body of literature on deriving catas automatically. Look under
generics or (older) polytypic programming.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140507/569693e4/attachment.html>


More information about the Beginners mailing list