类型定义中的参数类型

Let*_*thi 1 haskell

我有这样的数据类型:

data MyType a b = Something a b | ..... 
Run Code Online (Sandbox Code Playgroud)

然后我有一个类型:

type SomethingElse = MyType a b -> AnotherThing
Run Code Online (Sandbox Code Playgroud)

但是,如果我为它所抱怨的类型定义包含a和b参数,但如果我将它们遗漏,它也会抱怨.

错误消息(在类型定义中)是变量a和b不在范围内.

ham*_*mar 6

只要您没有为a和提供具体类型b,您就需要对类型同义词进行参数化.

type SomethingElse a b = MyType a b -> AnotherThing
Run Code Online (Sandbox Code Playgroud)