Skip to content
GitLab
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 5,249
    • Issues 5,249
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 573
    • Merge requests 573
  • 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 CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #7558
Closed
Open
Issue created Jan 08, 2013 by Simon Peyton Jones@simonpjDeveloper

Terrible error message when given and wanted are both insoluble

In fixing the ambiguity check I came across this tricky program

data T a b where
  MkT :: (a~Maybe b) => a -> Maybe b -> T a b

f :: T a a -> Bool
f (MkT x y) = [x,y] `seq` True

We get an error message

Frozen2.hs:12:18:
    Could not deduce (a ~ Maybe a)
    from the context (a ~ Maybe a)
      bound by a pattern with constructor
                 MkT :: forall a b. a ~ Maybe b => a -> Maybe b -> T a b,
               in an equation for `f'
      at Frozen2.hs:12:4-10
      `a' is a rigid type variable bound by
          the type signature for f :: T a a -> Bool at Frozen2.hs:11:6
    Relevant bindings include
      f :: T a a -> Bool (bound at Frozen2.hs:12:1)
      x :: a (bound at Frozen2.hs:12:8)
      y :: Maybe a (bound at Frozen2.hs:12:10)
    In the expression: y
    In the first argument of `seq', namely `[x, y]'
    In the expression: [x, y] `seq` True

This error message is nonsense! It arises becuase the "insolubles" get both a "given" insoluble (a~T a) and a "wanted" insoluble with the same type.

This can also arise, rather more easily, with the new ambiguity check, via an inaccessible context

foo :: forall a. (a ~ T a) => a -> a 

It's a bit obscure, but it needs fixing.

Trac metadata
Trac field Value
Version 7.6.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