Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 5.5k
    • Issues 5.5k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 633
    • Merge requests 633
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #3155
Closed
Open
Issue created Apr 07, 2009 by MartijnVanSteenbergen@trac-MartijnVanSteenbergen

TypeOperators/Rank2Types clash

Consider the following piece of code:

{-# LANGUAGE GADTs #-}

data Any s where
  Any :: s ix -> ix -> Any s

data AnyR s r where
  AnyR :: s ix -> r ix -> AnyR s r

unR :: (forall ix. r ix -> ix) -> AnyR s r -> Any s
unR f (AnyR ix rix) = Any ix (f rix)

GHC reports:

    Illegal operator `.' in type `forall ix . (r ix -> ix)'
      Perhaps you intended to use -XRankNTypes or similar flag
      to enable explicit-forall syntax: forall <tvs>. <type>

Enabling TypeOperators causes the error to change to:

    Occurs check: cannot construct the infinite type: ix = r ix
    In the pattern: AnyR ix rix
    In the definition of `unR': unR f (AnyR ix rix) = Any ix (f rix)

Which is very confusing, as the solution (still) is to turn on Rank2Types.

Could it be made so that the error message stays the same when TypeOperators is turned on?

Trac metadata
Trac field Value
Version 6.10.1
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
Assignee
Assign to
Time tracking