From 19eab026f4f4c6a2d38ceb1fffa6062ba2637a46 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Thu, 30 May 2024 21:55:05 +0200 Subject: Fix wrongly ported X.cast --- src/Data/Array/Mixed.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/Array/Mixed.hs b/src/Data/Array/Mixed.hs index b14cc1e..d5a8b78 100644 --- a/src/Data/Array/Mixed.hs +++ b/src/Data/Array/Mixed.hs @@ -71,9 +71,9 @@ cast ssh1 sh2 ssh' (XArray arr) , Refl <- lemRankApp (ssxFromShape sh2) ssh' = let arrsh :: IShX sh1 (arrsh, _) = shxSplitApp (Proxy @sh') ssh1 (shape (ssxAppend ssh1 ssh') (XArray arr)) - in case shxEqual arrsh sh2 of - Just _ -> XArray arr - Nothing -> error $ "Data.Array.Mixed.cast: Cannot cast (" ++ show arrsh ++ ") to (" ++ show sh2 ++ ")" + in if shxToList arrsh == shxToList sh2 + then XArray arr + else error $ "Data.Array.Mixed.cast: Cannot cast (" ++ show arrsh ++ ") to (" ++ show sh2 ++ ")" unScalar :: Storable a => XArray '[] a -> a unScalar (XArray a) = S.unScalar a -- cgit v1.2.3-70-g09d2