>>= has type m a -> (a -> m b) -> m b
Suppose ma :: m a and f :: a -> m b.
What is the purpose of >>= :: m a -> (a -> m b) -> m b more about:
- either being able to implicitly unpack
ma :: m atoaso thatf :: a -> m bcan apply to it? Or being able to handle different cases depending on
ma :: m a? Many implementations of>>=check argumentmato see ifmasatisfies some condition. If yes, thena <- ma; f a. If no, then do something else withma, sayg ma, whereg :: m a -> m b. Is it correct that a more specific and still equivalent version of>>=would have a typem a -> (a ->m b) -> (... -> m b) -> m b, where... -> m bis the type for the third argument likegabove? If yes, what is type...? Shall it bem a? It might not bea, correct?Or both?
Thanks.