Unboxed Vectors of newtype'd values

Andres Löh andres at well-typed.com
Wed Jun 6 12:58:56 CEST 2012


>> Yes, because these are superclasses of Unbox. So can't you simply say
>> this:
>>
>>> newtype Foo = Foo Int
>>>   deriving (Eq, Show, Unbox, M.MVector MVector, G.Vector Vector)
>
> I don't think this should work. This is the basic set up:

[...]

> I don't understand what GeneralizedNewtypeDeriving does with
> deriving(G.Vector Vector) in this situation but it can't possibly do
> anything sensible without a data instance Vector Foo. The fact that it
> doesn't fail is just a bug, IMO.

I've actually started wondering the same after I posted this. I tried
to use -ddump-deriv to get at the code, but GHC seems to be cheating
and doesn't show what it generates. I guess I understand
newtype-deriving less than I thought ...

Cheers,
  Andres

-- 
Andres Löh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com



More information about the Libraries mailing list