Skip to content

Can create bindings of kind Constraint without ConstraintKind, only TypeFamilies

This code compiles with GHC 8.0.1 (in either variant, with or without the definition of ApplyCtx Int in Foo Int. I think it shouldn't according to the docs in http://ghc.readthedocs.io/en/master/glasgow_exts.html?highlight=constraintKinds#the-constraint-kind. If this is intended, I guess documenting it is acceptable.

{-# LANGUAGE TypeFamilies #-}
module Foo where

import GHC.Exts (Constraint)
class Foo a where
  type ApplyCtx a :: Constraint
  type ApplyCtx a = ()

instance Foo Int where
  type ApplyCtx Int = Show Int -- Commenting this out makes no difference.

f :: ApplyCtx Int => Int
f = 0

Googling found https://mail.haskell.org/pipermail/glasgow-haskell-users/2016-February/026151.html, but seems a different issue (and a non-bug). Also found #11715 (closed), which might be relevant (or not).

Trac metadata
Trac field Value
Version 8.0.1
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