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 2a8c206..f8df5aa 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) =
- 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) ++ ")"
+scastToMixed shx sarr@(Shaped arr)
+ | Refl <- lemAppNil @sh'
+ , Refl <- lemAppNil @(MapJust sh)
+ , Refl <- lemRankMapJust (sshape sarr)
+ = mcast (ssxFromShape (mshape arr)) shx (Proxy @'[]) arr