[Haskell-cafe] Is it possible to nest this kind of "continuation" (a -> b -> r)

Albert Y. C. Lai trebla at vex.net
Sun Apr 21 17:28:43 UTC 2024


I would think in terms of:

nest :: Applicative f => [f a] -> f [a]
nest = sequenceA

nest2 :: Applicative f => [f (a,b)] -> f ([a],[b])
nest2 = fmap unzip . sequenceA

nest3 :: Applicative f => [f (a,b,c)] -> f ([a],[b],[c])
nest3 = fmap unzip3 . sequenceA

Then put f = Cont r

On 2024-04-19 12:29, PICCA Frederic-Emmanuel wrote:
> Hello, I have this
> 
> nest ∷ [(a → r) → r] → ([a] → r) → r
> nest xs = runCont (Prelude.mapM	cont xs)
> 
> but now I need this
> 
> nest2 ∷ [(a → b → r) → r] → ([a] → [b] → r) → r
> nest2 xs = ...
> 
> and this
> 
> nest3 :: ...
> 
> Do you think that there is a generic way to write all these nestX methodes.
> 
> thanks for your help
> 
> Frédéric
> _______________________________________________
> 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.


More information about the Haskell-Cafe mailing list