Unboxed Vectors of newtype'd values

Roman Leshchinskiy rl at cse.unsw.edu.au
Wed Jun 6 12:44:51 CEST 2012

Andres Löh wrote:
> 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:

class G.Vector v a where
  basicLength :: v a -> Int

data family Vector a

newtype instance Vector Int = V_Int ...

instance G.Vector Vector Int where
  basicLength (V_Int ...) = ...

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.


More information about the Libraries mailing list