在ghci:
?> :t (pure 1)
(pure 1) :: (Applicative f, Num a) => f a
?> show (pure 1)
<interactive>:1:1:
No instance for (Show (f0 a0))
arising from a use of `show'
Possible fix: add an instance declaration for (Show (f0 a0))
In the expression: show (pure 1)
In an equation for `it': it = show (pure 1)
?> pure 1
1
Run Code Online (Sandbox Code Playgroud)
这是否意味着ghci执行Applicative并显示结果,就像IO?
请注意,pure ()并且pure (+1)不打印任何内容.