Reading Typeclassopedia, I just found out about Apply and have some questions.
1. <*> vs <.>
also included .> vs *>, <. vs <* and liftF2 vs liftA2
Why are there multiple version of operations that seem like exactly the same (to me)?
λ> :t (<*>)
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
λ> :t (<.>)
(<.>) :: Apply f => f (a -> b) -> f a -> f b
and Apply is already a Functor
λ> :i Apply
class Functor f => Apply (f :: * -> *) where
(<.>) :: f (a -> b) -> f a -> f b
(.>) :: f a -> f b -> f b
(<.) :: f a -> f b -> f a
liftF2 :: (a -> b -> c) -> f a -> f b -> f c
{-# MINIMAL (<.>) | liftF2 #-}
λ> :i Applicative
class Functor f => Applicative (f :: * -> *) where
pure :: a -> f a
(<*>) :: f (a -> b) -> f a -> f b
GHC.Base.liftA2 :: (a -> b -> c) -> f a -> f b -> f c
(*>) :: f a -> f b -> f b
(<*) :: f a -> f b -> f a
{-# MINIMAL pure, ((<*>) | liftA2) #-}
What is the different between <$> and <.> why can’t just reuse <,> instead of introducing <*>?
Why it is not the case that the following (not sure about the syntax, hope you get the idea)
class Functor f, Apply f => Applicative f where
pure :: a -> f a
reuse <.>, .>, <. and liftF2 and be able to free 4 operators to use else where with different meaning?
2. Why is the word Apply?
What is the origin of the word Apply in this context?
Is it the same as Applicative model mentioned in Backus’s Paper