#2309: containers: specialize functions that fail in a Monad to Maybe

Isaac Dupree isaacdupree at charter.net
Thu May 29 06:41:44 EDT 2008


Evan Laforge wrote:
> Also, I wouldn't say more generic (or rather, less explicit lifting
> needed) is really totally "free"... it always looks more complicated
> when you see some polymorphic typeclass constrained type constructor
> parameter vs. a monomorphic concrete one.  And I think even just
> *looking* simple is important!

Agree.  If you usually use it with Maybe, then
-- the documentation should clue you in on the fact
-- after you realize it is, then on the occasion that it's used with a 
different type than Maybe, you're likely to get confused doing 
type-inference-in-your-head.

Also, ad-hoc polymorphism in *both* function results and arguments, 
quickly leads to ambiguity and the type checker may yell at you.

+1 for Maybe.  Conor put it best (though the argument was incomplete 
without the practical arguments and personal opinions and experiences)

-Isaac


More information about the Libraries mailing list