标签: haskell
为什么此代码不能编译为Ambiguous type variable错误
Ambiguous type variable
foo :: (Show a) => a -> IO () foo = putStrLn . show bar = foo
在GHCI中,以下命令可以正常工作吗?
> let foo :: (Show a) => a -> IO (); foo = putStrLn . show > bar = foo > bar 1
为什么我们需要bar函数的显式类型注释?
bar