Opened 4 years ago

Closed 4 years ago

#7809 closed bug (fixed)

Silly error message suggesting LiberalTypeSynonyms

Reported by: goldfire Owned by:
Priority: normal Milestone: 7.8.1
Component: Compiler (Type checker) Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: typecheck/should_fail/T7809
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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!

Change History (3)

comment:1 Changed 4 years ago by igloo

Component: CompilerCompiler (Type checker)
difficulty: Unknown
Milestone: 7.8.1

Thanks for the report

comment:2 Changed 4 years ago by simonpj@…

commit 936001caa0dc045aa937c9f256b338429664d83c

Author: Simon Peyton Jones <>
Date:   Thu May 30 12:33:56 2013 +0100

    Improve validity check to give better error message
    Fixes Trac #7809

 compiler/typecheck/TcValidity.lhs |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

comment:3 Changed 4 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: typecheck/should_fail/T7809
Note: See TracTickets for help on using tickets.