From 11c3fda9ff63c466566e1f1375f5d8ae03833c90 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Wed, 12 Mar 2025 23:17:48 +0100 Subject: Slight cleanup of arith instances for Mixed/Ranked/Shaped Reformulate error messages; add NumElt superclass to FloatElt --- src/Data/Array/Nested/Internal/Shaped.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Data/Array/Nested/Internal/Shaped.hs') diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs index 5d1b3b2..fe36ffe 100644 --- a/src/Data/Array/Nested/Internal/Shaped.hs +++ b/src/Data/Array/Nested/Internal/Shaped.hs @@ -187,12 +187,12 @@ instance (KnownShS sh, KnownElt a) => KnownElt (Shaped sh a) where arithPromoteShaped :: forall sh a b. - (forall shx. Mixed shx a -> Mixed shx b) + (Mixed (MapJust sh) a -> Mixed (MapJust sh) b) -> Shaped sh a -> Shaped sh b arithPromoteShaped = coerce arithPromoteShaped2 :: forall sh a b c. - (forall shx. Mixed shx a -> Mixed shx b -> Mixed shx c) + (Mixed (MapJust sh) a -> Mixed (MapJust sh) b -> Mixed (MapJust sh) c) -> Shaped sh a -> Shaped sh b -> Shaped sh c arithPromoteShaped2 = coerce @@ -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, NumElt a, PrimElt a, Fractional a) => Fractional (Shaped sh a) where +instance (FloatElt a, PrimElt a, Fractional 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, NumElt a, PrimElt a, Floating a) => Floating (Shaped sh a) where +instance (FloatElt a, PrimElt a, Floating a) => Floating (Shaped sh a) where pi = error "Data.Array.Nested.pi: No singletons available, use explicit sreplicateScal" exp = arithPromoteShaped exp log = arithPromoteShaped log -- cgit v1.2.3-70-g09d2