[Haskell-beginners] Using Either and Maybe

John M. Dlugosz ngnr63q02 at sneakemail.com
Mon May 5 00:34:19 UTC 2014


On 5/4/2014 10:42 AM, Dan Serban wrote:
> Hi Alan,
>
> Check out these two functions, they point you towards how to write
> more idiomatic code. They are called smart destructors, google that
> term for more information:
>
> λ> :i maybe
> maybe :: b -> (a -> b) -> Maybe a -> b 	-- Defined in `Data.Maybe'
> λ> :i either
> either :: (a -> c) -> (b -> c) -> Either a b -> c
>    	-- Defined in `Data.Either'
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>

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>

The Haskellwiki has a mention but it's a blank page.



More information about the Beginners mailing list