GHC 7.4.1的约束种类语法是什么?

gat*_*ado 20 haskell typeclass constraint-kinds

Constraint当我尝试编写一个简单的例子时,我收到的错误不在范围内,

{-# LANGUAGE UndecidableInstances,
            MultiParamTypeClasses,
            KindSignatures,
            Rank2Types,
            ConstraintKinds,
            FlexibleInstances,
            OverlappingInstances,
            TypeFamilies #-}

type family A a :: Constraint
Run Code Online (Sandbox Code Playgroud)

错误是,

> ghci test.hs
[1 of 1] Compiling Main             ( test.hs, interpreted )

test.hs:10:20: Not in scope: type constructor or class `Constraint'
Failed, modules loaded: none.
Run Code Online (Sandbox Code Playgroud)

约束同义词似乎按预期工作,

type ShowOrd a = (Ord a, Show a)
Run Code Online (Sandbox Code Playgroud)

提前致谢.

C. *_*ann 26

您的错误似乎是由于Constraint,不出所料,不在范围内造成的.您将要从中导入GHC.Prim或从中GHC.Exts导入.

似乎有点奇怪的是,启用ConstraintKinds并不会自动将其带入范围,就像我在7.3.2快照构建中所做的那样,但是你去了.