[GHC] #13415: Instance declarations don't recognize named wildcards
GHC
ghc-devs at haskell.org
Sun Mar 12 20:23:32 UTC 2017
#13415: Instance declarations don't recognize named wildcards
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.4.1
Component: Compiler | Version: 8.0.1
(Type checker) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Poor/confusing
Unknown/Multiple | error message
Test Case: | Blocked By:
Blocking: | Related Tickets: #13324
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
While exploring a fix for #13324, I was blocked pretty quickly by this
limitation: instance declarations don't properly recognize named
wildcards. Here is an example to demonstrate:
{{{#!hs
{-# LANGUAGE NamedWildCards #-}
module Bug where
instance _x => Show (Maybe a)
}}}
{{{
Bug.hs:4:10: error:
• Illegal constraint: _x (Use ConstraintKinds to permit this)
• In the context: _x
While checking an instance declaration
In the instance declaration for ‘Show (Maybe a)’
|
4 | instance _x => Show (Maybe a)
| ^^^^^^^^^^^^^^^^^^^^
}}}
GHC doesn't recognize that `_x` is just a type variable, not a named
wildcard.
I believe fixing this is just a matter of changing the ASTs for instance
declarations to use `LHsSigWcType` instead of `LHsSigType`. Patch
incoming.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13415>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list