I'm looking for the following function:
Applicative f => f (f a) -> f a
Hoogle shows me join
:
>:t join
join :: Monad m => m (m a) -> m a
Is there a function that matches my desired signature?
To expand a bit on Carl's answer, If there was such a thing as join
, but for applicatives:
class Applicative f => ApplicativeWithJoin f where
join' :: f (f a) -> f a
Then you would automatically have a monad:
instance ApplicativeWithJoin m => Monad m where
return = pure
x >>= f = join' (f <$> x)
There is no such function. join
is explicitly what Applicative
lacks and Monad
has.
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