Skip to content

Inconsistency between handling functional dependencies in class and signature constraints

the user's guide claims

  1. 4.2 3. There are no restrictions on the context in a class declaration (which introduces superclasses), except that the class hierarchy must be acyclic.

and we also have

  1. 4.3.1 1. Each universally quantified type variable tvi must be reachable from type

suggesting that FDs are taken into account when considering reachability

but that only seems to work for signature, not for class constraints, as the attached example shows. I wouldn't go so far as claiming this as a bug, but it prevents an otherwise straightforward encoding of ATS in FDs (where the superclass encodes the type function, see last month's discussion on haskell-cafe).

[grr, there isn't a button for attachment on this form, so I'll paste the code]

{-# OPTIONS_GHC -fglasgow-exts #-}
class C a b | a -> b
class C a b => D a
f :: C a b => a
f = undefined
Trac metadata
Trac field Value
Version 6.5
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information