on master help sign in
Rename the Negatable class to Neg
9562e0cMarkus Pfeiffer
libs/prelude/Prelude/Classes.idr+7−8
@@ -137,21 +137,20 @@ 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
139
139
140−
141-- --------------------------------------------------------- [ Negatable Class ]
140-- --------------------------------------------------------- [ Negatable Class ]
142||| The Negatable class defines a typeclass for which negation works.
141||| The Negatable class defines a typeclass for which negation works.
143||| This is used for implementing unary -
142||| This is used for implementing unary -
144−class Negatable a where
143+class Neg a where
145 negate : a -> a
144 negate : a -> a
146
145
147−instance Negatable Integer where
146+instance Neg Integer where
148− negate x = (-1) * x
147+ negate x = prim__subBigInt 0 x
149
148
150−instance Negatable Int where
149+instance Neg Int where
151− negate x = (-1) * x
150+ negate x = prim__subInt 0 x
152
151
153−instance Negatable Float where
152+instance Neg Float where
154− negate x = (-1.) * x
153+ negate x = prim__negFloat x
155
154
156-- --------------------------------------------------------- [ Numerical Class ]
155-- --------------------------------------------------------- [ Numerical Class ]
157||| The Num class defines basic numerical arithmetic.
156||| The Num class defines basic numerical arithmetic.