Hi,

You can easily write your own:

> import Control.Monad
> import Data.List
> let foo = flip (foldl' (>=>) return)
> :t foo
foo :: (Foldable t, Monad m) => b -> t (b -> m b) -> m b
> let g x = return (x*2)
> foo 3 [g,g,g]
24

-Sylvain


On 24/08/2016 03:00, Dennis Raddle wrote:
Is there a function foo that does

foo :: a -> [a -> m a] -> a

So 

foo 3 [x,x,x] = return 3 >>= x >>= x >>= x

I don't think replicateM and sequence do this. At least I can't figure it out.


_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners