Skip to content

Different error with representation-polymorphic binder

This program is correctly rejected:

{-# LANGUAGE TypeFamilies #-}
module M where

import GHC.Types

type family Q :: k
type family F :: forall (r :: RuntimeRep) -> TYPE r

f :: Bool
f = let a :: F Q; a = undefined in True
    • The binder ‘a’ does not have a fixed runtime representation:
        F Q :: TYPE Q

However, if I change the last line to

f = let a :: F r; a = undefined in True

I get a different, worse error message:

    • Expected a type, but ‘F r’ has kind ‘TYPE r’
      ‘r’ is a rigid type variable bound by
        the type signature for ‘a’
        at M.hs:10:9-16

I'd expect to get the same error in both cases, mentioning no having fixed representation. I suspect there's an extraneous test that is now redundant with the new fixed representation checks.

As far as I can tell, this is not caused by the bug #20837 (closed) in isLiftedType_maybe - cherry-picking 56e041bb does not solve it.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information