[GHC] #11714: Kind of (->) type constructor is overly constrained

GHC ghc-devs at haskell.org
Sat Feb 18 05:10:43 UTC 2017


#11714: Kind of (->) type constructor is overly constrained
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  bgamari
            Type:  feature request   |               Status:  new
        Priority:  highest           |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:  Typeable,
                                     |  LevityPolymorphism
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"b207b536ded40156f9adb168565ca78e1eef2c74/ghc" b207b53/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="b207b536ded40156f9adb168565ca78e1eef2c74"
 Generalize kind of the (->) tycon

 This is generalizes the kind of `(->)`, as discussed in #11714.

 This involves a few things,

  * Generalizing the kind of `funTyCon`, adding two new `RuntimeRep`
 binders,
   ```lang=haskell
 (->) :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
                (a :: TYPE r1) (b :: TYPE r2).
         a -> b -> *
   ```

  * Unsaturated applications of `(->)` are expressed as explicit
 `TyConApp`s

  * Saturated applications of `(->)` are expressed as `FunTy` as they are
 currently

  * Saturated applications of `(->)` are expressed by a new `FunCo`
 constructor in coercions

  * `splitTyConApp` needs to ensure that `FunTy`s are split to a
 `TyConApp`
    of `(->)` with the appropriate `RuntimeRep` arguments

  * Teach CoreLint to check that all saturated applications of `(->)` are
 represented with `FunTy`

 At the moment I assume that `Constraint ~ *`, which is an annoying
 source of complexity. This will
 be simplified once D3023 is resolved.

 Also, this introduces two known regressions,

 `tcfail181`, `T10403`
 =====================
 Only shows the instance,

     instance Monad ((->) r) -- Defined in ‘GHC.Base’

 in its error message when -fprint-potential-instances is used. This is
 because its instance head now mentions 'LiftedRep which is not in scope.
 I'm not entirely sure of the right way to fix this so I'm just accepting
 the new output for now.

 T5963 (Typeable)
 ================

 T5963 is now broken since Data.Typeable.Internals.mkFunTy computes its
 fingerprint without the RuntimeRep variables that (->) expects. This
 will be fixed with the merge of D2010.

 Haddock performance
 ===================

 The `haddock.base` and `haddock.Cabal` tests regress in allocations by
 about 20%. This certainly hurts, but it's also not entirely unexpected:
 the size of every function type grows with this patch and Haddock has a
 lot of functions in its heap.
 }}}

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


More information about the ghc-tickets mailing list