Inconsistent use of type parameters in `->`'s Functor and Applicative implementation
In the source, we could find ->
's implementation of class Functor and Applicative:
-- | @since 2.01
instance Functor ((->) r) where
fmap = (.)
-- | @since 2.01
instance Applicative ((->) a) where
pure = const
(<*>) f g x = f x (g x)
liftA2 q f g x = q (f x) (g x)
-- | @since 2.01
instance Monad ((->) r) where
f >>= k = \ r -> k (f r) r
I don't understand why the type parameter in Functor
and Monad
is r
, but in Applicative
it is a
. Is it a deliberate choice, or we could fix to make it consistent?