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

GHC ghc-devs at haskell.org
Fri Mar 23 02:35:22 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 dfeuer):

 Could we skirt the problem using typeclass machinery? Instead of

 {{{#!hs
 bTwice :: ∀ (r :: RuntimeRep) (a :: TYPE r). Bool → a → (a → a) → a
 }}}

 What if we have

 {{{#!hs
 bTwice :: ∀ (r :: RuntimeRep) (a :: TYPE r). KnownRep r => Bool → a → (a →
 a) → a
 }}}

 To call this function, we consult the `KnownRep` dictionary to discover
 its calling conventions. Obviously everything will be terrible if it
 doesn't specialize, but maybe there's a way to make it work soundly
 otherwise?

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


More information about the ghc-tickets mailing list