Ingo Wechsung <[EMAIL PROTECTED]> writes:
> class Keyed a where { -- Type a is keyed if it has a key function.
> key :: Ord b => a -> b; -- key is a function, that, when applied to
> a yields some b that is comparable
> }
But it isn't obvious what b is supposed to be. Try multi-parameter
type classes e.g.
class (Ord b) => Keyed a b where
key :: a -> b
(I'm possibly messing up the placement of the 'Ord b' qualifier)
> and then
> data Sym = Sym String Int Ty; -- Ty is another algebraic type
instance Keyed Sym String where
key (Sym a _ _) = a
(Requires -fglasgow-exts)
-kzm
--
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe