diff options
Diffstat (limited to 'src/Data/Array/Nested/Internal/Ranked.hs')
-rw-r--r-- | src/Data/Array/Nested/Internal/Ranked.hs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/Data/Array/Nested/Internal/Ranked.hs b/src/Data/Array/Nested/Internal/Ranked.hs index cb8aae0..2aba1bc 100644 --- a/src/Data/Array/Nested/Internal/Ranked.hs +++ b/src/Data/Array/Nested/Internal/Ranked.hs @@ -65,17 +65,9 @@ deriving instance Eq (Mixed (Replicate n Nothing) a) => Eq (Ranked n a) deriving instance Ord (Mixed (Replicate n Nothing) a) => Ord (Ranked n a) instance (Show a, Elt a) => Show (Ranked n a) where - showsPrec d arr@(Ranked marr) = showParen (d > 10) $ - let defaultResult = - showString "rfromListLinear " . shows (toList (rshape arr)) . showString " " - . shows (rtoListLinear arr) - in if stridesAreZero (shxLength $ mshape marr) (mstrideTree marr) - then case rtoListLinear arr of - [] -> defaultResult - [_] -> defaultResult - hd : _ -> showString "rreplicate " . shows (toList (rshape arr)) . showString " " - . showsPrec 11 hd - else defaultResult + showsPrec d arr@(Ranked marr) = + let sh = show (toList (rshape arr)) + in showsMixedArray ("rfromListLinear " ++ sh) ("rreplicate " ++ sh) d marr instance Elt a => NFData (Ranked n a) where rnf (Ranked arr) = rnf arr @@ -152,7 +144,7 @@ instance Elt a => Elt (Ranked n a) where mshowShapeTree _ (sh, t) = "(" ++ show sh ++ ", " ++ mshowShapeTree (Proxy @a) t ++ ")" - mstrideTree (M_Ranked arr) = mstrideTree arr + marrayStrides (M_Ranked arr) = marrayStrides arr mvecsWrite :: forall sh s. IShX sh -> IIxX sh -> Ranked n a -> MixedVecs s sh (Ranked n a) -> ST s () mvecsWrite sh idx (Ranked arr) vecs = |