我试图将一个提升的值赋给a
。
λ> :m Control.Applicative
λ> let a = pure 1
当我在REPL中评估
a
时,它会打印1
。λ> a
1
因此,我认为可能有一个针对
a
的 show
实现方法,并尝试了以下代码:λ> show a
但是 GHCi 抛出了一个错误:
<interactive>:70:1-4:
No instance for (Show (f0 a0)) arising from a use of ‘show’
The type variables ‘f0’, ‘a0’ are ambiguous
Note: there are several potential instances:
instance (Integral a, Show a) => Show (GHC.Real.Ratio a)
-- Defined in ‘GHC.Real’
instance (Show a, Show b) => Show (a, b) -- Defined in ‘GHC.Show’
instance (Show a, Show b, Show c) => Show (a, b, c)
-- Defined in ‘GHC.Show’
...plus 32 others
In the expression: show a
In an equation for ‘it’: it = show a
有人对此有什么想法吗?
:type a
吗?或许那会告诉你一些信息。 - AJFm
默认为IO
。 - chi