[NumericPrelude] Unbox instance for NP's data types?

Henning Thielemann haskell at henning-thielemann.de
Tue Nov 19 20:50:19 GMT 2013


On Tue, 19 Nov 2013, Christopher J Peikert wrote:

> What would make me even happier is if it provided Data.Vector.Unbox 
> instances (of Unbox) for types like Number.Complex.T.
> 
> These instances can even be auto-derived -- see,
> e.g., http://stackoverflow.com/questions/10866676/how-do-i-write-a-data-vector-unboxed-instance-in-haskell
> 
> However, I can't derive them myself because the derivation must occur where the constructor is in scope.

I have to think about, whether I like adding a dependency on the 'vector' 
package. Until I find a good answer you might wrap the Complex type in a 
newtype wrapper, lift all needed NumericPrelude instances using 
GeneralizedNewtypeDeriving and add an Unbox instance manually.


Best,
Henning


More information about the Numeric-Prelude mailing list