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