
16 Nov
2009
16 Nov
'09
11:47 a.m.
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