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,868
    • Issues 4,868
    • 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
  • #2618
Closed
Open
Created Sep 22, 2008 by guest@trac-guest

Order is relevant when matching signature contexts of a mutually recursive group

The Following code

f :: (Show a, Eq a) => a -> String
f x = show x `const` g x

g :: (Eq a,Show a) => a -> Bool
g x = x==x `const` f x

gives this error:

    Couldn't match expected type `Eq a' against inferred type `Show a1'
    When matching the contexts of the signatures for
      f :: forall a. (Show a, Eq a) => a -> String
      g :: forall a. (Eq a, Show a) => a -> Bool
    The signature contexts in a mutually recursive group should all be identical
    When generalising the type(s) for f, g
Failed, modules loaded: none.

but it compiles fine if i swap Show and Eq in the context of either f or g. The order of typeclass constraints usually doesn't matter so it's very surprising that it does here.

Trac metadata
Trac field Value
Version 6.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC sanzhiyan@gmail.com
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking