Many1 不再适用于 Parsec 3.x

发布于 2024-08-26 22:56:12 字数 289 浏览 4 评论 0原文

从 2.x 更新到 Parsec 3.1 后,使用 Many1 的代码(例如 word = Many1 letter)失败,

No instance for (Stream s m Char) arising from a use of `letter'

我发现一个邮件列表帖子声称添加 {-#LANGUAGE NoMonomorphismRestriction #-}< /code> 到源文件的顶部可以解决问题,但事实并非如此。

After updating to Parsec 3.1 from 2.x, code using many1, such as word = many1 letter fails with

No instance for (Stream s m Char) arising from a use of `letter'

I found a mailing list post claiming that adding {-#LANGUAGE NoMonomorphismRestriction #-} to the top of the source file would solve the problem, but it did not.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毁梦 2024-09-02 22:56:12

不要忘记在 LANGUAGE 之前添加空格。

您还可以编写显式类型注释,而不是关闭单态限制。

Don't forget to add a space before LANGUAGE.

Instead of turning off the monomorphism restriction, you can also write an explicit type annotation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文