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,251
    • Issues 4,251
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 394
    • Merge Requests 394
  • 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
  • #14938

Closed
Open
Opened Mar 19, 2018 by Csongor Kiss@kcsongorReporter

Pattern matching on GADT does not refine type family parameters

Compiling the following code

type family R (x :: k) (y :: k) (prf :: x :~: y) :: x :~: y where
  R x y Refl = Refl

fails with the error

Temp.hs:49:9: error:
    • Expected kind ‘x :~: y’, but ‘Refl’ has kind ‘x :~: x’
    • In the third argument of ‘R’, namely ‘Refl’
      In the type family declaration for ‘R’
   |
49 |   R x y Refl = Refl
   |         ^^^^

where Refl is defined as

data a :~: b where
  Refl :: a :~: a

I would expect pattern-matching on Refl to bring the equality x ~ y into scope. It seems like it not only doesn't do that, but the pattern match itself is rejected.

(both 8.2.2 and HEAD)

Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#14938