aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-03-12 23:24:33 +0100
committerTom Smeding <tom@tomsmeding.com>2025-03-12 23:24:33 +0100
commitbcda5b7eb20874f948fbdc23b6daa3ebb792ffe0 (patch)
treef2ea02510688f3b8684626673f5ad0572e4c65bd /src
parent11c3fda9ff63c466566e1f1375f5d8ae03833c90 (diff)
Remove redundant constraints on arith instances
Diffstat (limited to 'src')
-rw-r--r--src/Data/Array/Nested/Internal/Mixed.hs6
-rw-r--r--src/Data/Array/Nested/Internal/Ranked.hs6
-rw-r--r--src/Data/Array/Nested/Internal/Shaped.hs6
3 files changed, 9 insertions, 9 deletions
diff --git a/src/Data/Array/Nested/Internal/Mixed.hs b/src/Data/Array/Nested/Internal/Mixed.hs
index b72581e..08f97f0 100644
--- a/src/Data/Array/Nested/Internal/Mixed.hs
+++ b/src/Data/Array/Nested/Internal/Mixed.hs
@@ -224,7 +224,7 @@ mliftNumElt2 f (toPrimitive -> M_Primitive sh1 (XArray arr1)) (toPrimitive -> M_
| sh1 == sh2 = fromPrimitive $ M_Primitive sh1 (XArray (f (shxRank sh1) arr1 arr2))
| otherwise = error $ "Data.Array.Nested: Shapes unequal in elementwise Num operation: " ++ show sh1 ++ " vs " ++ show sh2
-instance (NumElt a, PrimElt a, Num a) => Num (Mixed sh a) where
+instance (NumElt a, PrimElt a) => Num (Mixed sh a) where
(+) = mliftNumElt2 numEltAdd
(-) = mliftNumElt2 numEltSub
(*) = mliftNumElt2 numEltMul
@@ -234,12 +234,12 @@ instance (NumElt a, PrimElt a, Num a) => Num (Mixed sh a) where
-- TODO: THIS IS BAD, WE NEED TO REMOVE THIS
fromInteger = error "Data.Array.Nested.fromInteger: Cannot implement fromInteger, use mreplicateScal"
-instance (FloatElt a, PrimElt a, Num a) => Fractional (Mixed sh a) where
+instance (FloatElt a, PrimElt a) => Fractional (Mixed sh a) where
fromRational _ = error "Data.Array.Nested.fromRational: No singletons available, use explicit mreplicate"
recip = mliftNumElt1 floatEltRecip
(/) = mliftNumElt2 floatEltDiv
-instance (FloatElt a, PrimElt a, Num a) => Floating (Mixed sh a) where
+instance (FloatElt a, PrimElt a) => Floating (Mixed sh a) where
pi = error "Data.Array.Nested.pi: No singletons available, use explicit mreplicate"
exp = mliftNumElt1 floatEltExp
log = mliftNumElt1 floatEltLog
diff --git a/src/Data/Array/Nested/Internal/Ranked.hs b/src/Data/Array/Nested/Internal/Ranked.hs
index bc47579..3bdd44e 100644
--- a/src/Data/Array/Nested/Internal/Ranked.hs
+++ b/src/Data/Array/Nested/Internal/Ranked.hs
@@ -198,7 +198,7 @@ arithPromoteRanked2 :: forall n a b c.
-> Ranked n a -> Ranked n b -> Ranked n c
arithPromoteRanked2 = coerce
-instance (NumElt a, PrimElt a, Num a) => Num (Ranked n a) where
+instance (NumElt a, PrimElt a) => Num (Ranked n a) where
(+) = arithPromoteRanked2 (+)
(-) = arithPromoteRanked2 (-)
(*) = arithPromoteRanked2 (*)
@@ -207,12 +207,12 @@ instance (NumElt a, PrimElt a, Num a) => Num (Ranked n a) where
signum = arithPromoteRanked signum
fromInteger = error "Data.Array.Nested(Ranked).fromInteger: No singletons available, use explicit rreplicateScal"
-instance (FloatElt a, PrimElt a, Num a) => Fractional (Ranked n a) where
+instance (FloatElt a, PrimElt a) => Fractional (Ranked n a) where
fromRational _ = error "Data.Array.Nested(Ranked).fromRational: No singletons available, use explicit rreplicateScal"
recip = arithPromoteRanked recip
(/) = arithPromoteRanked2 (/)
-instance (FloatElt a, PrimElt a, Num a) => Floating (Ranked n a) where
+instance (FloatElt a, PrimElt a) => Floating (Ranked n a) where
pi = error "Data.Array.Nested(Ranked).pi: No singletons available, use explicit rreplicateScal"
exp = arithPromoteRanked exp
log = arithPromoteRanked log
diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs
index fe36ffe..f75519f 100644
--- a/src/Data/Array/Nested/Internal/Shaped.hs
+++ b/src/Data/Array/Nested/Internal/Shaped.hs
@@ -196,7 +196,7 @@ arithPromoteShaped2 :: forall sh a b c.
-> Shaped sh a -> Shaped sh b -> Shaped sh c
arithPromoteShaped2 = coerce
-instance (NumElt a, PrimElt a, Num a) => Num (Shaped sh a) where
+instance (NumElt a, PrimElt a) => Num (Shaped sh a) where
(+) = arithPromoteShaped2 (+)
(-) = arithPromoteShaped2 (-)
(*) = arithPromoteShaped2 (*)
@@ -205,12 +205,12 @@ instance (NumElt a, PrimElt a, Num a) => Num (Shaped sh a) where
signum = arithPromoteShaped signum
fromInteger = error "Data.Array.Nested.fromInteger: No singletons available, use explicit sreplicateScal"
-instance (FloatElt a, PrimElt a, Fractional a) => Fractional (Shaped sh a) where
+instance (FloatElt a, PrimElt a) => Fractional (Shaped sh a) where
fromRational = error "Data.Array.Nested.fromRational: No singletons available, use explicit sreplicateScal"
recip = arithPromoteShaped recip
(/) = arithPromoteShaped2 (/)
-instance (FloatElt a, PrimElt a, Floating a) => Floating (Shaped sh a) where
+instance (FloatElt a, PrimElt a) => Floating (Shaped sh a) where
pi = error "Data.Array.Nested.pi: No singletons available, use explicit sreplicateScal"
exp = arithPromoteShaped exp
log = arithPromoteShaped log