aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Internal/Shaped.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Array/Nested/Internal/Shaped.hs')
-rw-r--r--src/Data/Array/Nested/Internal/Shaped.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs
index efeb618..ece4272 100644
--- a/src/Data/Array/Nested/Internal/Shaped.hs
+++ b/src/Data/Array/Nested/Internal/Shaped.hs
@@ -20,7 +20,7 @@ module Data.Array.Nested.Internal.Shaped where
import Prelude hiding (mappend, mconcat)
-import Control.DeepSeq (NFData)
+import Control.DeepSeq (NFData(..))
import Control.Monad.ST
import Data.Array.Internal.ShapedS qualified as SS
import Data.Array.Internal.ShapedG qualified as SG
@@ -62,13 +62,15 @@ type Shaped :: [Nat] -> Type -> Type
newtype Shaped sh a = Shaped (Mixed (MapJust sh) a)
deriving instance Eq (Mixed (MapJust sh) a) => Eq (Shaped sh a)
deriving instance Ord (Mixed (MapJust sh) a) => Ord (Shaped sh a)
-deriving instance NFData (Mixed (MapJust sh) a) => NFData (Shaped sh a)
instance (Show a, Elt a) => Show (Shaped sh a) where
showsPrec d arr = showParen (d > 10) $
showString "sfromListLinear " . shows (shsToList (sshape arr)) . showString " "
. shows (stoListLinear arr)
+instance Elt a => NFData (Shaped sh a) where
+ rnf (Shaped arr) = rnf arr
+
-- 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))
@@ -123,6 +125,8 @@ instance Elt a => Elt (Shaped sh a) where
mconcat l = M_Shaped (mconcat (coerce l))
+ mrnf (M_Shaped arr) = mrnf arr
+
type ShapeTree (Shaped sh a) = (ShS sh, ShapeTree a)
mshapeTree (Shaped arr) = first shCvtXS' (mshapeTree arr)