I created in Haskell a new class Eqa
class Eqa a where
(=~) :: a -> a -> Bool
(/~) :: a -> a -> Bool
and want to define (=~) same as (==) from the Prelude. So I tried
instance Eqa Int where
x=~y = x==y
x/~y = x/=y
but this only works for Int (of course).
How do I have to change my code that this works with all numerical types?
(==). You can convince GHC to accept a definition ofinstance Num a => Eqa awith the right language pragmas but it's nonsensical and in practice you won't be able to use it.