aboutsummaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-05-30 21:55:05 +0200
committerTom Smeding <tom@tomsmeding.com>2024-05-30 21:55:05 +0200
commit19eab026f4f4c6a2d38ceb1fffa6062ba2637a46 (patch)
treef85c870d75096ee6828b87d611508a4adf7567af /src/Data
parentb58870dc7ac06daba43135dc1cda855d5e2f0848 (diff)
Fix wrongly ported X.cast
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Array/Mixed.hs6
1 files 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