Reputation: 5648
I'm trying to get a better understanding of monads. So I'm trying to write return, join, and bind implementations for several monads.
However when coming to two-kinded monads, I'm kind of confused
join :: m (m a) -> m a
m (m a)
Implies monad wrapped inside of monad, but what value is implied if using two-kinded monads.
For example with the State Monad: s
or a
? What would the correct signature of join for the State Monad look like?
Upvotes: 0
Views: 102
Reputation: 33419
The state monad type is declared as State s a
;
it only unifies with m a
if m ~ State s
.
join :: State s (State s a) -> State s a
Upvotes: 10