[GHC] #9220: type roles for unboxed arrays
GHC
ghc-devs at haskell.org
Wed Nov 12 10:44:05 UTC 2014
#9220: type roles for unboxed arrays
-------------------------------------+-------------------------------------
Reporter: rwbarton | Owner: goldfire
Type: bug | Status: new
Priority: normal | Milestone: 7.10.1
Component: Core | Version: 7.8.1
Libraries | Keywords:
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Unknown
Unknown/Multiple | Blocked By:
Type of failure: | Related Tickets:
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by ekmett):
Boxed arrays are representational (just by the default roles) though both
`Array` and `UArray` are currently ''also'' `representational` in the
first argument. =/
That is dangerous for much the same reason as relying on the semantics of
`Storable` not changing to a newtype, it is often the very point that the
newtype would change such an instance.
In fact `UArray` is currently even worse and gets inferred as
{{{
type role UArray representational phantom -- ack!
}}}
because the underlying constructor doesn't mention the element type at
all.
We basically just ignored roles in the `array` package when shipping 7.8.x
--
It strikes me that we should have
{{{
type role Array nominal representational
type role UArray nominal nominal
}}}
The first argument is formed nominal by depending upon the chosen `Ix`
instance, and in the case of `UArray` the second argument is forced
nominal by depending upon the chosen `Storable` instance.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9220#comment:24>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list