[GHC] #15759: GHC doesn't use fixity in type instances
GHC
ghc-devs at haskell.org
Wed Oct 17 14:03:59 UTC 2018
#15759: GHC doesn't use fixity in type instances
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.1
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:
-------------------------------------+-------------------------------------
If I say
{{{#!hs
data a * b
infixl 7 *
type family a + b
infixl 6 +
type instance Int * Bool + Double = Float
}}}
(with `-XNoStarIsType` -- `*` is not the issue here)
I get
{{{
• Illegal family instance for ‘*’
(* is not an indexed type family)
• In the type instance declaration for ‘*’
}}}
But that's wrong. The `*` should bind tighter than the `+`, meaning this
is an instance for `+`, not `*`. This also fails for closed type families:
{{{#!hs
data a * b
infixl 7 *
type family a + b where
Int * Bool + Double = Float
infixl 6 +
}}}
Interestingly, a ''class'' instance works here.
This did not bite me "in the wild", but came up while reading the GHC
source code. Still, it is a real bug.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15759>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list