[GHC] #12159: Record-like GADTs with repeated fields (of same type) rejected
GHC
ghc-devs at haskell.org
Thu Jun 9 18:08:39 UTC 2016
#12159: Record-like GADTs with repeated fields (of same type) rejected
-------------------------------------+-------------------------------------
Reporter: heisenbug | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by adamgundry):
A few of us discussed this and believe that both cases above can be
covered with a single generalisation: for all the constructors that
mention the field, require that the field types are the same, then take
the anti-unifier of all the result types and check that this includes all
the variables mentioned by the common field type. For example:
{{{#!hs
data S x where
S1 :: { f :: Maybe a } -> S ([a], Int)
S2 :: { f :: Maybe a } -> S ([a], Bool)
f :: S ([a], b) -> Maybe a
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12159#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list