I am learning about Applicative Functors and the pure function has the following type declaration:
pure :: a -> f a
I understand that the pure function takes a value of any type and returns an applicative value with that value inside it. So if the applicative instance was Maybe
, pure 3
would give Just 3
.
However, what happens when you apply pure to a value that's already inside an applicative value? E.g. what happens if you do something like pure Just 3
?
pure Just 3
andpure (Just 3)
. – Carl(pure (Just 3)) :: Maybe (Maybe Integer)
==Just (Just 3)
? – Mateen UlhaqJust
can be thought of as a function with signaturea -> Maybe a
. – Mateen Ulhaq