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

 

S

 

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

 

On Tue, Jun 5, 2012 at 12:02 AM, Simon Peyton-Jones <simonpj@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.