Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,869
    • Issues 4,869
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 456
    • Merge requests 456
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • 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 Compiler
  • GHCGHC
  • Issues
  • #3440
Closed
Open
Created Aug 19, 2009 by Simon Peyton Jones@simonpjDeveloper

Improve error message for GADT failures

If you write

 type family Fam a :: *

 data GADT :: * -> * where
   GADT :: a -> Fam a -> GADT (Fam a)

 unwrap :: GADT (Fam a) -> (a, Fam a)
 unwrap (GADT x y) = (x, y)

then typechecking unwrap should certainly fail. And it does, but with a horrible message:

 Main.hs:9:21:
   Couldn't match expected type `a' against inferred type `a1'
     `a' is a rigid type variable bound by
         the type signature for `unwrap' at Main.hs:8:20
     `a1' is a rigid type variable bound by
          the constructor `GADT' at Main.hs:9:8
   In the expression: x
   In the expression: (x, y)
   In the definition of `unwrap': unwrap (GADT x y) = (x, y)

It would be better to say something more like:

	Cannot deduce (a ~ a1) from (Fam a ~ Fam a1)

See the thread at http://thread.gmane.org/gmane.comp.lang.haskell.cafe/62322

Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
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