[GHC] #10016: UNPACK support for existentials

GHC ghc-devs at haskell.org
Mon Apr 2 16:10:21 UTC 2018


#10016: UNPACK support for existentials
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.4
      Resolution:                    |             Keywords:  DataCons
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * keywords:   => DataCons


Old description:

> Consider
> {{{
> data Foo = forall a. Show a => Foo !a !a
>
> data Bar = Bar {-# UNPACK #-} !Foo
> }}}
> The UNPACK pragma should really be able to unpack the `Foo` field, so
> that (implementation-wise) it would be as if you'd declared `Bar` thus:
> {{{
> data Bar = forall a. Show a => Bar !a !a
> }}}
> But currently we get
> {{{
> Ignoring unusable UNPACK pragma on the first argument of ‘Bar’
> }}}
> Suggested by Nicholas Clarke [https://www.haskell.org/pipermail/glasgow-
> haskell-users/2015-January/025590.html here].
>
> Vaguely related tickets: #7647, #9214.  But unlike those ones, this one
> looks quite feasible to me.

New description:

 Consider
 {{{
 data Foo = forall a. Show a => Foo !a !a

 data Bar = Bar {-# UNPACK #-} !Foo
 }}}
 The UNPACK pragma should really be able to unpack the `Foo` field, so that
 (implementation-wise) it would be as if you'd declared `Bar` thus:
 {{{
 data Bar = forall a. Show a => Bar !a !a
 }}}
 But currently we get
 {{{
 Ignoring unusable UNPACK pragma on the first argument of ‘Bar’
 }}}
 Suggested by Nicholas Clarke [https://www.haskell.org/pipermail/glasgow-
 haskell-users/2015-January/025590.html here].

 Vaguely related tickets: #7647, #9214.  But unlike those ones, this one
 looks quite feasible to me.

 Fixing this would require quite a bit of new plumbing.  E.g. the
 existential type variable of the worker and wrapper would differ, which is
 not true today.  But morally it's the Right Thing.

 I'd be interested in actual use-cases.

--

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


More information about the ghc-tickets mailing list