diff options
| author | Mikolaj Konarski <mikolaj.konarski@funktory.com> | 2026-04-09 15:40:41 +0200 |
|---|---|---|
| committer | Mikolaj Konarski <mikolaj.konarski@funktory.com> | 2026-04-09 15:40:41 +0200 |
| commit | f56ba83f256808b92284f2d3c6440bda398ee304 (patch) | |
| tree | 0362f8c3321d333de3fbc5001d360a2f861343a7 /src | |
| parent | 0d166120f30acd17f330b74759d65c5d39257a13 (diff) | |
Define a pair of conversions ixxFromIxS'/ixrFromIxS' anologous to ixsFromIxX'/ixsFromIxR'
Diffstat (limited to 'src')
| -rw-r--r-- | src/Data/Array/Nested/Convert.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Data/Array/Nested/Convert.hs b/src/Data/Array/Nested/Convert.hs index 6ae897c..a6a09f6 100644 --- a/src/Data/Array/Nested/Convert.hs +++ b/src/Data/Array/Nested/Convert.hs @@ -15,13 +15,13 @@ module Data.Array.Nested.Convert ( -- * Shape\/index\/list casting functions -- ** To ranked - ixrFromIxS, ixrFromIxX, shrFromShS, shrFromShXAnyShape, shrFromShX, + ixrFromIxS, ixrFromIxS', ixrFromIxX, shrFromShS, shrFromShXAnyShape, shrFromShX, listrCast, ixrCast, shrCast, -- ** To shaped ixsFromIxR, ixsFromIxR', ixsFromIxX, ixsFromIxX', withShsFromShR, shsFromShX, withShsFromShX, shsFromSSX, ixsCast, -- ** To mixed - ixxFromIxR, ixxFromIxS, shxFromShR, shxFromShS, + ixxFromIxR, ixxFromIxS, ixxFromIxS', shxFromShR, shxFromShS, ixxCast, shxCast, shxCast', -- * Array conversions @@ -62,6 +62,11 @@ ixrFromIxS = coerce Prelude.. (unsafeCoerce :: IxX (MapJust sh) i -> IxX (Replicate (Rank sh) Nothing) i) Prelude.. coerce +ixrFromIxS' :: forall sh i. SNat (Rank sh) -> 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 shrFromShS :: ShS sh -> IShR (Rank sh) @@ -138,6 +143,9 @@ shsFromSSX = shsFromShX Prelude.. shxFromSSX -- ixxFromIxR re-exported -- ixxFromIxS re-exported +ixxFromIxS' :: StaticShX sh' -> IxS sh i -> IxX sh' i +ixxFromIxS' sh' = ixxCast sh' Prelude.. ixxFromIxS + shxFromShR :: ShR n i -> ShX (Replicate n Nothing) i shxFromShR = coerce |
