r/functionalprogramming • • Jan 31 '23

Question Applicative functors

I've been thinking about applicative functors a lot lately, from a purely category theoretical point of view, and it seems to me that one could maybe define them as the endofuntors that have a natural transformation eta from the identity functor on said category ("pure" being the component of eta at the particular objects). Does anybody know if this kind of a definition is sufficient or is it missing some kind of a critical point of applicative functors?

13 Upvotes

3 comments sorted by

View all comments

Show parent comment

2

u/_jackdk_ Feb 04 '23

I don't understand the categorical Day convolution, so I will have to post the Haskell one:

data Day f g a where
  Day :: f b -> g c -> (b -> c -> a) -> Day f g a

As you say, eta :: Applicative m => Identity a -> m a. mu :: Applicative m => Day m m a -> m a can be written in terms of liftA2.