#714: Inconsistency between handling functional dependencies in class and
signature constraints
-------------------------------------+--------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: simonpj
Type: bug | Status: new
Priority: low | Milestone: 6.10 branch
Component: Compiler (Type checker) | Version: 6.5
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Unknown
Os: Unknown |
-------------------------------------+--------------------------------------
Comment (by chak):
Concerning
{{{
type family TF a
-- class TF a ~ b => CTF a -- Not in scope: type variable `b'
tf :: TF a ~ b => a
tf = undefined
}}}
What is the problem with the following answer?
{{{
*Main> :t tf
tf :: a
}}}
The constraint `TF a ~ b` can always be satisfied by `b := TF a` and does
not put any restriction on the application of `tf`. Hence, GHC reckons
the types `a` and `TF a ~ b => a` are interchangeable. (If you want the
verbatim signature given for `tf`, use `:i tf`.)
The situation is different for type classes, as `FD a b` signifies that
all methods of `FD` are available in `fd`. There is nothing corresponding
for TFs.
The same holds for the super class constraint `TF a ~ b`. It is
meaningless; hence, I cannot see why we should support it.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/714#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs