Ticket #3145 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

ImpredicativeTypes vs. LiberalTypeSynonyms

Reported by: MartijnVanSteenbergen Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Consider the following module:

{-# LANGUAGE Rank2Types #-}

module RunMud where

import Control.Monad.State

type Mud      = StateT MudState IO
data MudState = MudState { mRunMud :: RunMud }
type RunMud   = forall a. Mud a -> IO a

getRunMud :: Mud RunMud
getRunMud = do
  s <- get
  return (mRunMud s)

GHC suggests:

Illegal polymorphic or qualified type: RunMud
Perhaps you intended to use -XImpredicativeTypes

When I add a language pragma for ImpredicativeTypes?, GHC stills comes up with the same error message.

Two questions:

1) Can GHC please not suggest enabling extensions that are already enabled? It's very confusing.

2) Can GHC in this specific case suggest LiberalTypeSynonyms?? That's the third extension that needed to be on for this example to compile.

Change History

Changed 3 years ago by simonpj

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to fixed

Happily, the HEAD has this fixed already

$ $vpj -c T3145.hs

T3145.hs:11:0:
    Illegal polymorphic or qualified type: RunMud
    Perhaps you intended to use -XLiberalTypeSynonyms
    In the type signature for `getRunMud':
      getRunMud :: Mud RunMud

Changed 3 years ago by MartijnVanSteenbergen

That's awesome; thank you!

Note: See TracTickets for help on using tickets.