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,263
    • Issues 5,263
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 565
    • Merge requests 565
  • 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
  • #4418
Closed
Open
Issue created 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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking