如果我看一下space,它建议使用void spaceChar。
然而,如果我真的尝试:
x :: Parser ()
x = void spaceChar我得到了
* Couldn't match type `Token s0' with `Char'
arising from a use of `spaceChar'
The type variable `s0' is ambiguous
* In the first argument of `void', namely `spaceChar'
In the expression: void spaceChar
In an equation for `x': x = void spaceChar我认为这个表达式是正确的,但是我需要做一些事情来说服类型检查器。我怎么才能让这个起作用?
发布于 2018-01-08 16:01:19
我找到了这个问题,并试图创造一个复制。问题有点深奥:我没有导入Control.Monad。相反,它看起来好像是在其他地方捡到的(不确定在哪里),而这个空洞的定义导致了这个错误的发生。感谢所有想帮忙的人。
发布于 2018-01-08 15:29:43
提示为(Token s ~ Char, MonadParsec e s f) => f ()型。那个应该管用。你从哪里得到Parser这个名字的
https://stackoverflow.com/questions/48153186
复制相似问题