开发者

Newbie question on syntax and type signature in Haskell/HappStack

Why is it that I can't do

z = x?

but I can do this?

y s = x s

I'm a Haskell newbie This is what I've been trying in 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 instan开发者_如何转开发ce for (FilterMonad Response m0)
      arising from a use of `x'


Looks like another case of the monomorphism restriction.

You can either include the argument explicitly, i.e. y s = x s, include an explicit type signature, or run GHCi with -XNoMonomorphismRestriction.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜