Unboxed Vectors of newtype'd values

Johan Tibell johan.tibell at gmail.com
Mon Jun 4 21:57:34 CEST 2012


My desire probably doesn't overlap much with what others have
described in this thread, apologies. I *think* they want generalized
newtype deriving to work for Unbox instances.

I want to be able to write definition like this (pseudo code):

  data UnpackedList a = forall a. Unbox a => Cons {-# UNPACK #-} !a
(UnpackedList a) | Nil

and have GHC generate appropriate data type definitions at call sites.
In other words, I want polymorphic unpacking to work as long as the
unpacked field is unboxable (i.e. is member of some Unobx type class.)

I believe I've described this desire to you before. Unfortunately it
seems like a really hard problem.

-- Johan



More information about the Libraries mailing list