Unboxed Vectors of newtype'd values

Simon Peyton-Jones simonpj at microsoft.com
Tue Jun 5 22:45:25 CEST 2012

So Andres has explained how to do what Johan asks.  Does that mean that Bas’s problem is solved?


From: Bryan O'Sullivan [mailto:bos at serpentine.com]
Sent: 05 June 2012 18:57
To: Simon Peyton-Jones
Cc: Bas van Dijk; Johan Tibell; Jake McArthur; libraries at haskell.org
Subject: Re: Unboxed Vectors of newtype'd values

On Tue, Jun 5, 2012 at 12:02 AM, Simon Peyton-Jones <simonpj at microsoft.com<mailto: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/15d471cf/attachment-0001.htm>

More information about the Libraries mailing list