aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Convert.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Array/Nested/Convert.hs')
-rw-r--r--src/Data/Array/Nested/Convert.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Data/Array/Nested/Convert.hs b/src/Data/Array/Nested/Convert.hs
index 155a1a7..671f40f 100644
--- a/src/Data/Array/Nested/Convert.hs
+++ b/src/Data/Array/Nested/Convert.hs
@@ -57,9 +57,10 @@ import Data.Array.Nested.Types
-- * To ranked
--- This unsafeCoerce, exceptionally, can't be eliminated using newtype coercions.
-ixrFromIxS :: IxS sh i -> IxR (Rank sh) i
-ixrFromIxS = unsafeCoerce
+ixrFromIxS :: forall sh i. IxS sh i -> IxR (Rank sh) i
+ixrFromIxS = coerce
+ Prelude.. (unsafeCoerce :: IxX (MapJust sh) i -> IxX (Replicate (Rank sh) Nothing) i)
+ Prelude.. coerce
-- ixrFromIxX re-exported
@@ -80,9 +81,10 @@ shrFromShX = coerce
-- * To shaped
--- This unsafeCoerce, exceptionally, can't be eliminated using newtype coercions.
-ixsFromIxR :: IxR (Rank sh) i -> IxS sh i
-ixsFromIxR = unsafeCoerce
+ixsFromIxR :: forall sh i. IxR (Rank sh) i -> IxS sh i
+ixsFromIxR = coerce
+ Prelude.. (unsafeCoerce :: IxX (Replicate (Rank sh) Nothing) i -> IxX (MapJust sh) i)
+ Prelude.. coerce
-- ixsFromIxX re-exported