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,393
    • Issues 4,393
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 378
    • Merge Requests 378
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15361

Closed
Open
Opened Jul 11, 2018 by Ryan Scott@RyanGlScottMaintainer

Error message displays redundant equality constraint

When compiling this program:

{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
module Bug where

import Data.Kind
import Data.Type.Equality

foo :: forall (a :: Type) (b :: Type) (c :: Type).
       a :~~: b -> a :~~: c
foo HRefl = HRefl

GHC complains thus:

$ /opt/ghc/8.4.3/bin/ghc Bug.hs
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:12:13: error:
    • Could not deduce: a ~ c
      from the context: (* ~ *, b ~ a)
        bound by a pattern with constructor:
                   HRefl :: forall k1 (a :: k1). a :~~: a,
                 in an equation for ‘foo’
        at Bug.hs:12:5-9
      ‘a’ is a rigid type variable bound by
        the type signature for:
          foo :: forall a b c. (a :~~: b) -> a :~~: c
        at Bug.hs:(10,1)-(11,27)
      ‘c’ is a rigid type variable bound by
        the type signature for:
          foo :: forall a b c. (a :~~: b) -> a :~~: c
        at Bug.hs:(10,1)-(11,27)
      Expected type: a :~~: c
        Actual type: a :~~: a
    • In the expression: HRefl
      In an equation for ‘foo’: foo HRefl = HRefl
    • Relevant bindings include
        foo :: (a :~~: b) -> a :~~: c (bound at Bug.hs:12:1)
   |
12 | foo HRefl = HRefl
   |             ^^^^^

That * ~ * constraint is entirely redundant.

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