Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming of `pure` function in Control.Applicative [closed]

Why is the function for lifting a value into a functor named pure in Control.Applicative?

like image 436
Jonathan Sterling Avatar asked Aug 08 '10 17:08

Jonathan Sterling


2 Answers

Think of pure as an adjective.

foo <*> pure 4 = foo applied on a pure value 4.

(As for the exact reason why it's called pure, probably only McBride and Paterson will know.)

like image 53
kennytm Avatar answered Nov 16 '22 01:11

kennytm


It's a little like fromInteger. Its argument is always a pure value or function that will be lifted into the functor. Perhaps it should have been fromPure but you know how Haskell people love to shorten names (e.g. fst and snd instead of first and second...).

like image 31
Neil Bartlett Avatar answered Nov 16 '22 02:11

Neil Bartlett