为什么我不能做
z = x?
但我可以这样做吗?
y s = x s
我是Haskell的新手 这就是我在GHCi中所尝试的:
Prelude> import Happstack.Server
Prelude Happstack.Server> let x s = ok $ toResponse $ "Some string"
Prelude Happstack.Server> :t x
x :: FilterMonad Response m => t -> m Response
Prelude Happstack.Server> let y s = x s
Prelude Happstack.Server> :t y
y :: FilterMonad Response m => t -> m Response
Prelude Happstack.Server> let z = x
<interactive>:1:9:
No instance for (FilterMonad Response m0)
arising from a use of `x'
答案 0 :(得分:5)
您可以明确地包含参数,即y s = x s
,包含显式类型签名,或者使用-XNoMonomorphismRestriction
运行GHCi。