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

我们两清 提交于 2020-01-03 07:42:24

问题


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


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/3435308/naming-of-pure-function-in-control-applicative

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!