@@ -137,6 +137,22 @@ instance (Ord a, Ord b) => Ord (a, b) where
137 then compare xl yl
137 then compare xl yl
138 else compare xr yr
138 else compare xr yr
141+-- --------------------------------------------------------- [ Negatable Class ]
142+||| The Negatable class defines a typeclass for which negation works.
143+||| This is used for implementing unary -
144+class Negatable a where
147+instance Negatable Integer where
150+instance Negatable Int where
153+instance Negatable Float where
154+ negate x = (-1.) * x
140-- --------------------------------------------------------- [ Numerical Class ]
156-- --------------------------------------------------------- [ Numerical Class ]
141||| The Num class defines basic numerical arithmetic.
157||| The Num class defines basic numerical arithmetic.
142class Num a where
158class Num a where