Unboxed Vectors of newtype'd values

Bryan O'Sullivan bos at serpentine.com
Tue Jun 5 19:56:40 CEST 2012


On Tue, Jun 5, 2012 at 12:02 AM, Simon Peyton-Jones
<simonpj at microsoft.com>wrote:

> I see the boring code, but I don't see what you *want*!  I'm guessing you
> want "generalised newtype deriving" but why does that not work?
>

Yes, I (and I assume Bas) want generalised newtype deriving to work, but it
doesn't.

I want to write something very simple:

{-# LANGUAGE GeneralizedNewtypeDeriving #-}
newtype Foo = Foo Int
    deriving (Eq, Show, *Unbox*)

But with the above, GHC says:

    No instances for (M.MVector MVector Foo, G.Vector Vector Foo)
      arising from the 'deriving' clause of a data type declaration

And then we begin the journey that eventually gets us to Bas's rather wordy
code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20120605/90856618/attachment.htm>


More information about the Libraries mailing list