Christian Maeder wrote:
>
> > But what type does the selector 'item' have? Phil, Mark and Jeff think:
> >
> > item :: Ord a => Tree a -> a
>
> This looks correct to me, too.
>
> If an order is needed to construct a tree, say a search tree, the very same
> order is (or may be) needed to select an item, e.g. by searching!
But on the other hand a simple test 'emptyTree' will also have type
'Ord a => Tree a -> Bool' instead of just 'Tree a -> Bool' !
(compare with `null : [a] -> Bool')
However, I don't care what Haskell 98 does, because I don't use contexts on data
type declarations. I think, when writing the interface of an (abstract) data
type it is an important design decision which operations have which context.
--
OLAF CHITIL, Lehrstuhl fuer Informatik II, RWTH Aachen, 52056 Aachen, Germany
Tel: (+49/0)241/80-21212; Fax: (+49/0)241/8888-217
URL: http://www-i2.informatik.rwth-aachen.de/~chitil/