aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-05-28 15:05:32 +0200
committerTom Smeding <tom@tomsmeding.com>2024-05-28 15:05:32 +0200
commit6b74bff29ea3c21adaeea12921aed057b5858040 (patch)
tree58d133ee8dedf7205b71934f06d2decc320f879f
parent7f9383b2dd0fd9816a608b7a14ac517a9ff56aa6 (diff)
Also add permToList
-rw-r--r--src/Data/Array/Mixed.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Data/Array/Mixed.hs b/src/Data/Array/Mixed.hs
index 1a622fb..6766d90 100644
--- a/src/Data/Array/Mixed.hs
+++ b/src/Data/Array/Mixed.hs
@@ -727,6 +727,9 @@ permFromList (x : xs) k = withSomeSNat (fromIntegral x) $ \case
Just sn -> permFromList xs $ \list -> k (sn `HCons` list)
Nothing -> error $ "Data.Array.Mixed.permFromList: negative number in list: " ++ show x
+permToList :: HList SNat list -> [Int]
+permToList = foldHList (pure . fromSNat')
+
type family TakeLen ref l where
TakeLen '[] l = '[]
TakeLen (_ : ref) (x : xs) = x : TakeLen ref xs