Re: Is it possible to nest this kind of "continuation" (a -> b -> r)
Tom Ellis <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <ZiKjDyCZAQv+VALV@cloudinit-builder> |
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:unzip
https://www.stackage.org/haddock/lts-22.17/base-4.18.2.0/Prelude.html#v:unzip3
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.