[GHC] #13581: UNPACK should allow recursion that obviously terminates

GHC ghc-devs at haskell.org
Tue Apr 18 07:47:51 UTC 2017


#13581: UNPACK should allow recursion that obviously terminates
-------------------------------------+-------------------------------------
        Reporter:  ryanreich         |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
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):

 No, the reason that GHC can't act on the unpacks is that it processes each
 `data instance` declaration, once and for all, when it encounters it.  So
 it bahveas much as if it saw
 {{{
 type instance BigWord (Succ n) = BigWord_Succ n

 data BigWord_Succ n = BigWord {-# UNPACK #-}(BigWord n}
                               {-# UNPACK #-}(BigWord n)
 }}}
 At this point it can't unpack those fields because it has no idea what `n`
 is.

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


More information about the ghc-tickets mailing list