首页 > 解决方案 > 参数数据构造函数和 GADT:不在范围数据构造函数中

问题描述

标签: haskellimportconstructor

解决方案


In RelationTest.hs file, you are importing specific type constructors from the Relation module using the following:

import Relation (FromValueToSchema,bindType,schema,rows,Relation)

When it comes to data types, this only imports the type constructor. The data constructor(s), possible methods and field names are not imported. Adding a (..) to the end of a type constructor or class will import all of their possible members. Like follows:

import Relation (FromValueToSchema,bindType,schema,rows,Relation(..))

Section 5.3.1 of the Haskell Report states:

Exactly which entities are to be imported can be specified in one of the following three ways:

  1. The imported entities can be specified explicitly by listing them in parentheses. Items in the list have the same form as those in export lists, except qualifiers are not permitted and the `module modid' entity is not permitted. When the (..) form of import is used for a type or class, the (..) refers to all of the constructors, methods, or field names exported from the module.

推荐阅读