[GHC] #14917: Allow levity polymorhism in binding position

GHC ghc-devs at haskell.org
Thu Mar 15 12:34:12 UTC 2018


#14917: Allow levity polymorhism in binding position
-------------------------------------+-------------------------------------
        Reporter:  andrewthad        |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
                                     |  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 simonpj):

 I am a bit less optimistic than Richard (in comment:3).  You imply that
 all the inlining could be done in the desugarer; but that can only work if
 you could see all calls.

 GHC does already have the notion of a "compulsory unfolding" (see
 `CoreSyn.UnfoldingSource`).  Bindings with a compulsory unfolding ''do not
 have a binding at all'', so they must be inlined at every call site.  That
 fits with the proposal here because we can't implement the levity-
 polymorphic code, so we can't compile code for it.

 We'd still somehow need to check that, after the inlining, the levity-
 polymorphism had vanished, and give a decent error message if not.

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


More information about the ghc-tickets mailing list