如何明确导入' fn' test.quickcheck的模式?
haskell的 /a>模块导出模式FN
,我一直在使用。
当我将其导入时:
import Test.QuickCheck
它可以正常工作。但是,当我将其导入以下内容时:
import Test.QuickCheck (Fn)
我会收到错误:模块'test.quickcheck'不导出'fn'
。我还尝试了import test.quickcheck(fun(fn))
,但是这样做了类似的错误。
如前所述,毛毯导入有效,但是在这里我的偏爱是使用显式导入,以便我可以轻松地看到每个导入术语来自何处。是否可以明确导入此类“模式”?
Haskell's Test.QuickCheck
module exports pattern Fn
, which I have been using.
When I import it with:
import Test.QuickCheck
it works fine. However, when I import it with:
import Test.QuickCheck (Fn)
I get an error: Module ‘Test.QuickCheck’ does not export ‘Fn’
. I have also tried import Test.QuickCheck (Fun(Fn))
, but get a similar error doing that.
As mentioned, the blanket import works, but here my preference is to use explicit imports so that I can easily see where each imported term came from. Is it possible to import such 'patterns' explicitly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能执行
导入test.quickcheck(fun(fn))
,因为,尽管fn
确实构造了fun
值,但实际上不是这种类型的相关构造函数之一。相反,它是独立的模式同义词。因此,您需要相应的扩展名来明确导入它:You can't do
import Test.QuickCheck (Fun(Fn))
because, althoughFn
does construct aFun
value, it is not actually one of the associated constructors of this type. Rather, it is a standalone pattern synonym. As such, you need the corresponding extension to explicitly import it: