
Well, if we used type indexed lists (aka just "dynamic tuples") it should be possible, right? I.e. hunzip :: [HList xs] -> HList (ToList xs) type family ToList xs where ToList '[x] = [x] ToList (x ': xs) = [x] ': ToList xs On 4/19/24 19:59, Tom Ellis wrote:
On Fri, Apr 19, 2024 at 06:29:23PM +0200, PICCA Frederic-Emmanuel wrote:
nest ∷ [(a → r) → r] → ([a] → r) → r nest xs = runCont (Prelude.mapM cont xs)
nest2 ∷ [(a → b → r) → r] → ([a] → [b] → r) → r nest2 xs = ...
nest3 :: ...
Do you think that there is a generic way to write all these nestX methodes. I doubt it. There's not even a generic way of writing out the non-CPSed versions
nest2 :: [(a, b)] -> ([a], [b]) nest3 :: [(a, b, c)] -> ([a], [b], [c])
Instead we just have individually-named unzip functions:
https://www.stackage.org/haddock/lts-22.17/base-4.18.2.0/Prelude.html#v:unzi... https://www.stackage.org/haddock/lts-22.17/base-4.18.2.0/Prelude.html#v:unzi...
Tom _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.