From 31662543b094e04dc373daf264aa62cfc3550457 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 19 May 2024 19:00:41 +0200 Subject: Make Int64 a legal array element type --- src/Data/Array/Nested/Internal.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Data') diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs index ab5f015..ededb60 100644 --- a/src/Data/Array/Nested/Internal.hs +++ b/src/Data/Array/Nested/Internal.hs @@ -45,6 +45,7 @@ import Data.Bifunctor (first) import Data.Coerce (coerce, Coercible) import Data.Foldable as Foldable (toList) import Data.Functor.Const +import Data.Int import Data.Kind import Data.List.NonEmpty (NonEmpty(..)) import Data.Monoid (Sum(..)) @@ -418,6 +419,7 @@ class PrimElt a where -- [PRIMITIVE ELEMENT TYPES LIST] instance PrimElt Int +instance PrimElt Int64 instance PrimElt Double instance PrimElt () @@ -444,6 +446,8 @@ data instance Mixed sh (Primitive a) = M_Primitive !(IShX sh) !(XArray sh a) -- [PRIMITIVE ELEMENT TYPES LIST] newtype instance Mixed sh Int = M_Int (Mixed sh (Primitive Int)) deriving (Show) +newtype instance Mixed sh Int64 = M_Int64 (Mixed sh (Primitive Int64)) + deriving (Show) newtype instance Mixed sh Double = M_Double (Mixed sh (Primitive Double)) deriving (Show) newtype instance Mixed sh () = M_Nil (Mixed sh (Primitive ())) -- no content, orthotope optimises this (via Vector) @@ -467,6 +471,7 @@ newtype instance MixedVecs s sh (Primitive a) = MV_Primitive (VS.MVector s a) -- [PRIMITIVE ELEMENT TYPES LIST] newtype instance MixedVecs s sh Int = MV_Int (VS.MVector s Int) +newtype instance MixedVecs s sh Int64 = MV_Int64 (VS.MVector s Int64) newtype instance MixedVecs s sh Double = MV_Double (VS.MVector s Double) newtype instance MixedVecs s sh () = MV_Nil (VS.MVector s ()) -- no content, MVector optimises this -- etc. @@ -482,6 +487,7 @@ type family ShapeTree a where ShapeTree (Primitive _) = () -- [PRIMITIVE ELEMENT TYPES LIST] ShapeTree Int = () + ShapeTree Int64 = () ShapeTree Double = () ShapeTree () = () @@ -631,6 +637,7 @@ instance Storable a => Elt (Primitive a) where -- [PRIMITIVE ELEMENT TYPES LIST] deriving via Primitive Int instance Elt Int +deriving via Primitive Int64 instance Elt Int64 deriving via Primitive Double instance Elt Double deriving via Primitive () instance Elt () @@ -641,6 +648,7 @@ instance Storable a => KnownElt (Primitive a) where -- [PRIMITIVE ELEMENT TYPES LIST] deriving via Primitive Int instance KnownElt Int +deriving via Primitive Int64 instance KnownElt Int64 deriving via Primitive Double instance KnownElt Double deriving via Primitive () instance KnownElt () -- cgit v1.2.3-70-g09d2