diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-12-18 22:13:10 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-12-18 22:13:16 +0100 |
commit | 237128fc3aa8ad6478a5cf759ba31e967b24fd77 (patch) | |
tree | 30ae6ea085186ae8250078dc00b123a71cdf26c3 /src/Data/Array/Nested/Internal | |
parent | 637ca0e7dd7db16233731b40ccbc7f4cb5c63a40 (diff) |
Add some spuriously missing Eq/Generic instances
Diffstat (limited to 'src/Data/Array/Nested/Internal')
-rw-r--r-- | src/Data/Array/Nested/Internal/Ranked.hs | 5 | ||||
-rw-r--r-- | src/Data/Array/Nested/Internal/Shaped.hs | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/Data/Array/Nested/Internal/Ranked.hs b/src/Data/Array/Nested/Internal/Ranked.hs index b3d4f91..9483723 100644 --- a/src/Data/Array/Nested/Internal/Ranked.hs +++ b/src/Data/Array/Nested/Internal/Ranked.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -34,6 +35,7 @@ import Data.Type.Equality import Data.Vector.Storable qualified as VS import Foreign.Storable (Storable) import GHC.Float qualified (log1p, expm1, log1pexp, log1mexp) +import GHC.Generics (Generic) import GHC.TypeLits import GHC.TypeNats qualified as TN @@ -72,6 +74,9 @@ instance Elt a => NFData (Ranked n a) where -- just unwrap the newtype and defer to the general instance for nested arrays newtype instance Mixed sh (Ranked n a) = M_Ranked (Mixed sh (Mixed (Replicate n Nothing) a)) + deriving (Generic) + +deriving instance Eq (Mixed sh (Mixed (Replicate n Nothing) a)) => Eq (Mixed sh (Ranked n a)) newtype instance MixedVecs s sh (Ranked n a) = MV_Ranked (MixedVecs s sh (Mixed (Replicate n Nothing) a)) diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs index ece4272..4071aad 100644 --- a/src/Data/Array/Nested/Internal/Shaped.hs +++ b/src/Data/Array/Nested/Internal/Shaped.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -35,6 +36,7 @@ import Data.Type.Equality import Data.Vector.Storable qualified as VS import Foreign.Storable (Storable) import GHC.Float qualified (log1p, expm1, log1pexp, log1mexp) +import GHC.Generics (Generic) import GHC.TypeLits import Data.Array.Mixed.XArray (XArray) @@ -73,6 +75,9 @@ instance Elt a => NFData (Shaped sh a) where -- just unwrap the newtype and defer to the general instance for nested arrays newtype instance Mixed sh (Shaped sh' a) = M_Shaped (Mixed sh (Mixed (MapJust sh') a)) + deriving (Generic) + +deriving instance Eq (Mixed sh (Mixed (MapJust sh') a)) => Eq (Mixed sh (Shaped sh' a)) newtype instance MixedVecs s sh (Shaped sh' a) = MV_Shaped (MixedVecs s sh (Mixed (MapJust sh') a)) |