diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-05-27 17:25:58 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-05-27 17:25:58 +0200 |
commit | 17dd9271a64ff47abb551179a6ab61dff1f9ed6f (patch) | |
tree | 3612128cf38072cf9306e9e1beed5b42e57f6e27 /src/Data/Array | |
parent | 9e5945120bbcfeff15ee7356398e06ab5ba25561 (diff) |
Re-add KnownNatList for convenience with transpose functions
Diffstat (limited to 'src/Data/Array')
-rw-r--r-- | src/Data/Array/Mixed.hs | 4 | ||||
-rw-r--r-- | src/Data/Array/Nested.hs | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/Data/Array/Mixed.hs b/src/Data/Array/Mixed.hs index d61969f..bc392ad 100644 --- a/src/Data/Array/Mixed.hs +++ b/src/Data/Array/Mixed.hs @@ -777,6 +777,10 @@ shIndex p1 p2 = coerce (listxIndex @(SMayNat Int SNat) p1 p2) shPermutePrefix :: HList SNat is -> IShX sh -> IShX (PermutePrefix is sh) shPermutePrefix = coerce (listxPermutePrefix @(SMayNat Int SNat)) +class KnownNatList l where makeNatList :: HList SNat l +instance KnownNatList '[] where makeNatList = HNil +instance (KnownNat n, KnownNatList l) => KnownNatList (n : l) where makeNatList = natSing `HCons` makeNatList + -- | The list argument gives indices into the original dimension list. transpose :: forall is sh a. (Permutation is, Rank is <= Rank sh) => StaticShX sh diff --git a/src/Data/Array/Nested.hs b/src/Data/Array/Nested.hs index 968ea18..6f9a56d 100644 --- a/src/Data/Array/Nested.hs +++ b/src/Data/Array/Nested.hs @@ -60,6 +60,7 @@ module Data.Array.Nested ( SNat, pattern SNat, HList, Permutation, + KnownNatList(..), listSToList, shSToList, ) where |