on master help sign in
Rename the Negatable class to Neg
commit9562e0c4fd65f1c5b0cac81c3f3f8774a5f7d86f authorMarkus Pfeiffer <markus.pfeiffer@morphism.de> dateMon 22 Sep 2014, 11:24 (12 years ago) parentbfa343c
1 file changed+7−8
libs/prelude/Prelude/Classes.idr+7−8
libs/prelude/Prelude/Classes.idr+7−8
@@ -137,21 +137,20 @@ instance (Ord a, Ord b) => Ord (a, b) where
137137 then compare xl yl
138138 else compare xr yr
139139
140−
141140-- --------------------------------------------------------- [ Negatable Class ]
142141||| The Negatable class defines a typeclass for which negation works.
143142||| This is used for implementing unary -
144−class Negatable a where
143+class Neg a where
145144 negate : a -> a
146145
147−instance Negatable Integer where
148− negate x = (-1) * x
146+instance Neg Integer where
147+ negate x = prim__subBigInt 0 x
149148
150−instance Negatable Int where
151− negate x = (-1) * x
149+instance Neg Int where
150+ negate x = prim__subInt 0 x
152151
153−instance Negatable Float where
154− negate x = (-1.) * x
152+instance Neg Float where
153+ negate x = prim__negFloat x
155154
156155-- --------------------------------------------------------- [ Numerical Class ]
157156||| The Num class defines basic numerical arithmetic.