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,334
    • Issues 4,334
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 368
    • Merge Requests 368
  • 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
  • #13487

Closed
Open
Opened Mar 26, 2017 by DimaSamoz@trac-DimaSamoz

GHC panic with deferred custom type errors

I'm working on a music composition library that enforces composition rules at the type level. It makes heavy use of TypeInType and custom compiler errors. For example, it disallows dissonant major seventh intervals (e.g., a C and a B) in harmonic composition. While testing the library, I encountered a GHC panic which I haven't seen anywhere – unfortunately I don't know enough about GHC to understand what is causing the panic and couldn't reproduce it in simpler examples. I was hoping that you could point me in the right direction so that I can find a smaller program that reproduces the error.

In GHCi, with the -fdefer-type-errors flag set, the following code (which should throw a custom type error as it describes composing a B quarter note with a C quarter note) produces a panic:

λ: let t = c qn :-: b qn

<interactive>:21:9: warning: [-Wdeferred-type-errors]
    • Can't have major sevenths in chords: C and B
    • In the expression: c qn :-: b qn
      In an equation for ‘t’: t = c qn :-: b qn
ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.2 for x86_64-apple-darwin):
	nameModule system irred_aCeG

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

This does not appear when loading a source file, or when -fdefer-type-errors is disabled, and only happens when the expression is assigned to a new value. A lot of the literals in the library are generated by TemplateHaskell, but the error happens without them as well:

λ: let s = Note (Root :: Root (PitchRoot (Pitch B Natural Oct4))) (Dur :: Dur Quarter )
λ: let t = Note (Root :: Root (PitchRoot (Pitch C Natural Oct4))) (Dur :: Dur Quarter )
λ: let v = s :-: t

<interactive>:27:9: warning: [-Wdeferred-type-errors]
    • Can't have major sevenths in chords: B and C
    • In the expression: s :-: t
      In an equation for ‘v’: v = s :-: t
ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.2 for x86_64-apple-darwin):
	nameModule system irred_aCnF

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

The library is available on Hackage (https://hackage.haskell.org/package/mezzo) and the error is reproducible as soon as the main module is loaded.

I'd happily try to find a smaller example which gives the same error, so I was hoping that you might have some ideas about what could be going wrong.

Thank you!

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