Hello,

I suggest taking a quick look at the function ‘fold’ in Data.Foldable, and also Data.Functor.Compose. That should be good start for composing any list of such functions. 

Cheers,

J.

On Sat, 1 Feb 2020 at 19:55, Debasish Ghosh <ghosh.debasish@gmail.com> wrote:
Hi -

How can I generalize the following pattern to an arbitrary list of functions ?

compose :: (Monad m) => (Foo -> m Foo) -> (Foo -> m Foo) -> (Foo -> m Foo) -> Foo -> m Foo
compose f1 f2 f3 acc = do
  a <- f1 acc
  b <- f2 a
  f3 b

Any help please ..
regards.

--
_______________________________________________
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.