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...).
发布评论
评论(2)
将
pure
视为形容词。foo <*>; pure 4
=foo
应用于pure 值4
。(至于它被称为
pure
的确切原因,可能只有McBride和Paterson知道。)Think of
pure
as an adjective.foo <*> pure 4
=foo
applied on a pure value4
.(As for the exact reason why it's called
pure
, probably only McBride and Paterson will know.)它有点像
fromInteger
。它的参数始终是一个纯值或函数,将被提升到函子中。也许它应该是fromPure
但你知道 Haskell 人们多么喜欢缩短名称(例如fst
和snd
而不是first和<代码>第二个...)。
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 beenfromPure
but you know how Haskell people love to shorten names (e.g.fst
andsnd
instead offirst
andsecond
...).