Reputation: 677
I know that for a type to have an instance of the Num
typeclass, there must be one from Eq
and Show
class (Eq a, Show a) => Num a
I'm wondering why it's required to be Eq
rather than Ord
. Does it make sense for a numerical type to be in Eq
but not in Ord
?
Upvotes: 18
Views: 723
Reputation: 38893
Note that the Eq
and Show
constraints were also widely considered a misfeature. For example, they prevent perfectly valid instances of Num
for things containing functions. In the latest version of GHC, those constraints are also removed, leaving Num
with no superclass constraints at all.
Upvotes: 22