
19 Apr
2024
19 Apr
'24
4:59 p.m.
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