我的模块公式中有这样的数据:
data Formula = Formula {
typeFormula :: String,
nbClauses :: Int,
nbVars :: Int,
clauses :: Clauses
}我想导出它,但我不知道正确的语法:
module Formula (
Formula ( Formula ),
solve
) where有人能告诉我正确的语法吗?
发布于 2017-12-21 17:34:34
您的一些困惑来自于您要导出的构造函数具有相同的模块名称。
module Formula (
Formula ( Formula ),
solve
) where应该是
module Formula (
Formula (..),
solve
) where或
module Formula (
module Formula ( Formula (..)),
solve
) where当前的导出语句说,在模块公式中,导出模块公式中定义的类型Formula和函数解题(即模块的作用域,无论在何处定义)
(..)语法意味着导出前面类型的所有构造函数。在您的例子中,它等价于显式
module Formula (
Formula (typeFormula,nbClauses, nbVars,clauses),
solve
) wherehttps://stackoverflow.com/questions/47929556
复制相似问题