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

GHC ghc-devs at haskell.org
Sat Apr 15 22:13:08 UTC 2017


#13581: UNPACK should allow recursion that obviously terminates
-------------------------------------+-------------------------------------
           Reporter:  ryanreich      |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I want to do this:

 {{{
 {-# LANGUAGE TypeFamilies MagicHash KindSignatures #-}
 data Peano = Zero | Succ Peano
 data family BigWord (n :: Peano)
 data instance BigWord Zero = MachineWord# Word#
 data instance BigWord (Succ n) = BigWord {-# UNPACK #-}(BigWord n) {-#
 UNPACK #-}(BigWord n)
 }}}

 However, the compiler tells me that it is ignoring the UNPACKs, and the
 only reason I can see is that they are apparently recursive. This exact
 type of recursion is handled just fine in instance declarations because
 the recursive instance has fewer type constructors than the head; can't
 UNPACK do the same thing?

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


More information about the ghc-tickets mailing list