[GHC] #12918: Make DefaultSignatures more particular about their types on the RHS of a context
GHC
ghc-devs at haskell.org
Sat Jan 14 05:06:01 UTC 2017
#12918: Make DefaultSignatures more particular about their types on the RHS of a
context
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: simonpj
Type: bug | Status: new
Priority: normal | Milestone: 8.2.1
Component: Compiler (Type | Version: 8.0.2-rc1
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #12784 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
OK, I've made some progress on this, but I'm once again stuck. I'm using
`tcUnifyTy` once again to check if two type signatures coincide according
to the criteria listed above. But there's a case it doesn't catch:
{{{#!hs
class Foo a where
bar :: forall b. a -> b
default bar :: a -> Int
bar = ...
}}}
Here, `tcUnifyTy` happily unifies `b` with `Int`, yielding a false
positive. So I need to find some way to prevent `b` from unifying with
concrete types like `Int`. (Does skolemizing it accomplish this?) But we'd
also want this to be accepted:
{{{#!hs
class Foo a where
bar :: forall b. a -> b
default bar :: forall c. a -> c
bar = ...
}}}
Since `a -> c` is just a simple alpha-renaming of `a -> b`. So how can we
tell `b` to unify with `c` but not with `Int`?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12918#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list