
14 Dec
2015
14 Dec
'15
12:49 p.m.
The type signature of bind (>>=) is as follows: (>>=) :: m a -> (a -> m b) -> m b One interpretation of this could be as follows: bind takes two parameters (m a & f) and returns m b (the same type returned by f) So extending this interpretation - can I swap the two parameters (?) Now my new hypothetical interpretation becomes: (>>=) :: (a -> m b) -> m a -> m b If i further add parens: (>>=) (a -> m b) -> (m a -> m b) This allows me to slightly tweak my interpretation: bind takes one param f (of type a -> m b) and returns another param f (of type m a -> m b) This feels like a more intuitive way to think about Monads - am I on the right track? (not that I want to switch the params permanently - just trying to get a feel for monads)