Skip to content

"Instance head is not headed by a class" when `Constraint` replaced with `type C = Constraint`

{-# Language DataKinds, TypeInType, TypeFamilies #-}

import Data.Kind

newtype I a = I a

type C = Constraint

type family
  UnitC :: Constraint where
  UnitC = ()

instance UnitC => Functor I where
  fmap = undefined 

this works fine, but if I try to use the constraint synonym C (UnitC :: C where) fails with "Instance head is not headed by a class" which has no Google hits outside of the compiler

$ ghci -ignore-dot-ghci hs/249.hs
GHCi, version 8.5.20180128: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( hs/249.hs, interpreted )

hs/249.hs:13:10: error:
    • Instance head is not headed by a class
    • In the instance declaration for ‘Functor I’
   |
13 | instance UnitC => Functor I where
   |          ^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
Prelude> 
Trac metadata
Trac field Value
Version 8.4.3
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