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.hs18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs
index d5c9612..b7cb14d 100644
--- a/src/Data/Array/Nested/Internal/Shaped.hs
+++ b/src/Data/Array/Nested/Internal/Shaped.hs
@@ -65,18 +65,10 @@ 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)
-instance (Show a, Elt a) => Show (Shaped sh a) where
- showsPrec d arr@(Shaped marr) = showParen (d > 10) $
- let defaultResult =
- showString "sfromListLinear " . shows (shsToList (sshape arr)) . showString " "
- . shows (stoListLinear arr)
- in if stridesAreZero (shxLength $ mshape marr) (mstrideTree marr)
- then case stoListLinear arr of
- [] -> defaultResult
- [_] -> defaultResult
- hd : _ -> showString "sreplicate " . shows (shsToList (sshape arr)) . showString " "
- . showsPrec 11 hd
- else defaultResult
+instance (Show a, Elt a) => Show (Shaped n a) where
+ showsPrec d arr@(Shaped marr) =
+ let sh = show (shsToList (sshape arr))
+ in showsMixedArray ("rfromListLinear " ++ sh) ("rreplicate " ++ sh) d marr
instance Elt a => NFData (Shaped sh a) where
rnf (Shaped arr) = rnf arr
@@ -150,7 +142,7 @@ instance Elt a => Elt (Shaped sh a) where
mshowShapeTree _ (sh, t) = "(" ++ show sh ++ ", " ++ mshowShapeTree (Proxy @a) t ++ ")"
- mstrideTree (M_Shaped arr) = mstrideTree arr
+ marrayStrides (M_Shaped arr) = marrayStrides arr
mvecsWrite :: forall sh' s. IShX sh' -> IIxX sh' -> Shaped sh a -> MixedVecs s sh' (Shaped sh a) -> ST s ()
mvecsWrite sh idx (Shaped arr) vecs =