diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-03-12 23:17:48 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-03-12 23:17:48 +0100 |
commit | 11c3fda9ff63c466566e1f1375f5d8ae03833c90 (patch) | |
tree | 44e55620cbd655f83c5e28e7492169baeaa7ca52 /src/Data/Array/Nested/Internal/Shaped.hs | |
parent | 766a925698a97cac03e972bdaa2500085be17c65 (diff) |
Slight cleanup of arith instances for Mixed/Ranked/Shaped
Reformulate error messages; add NumElt superclass to FloatElt
Diffstat (limited to 'src/Data/Array/Nested/Internal/Shaped.hs')
-rw-r--r-- | src/Data/Array/Nested/Internal/Shaped.hs | 8 |
1 files changed, 4 insertions, 4 deletions
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 |