diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-05-19 19:00:41 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-05-19 19:00:41 +0200 |
commit | 31662543b094e04dc373daf264aa62cfc3550457 (patch) | |
tree | dd7d9353ead146e54876555b2865cf4949d3aabe | |
parent | 32dfe36b1f9ab4c25d5e97b21d3522c8f119556a (diff) |
Make Int64 a legal array element type
-rw-r--r-- | src/Data/Array/Nested/Internal.hs | 8 |
1 files changed, 8 insertions, 0 deletions
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 () |