In Haskell, there is:
(>>=) :: Monad m => m a -> (a -> m b) -> m b
Is there a function:(?)
bind2 :: Monad m => m a -> m b -> (a -> b -> m c) -> m c
This is what do notation is meant for.
bind2 :: (Monad m) => m a -> m b -> (a -> b -> m c) -> m c
bind2 ma mb f = do
a <- ma
b <- mb
f a b
It's so simple that I probably wouldn't even define an extra operator for it, rather I'd just use do notation directly.
Not quite, but you could use
bind2 :: Monad m => m a -> m b -> (a -> b -> m c) -> m c
bind2 x y f = join $ liftM2 f x y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With