[GHC] #15532: Relaxing Levity-Polymorphic Binder Check for Lifted vs Unlifted pointers

GHC ghc-devs at haskell.org
Fri Aug 17 16:10:14 UTC 2018


#15532: Relaxing Levity-Polymorphic Binder Check for Lifted vs Unlifted pointers
-------------------------------------+-------------------------------------
        Reporter:  andrewthad        |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
                                     |  LevityPolymorphism
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  14917             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by andrewthad):

 We can get a crash if we instead write `example` as:

 {{{
 example :: (a -> Bool) -> (a -> a) -> (a -> b) -> (a -> b) -> a -> b
 example p k f g a = if p a then f (k (k a)) else g (k a)
 }}}

 This fails at runtime with:

 {{{
 internal error: MUT_ARR_PTRS_FROZEN0 object entered!
 }}}

 Thanks for helping me see what I was missing. So GHC couldn't possibly
 generate code for the definition I gave for the levity-polymorphic `map`
 function given in the original issue.

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


More information about the ghc-tickets mailing list