我在Haskell中编写了一个示例空间泄漏的集合,并希望编写一个测试套件来捕获自己,以防我插入任何实际上没有泄漏空间的示例.
有没有办法测试这些示例而不为每个示例单独执行?
我有一个data Foo a b = Bar a b在库内部使用的数据类型。
对于其中一种较为常见的具体形式,我也有一个别名:type Bar = Foo Int Int。
有没有一种方法可以导出Bar类型,但是不能Foo从我的库中导出类型?
我想做:
module Quux (
Bar(Bar)
) where
Run Code Online (Sandbox Code Playgroud)
但是当我尝试这样做时,我得到了错误:
The export item ‘Bar(Bar)’
attempts to export constructors or class methods that are not visible here
Run Code Online (Sandbox Code Playgroud)
下面的方法可以工作,除了我完全不导出Foo类型:
module Quux (
Bar
, Foo(..)
) where
Run Code Online (Sandbox Code Playgroud) haskell ×2