开发者

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

开发者 https://www.devze.com 2023-01-10 21:59 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about programming within the scope d开发者_如何转开发efined in the help center.

Closed 7 years ago.

Improve this question

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


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.)


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...).

0

精彩评论

暂无评论...
验证码 换一张
取 消