Type roles for UArray?

wren romano winterkoninkje at gmail.com
Tue Mar 24 14:25:23 UTC 2015


On Tue, Mar 24, 2015 at 10:15 AM, Reid Barton <rwbarton at gmail.com> wrote:
> On Tue, Mar 24, 2015 at 9:57 AM, wren romano <winterkoninkje at gmail.com>
> wrote:
>>
>> So I was working on porting my libraries to work for GHC 7.10 and I
>> ran into a snag. Unlike the concrete type Data.Array.Array,  the
>> concrete type Data.Array.Unboxed.UArray is defined as being nominal in
>> the second type argument— is this a bug?
>
> No, see https://ghc.haskell.org/trac/ghc/ticket/9220.

Fair enough.


To be clearer, my actual goal is to automatically derive the (IArray
UArray) instance for a newtype. The newtype has semantic content (like
Sum or Product), but no representational content (i.e., New and Old
have the same size and the same valid bit patterns). This worked fine
in GHC 7.8 and prior, and should still be fine since it doesn't run
into the sorts of issues raised by that bug report. Again, the goal is
to automatically derive the instance rather than doing it manually,
since I really want to just inherit the underlying instance at the new
type.

-- 
Live well,
~wren


More information about the Libraries mailing list