Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,326
    • Issues 4,326
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 390
    • Merge Requests 390
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #18941

Closed
Open
Opened Nov 11, 2020 by Oleg Grenrus@phadejDeveloper

Cannot have type variable named `role`

data Policy role = Policy

fails with

GHCi, version 8.10.2: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( Role.hs, interpreted )

Role.hs:1:13: error: parse error on input ‘role’
  |
1 | data Policy role = Policy
  |                   ^^^^

In GHC-7.6.3 (pre roles) this code is fine.


Similarly

data Policy family = Policy

Fails In GHC-7.8..GHC-8.10, but is fine with GHC-7.6.


The https://downloads.haskell.org/ghc/8.10.2/docs/html/users_guide/bugs.html#lexical-syntax mentions only forall as extra keyword (data Policy forall = Policy become invalid in GHC-8.8). I'd expect role and family to be either mentioned in lexical syntax divergence section, or made to work. Both seem to be fine as term identifiers.


EDIT: also the error messages is unhelpful. The parser error should mention that role, (family, forall) are interpreted as keyword

Edited Nov 11, 2020 by Oleg Grenrus
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#18941