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,255
    • Issues 5,255
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 562
    • Merge requests 562
  • 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
  • #12823
Closed
Open
Issue created Nov 11, 2016 by David Feuer@treeowlReporter

Inconsistency in acceptance of equality constraints in different forms

Currently, we (correctly) require a language extension to accept a declaration like

foo a \~ b =\> f a -\> f b
foo x = x

Suppose I write

{-# LANGUAGE GADTs, UndecidableInstances, ConstraintKinds #-}
module A where
class a ~ b => Equal a b
instance a ~ b => Equal a b

type EqualS a b = a ~ b

and then

-- No extensions
module B where

-- This works
useEqual :: Equal a b => f a -> f b
useEqual x = x

-- But this does not
useEqualF :: EqualF a b => f a -> f b
useEqualF x = x

It seems that GHC expands type synonyms, but does not reduce constraints, before deciding whether enough extensions are in play to allow equality constraints. This mismatch feels weird. Is there something about ~ proper, and not Equal, that triggers the difficulties with let generalization? If not, I think they should either both work or both fail (probably both fail).

Trac metadata
Trac field Value
Version 8.0.1
Type FeatureRequest
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