Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is <*> an infix function in Haskell?

Tags:

haskell

Perhaps this is not the right place to ask and presumably this question is too 'meta', but is there any reason the <*> (and analogously <$>) function is infix? To my understanding and my knowledge (thus far) of Haskell it does the same as fmap.

So, why is fmap not infix but its Applicative and Functor variant are?

like image 942
Robin Haveneers Avatar asked Jan 12 '16 20:01

Robin Haveneers


1 Answers

I think it's mostly motivated by this idiom:

f <$> x <*> y <*> z

Spelled with prefix functions it's a lot less pretty, and you need to know how many applications there are just to start typing:

ap (ap (fmap f x) y) z
like image 111
Daniel Wagner Avatar answered Oct 08 '22 09:10

Daniel Wagner