I was just trying out some simple Haskell codes after learning Applicative and Monad, and was confused by the application of pure and <$>. I do understand the definitions, but in some special cases they seem to be mix up a little bit.
Say, I wish to get a function foo, which takes a Maybe Int and a Maybe [Int], and concat the first argument to the second one. A typical definition could be:
foo :: Maybe Int -> Maybe [Int] -> Maybe [Int]
foo ma mb = (:) <$> ma <*> mb
so that foo (Just 1) (Just [2]) would give Just [1,2].
But it seems pure makes no sense in this case, no matter how hard I tried to make the (:) an applicative one. Furthermore, pure (:) (Just 1) works in the exactly same manner as (:) does, but how could it be? I suppose (:) takes two arguments, so the previous one should be an applicative curried function?
Thank you so much!