I have doubts about the type signature in haskell. Reading about the applicative functor, I found:
pure (+) <*> Just 3
which returns Just (+3) , which is of type Maybe (a->a) . Now the signature <*> is equal to
(<*>) :: Applicative f => f (a -> b) -> fa -> fb
which means that our fb in the above example is obtained by replacing f with Maybe and b with a->a .
And here I was surprised because, as far as I knew, b cannot unite (sorry if I do not use the indicated terminology, but hope that they are clear enough) with a->a .
Is this possible only because we are inside an applicative functor or is there something else that I miss?
source share