From 6b74bff29ea3c21adaeea12921aed057b5858040 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 28 May 2024 15:05:32 +0200 Subject: Also add permToList --- src/Data/Array/Mixed.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Data') 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 -- cgit v1.2.3-70-g09d2