[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-beginners
Subject:    Re: [Haskell-beginners] Functor question.
From:       Brent Yorgey <byorgey () seas ! upenn ! edu>
Date:       2009-11-16 11:47:43
Message-ID: 20091116114743.GA7859 () seas ! upenn ! edu
[Download RAW message or body]

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.

-Brent
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic