相关疑难解决方法(0)

ghci适用特殊情况?

在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)不打印任何内容.

monads haskell ghci applicative

8
推荐指数
1
解决办法
453
查看次数

标签 统计

applicative ×1

ghci ×1

haskell ×1

monads ×1