1
什么是错的:为什么不能哈斯克尔函数返回一个列表
partin a = [floor a, a-floor a]
错误:
<interactive>:342:1: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘print’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
These potential instances exist:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
...plus 22 others
...plus 16 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
这是在说打印的东西,但你不显示你如何打印东西。请显示你正在做的事情的其余部分。 – dfeuer
其实当我做“part a = a - floor a”也是同样的错误。代码只包含这个函数 –
他只是在GHCi提示符处输入'part something',按照签名行“在交互式GHCi命令的语句中:'打印它”。 – HTNW