[Haskell-beginners] Functor question.

Brent Yorgey byorgey at seas.upenn.edu
Mon Nov 16 06:47:43 EST 2009

On Sun, Nov 15, 2009 at 08:07:36PM -0800, Alexander Dunlap wrote:
> In general, people recommend against using constriants on datatypes,
> recommending instead to put those constraints on the functions that
> operate on the datatypes. I'm not quite sure why that is, though.

It is because adding a constraint to a datatype definition only puts a
constraint on the *constructor*---in particular, you don't get any
constraints when pattern-matching, and you have to put the constraints
on functions that operate on the datatype anyway.


More information about the Beginners mailing list