[GHC] #12763: Incorrect behavior with empty functional dependencies
GHC
ghc-devs at haskell.org
Mon Oct 24 17:53:33 UTC 2016
#12763: Incorrect behavior with empty functional dependencies
-------------------------------------+-------------------------------------
Reporter: diatchki | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
(Type checker) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
This is a corner case, but it would appear that GHC doesn't do proper
improvements for classes with "empty" functional dependencies. Consider
the following example:
{{{#!hs
class C a | -> a where
m :: a -> ()
instance C Int
f x = m x
}}}
The inferred type for `f` is `C a => a -> ()`, however I was expecting it
to infer `Int -> ()`.
The reasoning is as follows: the use of `m` generates a `C a` constraint
(`a` is a unification variable). This should have interacted with the `C
Int` instance (in a rather odd vacuous sort of way) to generate a derived
constraint `a ~ Int`, which should have then instantiated `a` to `Int`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12763>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list