[GHC] #12088: Promote data family instance constructors

GHC ghc-devs at haskell.org
Sat Jun 18 20:53:58 UTC 2016


#12088: Promote data family instance constructors
-------------------------------------+-------------------------------------
        Reporter:  alexvieth         |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11348            |  Differential Rev(s):  Phab:D2272
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Yes, I did not fully understand the algorithm for adding extra edges.  I
 think the specification is this:

 * We need an edge that makes a `TyClDecl` D depend on every `InstDecl`
 that does not depend (transitively) on D.

 It took me a few mins to write this down, and it does not look convenient
 to compute.

 If you are happy with the approach I described, can we try that?

 > Do you mean that if an instance appears in a cyclic group, the program
 will definitely be rejected?

 Yes; a `data instance` can only depend on itself via promoted
 constructors, which we rule out for data type decls and should do for
 `data instances` too:
 {{{
 data instance T Int = MkT (forall (a::Proxy 'MkT). ...blah...)
 }}}
 As you say, it need a decent error message.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12088#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list