Folks,
Interesting! Phil, Mark, and Jeff all have a different interpretation of
how contexts on how data type declarations work than I did. So unless
some other people chime in, I will therefore adopt their interpretation,
since (a) I'm in the minority and (b) it's not a big deal at all.
But just to make it clear what's under review here, consider
data Ord a => Tree a = MkTree {
item :: a,
kids :: [Tree a]
}
We know that
MkTree :: Ord a => a -> [Tree a] -> Tree a
But what type does the selector 'item' have? Phil, Mark and Jeff think:
item :: Ord a => Tree a -> a
The same would apply to any use of MkTree in a pattern. For example:
f (MkTree _ _) = True
would get the type
f :: Ord a => Tree a -> Bool
Speak now or put up with overloaded selectors!
Simon