I am trying to derive MyOrd class from Eq (Prelude):

class Eq a => MyOrd a where
        (%<=), (%>), (%>=) :: a -> a -> Bool
        x %<= y = (x < y || x == y)
        x %> y =  y < x
        x %>= y = (y < x || x == y)

Q: What's wrong?  Why 'Ord' gets into play here?

You are using < which is a function on types that instance the class
Ord, so the compiler is telling you to add (Ord a) to the same place
you have (Eq a) or don't use < or > or any function in the class Ord.
You can the prelude and thus the Ord class and make your own < and >
functions but you can't make them refer to the "real" < and >
functions without Ord because that is where they live.

 Jared.
--
http://www.updike.org/~jared/
reverse ")-:"
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to