[GHC] #14196: Replace ArrayArray# with either UnliftedArray# or Array#

GHC ghc-devs at haskell.org
Fri Sep 8 10:35:18 UTC 2017


#14196: Replace ArrayArray# with either UnliftedArray# or Array#
-------------------------------------+-------------------------------------
        Reporter:  andrewthad        |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      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 simonpj):

 OK now I get it.  I had to look at
 [https://downloads.haskell.org/~ghc/7.4.2/docs/html/libraries/ghc-
 prim-0.2.0.0/GHC-Prim.html#v:indexArrayArrayArray-35- the documentation
 for ArrayArray#].  If I may say it like this:

 The current primitive data type `ArrayArray#` is a heap-allocated array of
 pointers to unlifted objects. Any kind of unlifted objects would be fine,
 provide they are represented by a pointer.   Specifically, we can put both
 `Array#` and `ByteArray#` (and I suppose another `ArrayArray#`) inside an
 `ArrayArray#`.  But doing so is jolly awkwerd because `ArrayArray#` is not
 a parameterised type.

 Why isn't it parameterised?  Becuase previously we had no way to quantify
 over unlifted types.  But now we do.  So we can make `ArrayArray#` into a
 paremterised type, namely your new
 {{{
 data UnliftedArray# (a :: TYPE 'UnliftedRep)
 }}}
 Your idea here is that `UniftedArray#` is an array of pointers to
 ''unlifted'' values.

 Cool, I like it.   Levity polymorphism is great.

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


More information about the ghc-tickets mailing list