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

Closed
Open
Opened Sep 20, 2013 by Richard Eisenberg@raeDeveloper

Incoherent instances without -XIncoherentInstances

Consider the following 4 modules:

{-# LANGUAGE GADTs #-}

module A where

data One = One

data ShowInstFor a = Show a => MkSIF

incoherent :: ShowInstFor One -> ShowInstFor One -> String
incoherent MkSIF MkSIF = show One
module B where

import A

instance Show One where
  show _ = "from module B"

fromB :: ShowInstFor One
fromB = MkSIF
module C where

import A

instance Show One where
  show _ = "from module C"

fromC :: ShowInstFor One
fromC = MkSIF
module D where

import A
import B
import C

oops1 = incoherent fromB fromC
oops2 = incoherent fromC fromB

According to ghci, oops1 is "from moduleB" and oops2 is "from module C". This seems bad.

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