From 64f6a5552cffc10b9fbdb812166be8a0317367c0 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Sat, 15 Jun 2024 20:32:17 +0200 Subject: Error out at fromInteger from the Num instance of Shaped These are never indexes (only ranked tesors are), so writing explicit sreplicateScal is not too big a burden for the user. --- src/Data/Array/Nested/Internal/Shaped.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Data/Array') diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs index be56030..2c24e6d 100644 --- a/src/Data/Array/Nested/Internal/Shaped.hs +++ b/src/Data/Array/Nested/Internal/Shaped.hs @@ -195,7 +195,7 @@ instance (NumElt a, PrimElt a, Num a) => Num (Shaped sh a) where negate = arithPromoteShaped negate abs = arithPromoteShaped abs signum = arithPromoteShaped signum - fromInteger = Shaped . fromInteger + fromInteger = error "Data.Array.Nested.fromInteger: No singletons available, use explicit sreplicateScal" instance (FloatElt a, NumElt a, PrimElt a, Num a) => Fractional (Shaped sh a) where fromRational _ = error "Data.Array.Nested.fromRational: No singletons available, use explicit sreplicateScal" -- cgit v1.2.3-70-g09d2