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 374
    • Merge Requests 374
  • 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
  • #4418

Closed
Open
Opened Oct 20, 2010 by reinerp@trac-reinerp

Superclass functional dependencies are ignored during instance selection

The following example compiles with ghc-6.12.3, but not with ghc-7.0.0.20100924:

{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}

module Ambiguity where

class C1 a b | b -> a
class (C1 a b) => C2 a b where
  foo :: b -> b

data A = A
data B = B
instance C1 A B
instance C2 A B

-- this is accepted by both 6.12.3 and 7
runFoo :: C2 a b => b -> b
runFoo = foo

-- this is accepted by 6.12.3, but not by 7
runFoo2 :: B -> B
runFoo2 = foo

A straightforward fix is to add the b -> a fundep to the C2 class as well.

Trac metadata
Trac field Value
Version 7.1
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
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#4418