Skip to content

Silly error message suggesting LiberalTypeSynonyms

The following code (rightly) does not compile:

{-# LANGUAGE RankNTypes, TypeFamilies, LiberalTypeSynonyms #-}

type PolyId = (forall a. a -> a)

type family F a

foo :: F PolyId
foo = undefined

The error message is

    Illegal polymorphic or qualified type: PolyId
    Perhaps you intended to use -XLiberalTypeSynonyms
    In the type signature for `foo': foo :: F PolyId

The code doesn't compile because we can't apply a type family to a polytype. The first line of the error message says this well enough, though more information might be helpful here. However, the second line of the error message is silly: I've turned on LiberalTypeSynonyms!

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