Skip to content

Tuple constraints not properly kinded

Consider this:

{-# LANGUAGE DataKinds, ConstraintKinds, KindSignatures #-}

import GHC.Exts ( Constraint )

type UnitType = (() :: *)
type UnitConstraint = (() :: Constraint)

type PairType = ((,) :: * -> * -> *)

So far, so good. But, adding the following causes an error:

type PairConstraint = ((,) :: Constraint -> Constraint -> Constraint)

The error is

    The signature specified kind `Constraint
                                  -> Constraint -> Constraint',
      but `(,)' has kind `* -> * -> *'

In general, you can't use the prefix form of (,) in a constraint, to my surprise. It's not entirely clear what is the "correct" behavior here, but this all seems a little fishy as currently implemented.

This was all tested on 7.7.20121130.

Trac metadata
Trac field Value
Version 7.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information