aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Array')
-rw-r--r--src/Data/Array/Nested/Internal/Shaped.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs
index 76e0e6d..2a8c206 100644
--- a/src/Data/Array/Nested/Internal/Shaped.hs
+++ b/src/Data/Array/Nested/Internal/Shaped.hs
@@ -488,8 +488,8 @@ stoMixed (Shaped arr) = arr
-- compatibility check.
scastToMixed :: forall sh sh' a. (Elt a, Rank sh ~ Rank sh')
=> IShX sh' -> Shaped sh a -> Mixed sh' a
-scastToMixed shx (Shaped arr)
- | Refl <- lemAppNil @sh'
- , Refl <- lemAppNil @(MapJust sh)
- , Refl <- lemRankMapJust (shCvtXS' @sh (mshape arr))
- = mcast (ssxFromShape (mshape arr)) shx (Proxy @'[]) arr
+scastToMixed shx (Shaped arr) =
+ case shxEqual shx (mshape arr) of
+ Just Refl -> arr
+ Nothing -> error $ "scastToMixed: Given shape (" ++ show shx ++ ") is not equal to " ++
+ "the shape of the array (" ++ show (mshape arr) ++ ")"