I believe this is a bug that was introduced in 6.10.2 (it definitely
worked in 6.10.1) that has since been fixed in HEAD. This newtype
deriving issue also prevents the uvector testsuite from running at the
moment.

You might want to try a different version of GHC?

Dan

On Wed, Sep 23, 2009 at 3:04 PM, Khudyakov Alexey
<[email protected]> wrote:
> Hello
>
> I want to derive UA instance for newtypes.
>
> Say I have following newtype:
>> newtype Foo a = Foo a
>
> Attempts to derive UA automatically fails because it have associated types. It
> seems that it's not possible to define from outside. However it's possible to
> derive instance in the uvector's internals.
>
>> deriving instance UAE a   => UAE (Foo a)
>> deriving instance UPrim a => UPrim (Foo a)
>>
>> instance UPrim a => UA (Foo a) where
>>   newtype UArr  (Foo a)   = UAFoo (BUArr (Foo a))
>>   newtype MUArr (Foo a) s = MUFoo (MBUArr s (Foo a))
>>
>>   lengthU        = primLengthU
>>   indexU         = primIndexU
>>   sliceU         = primSliceU
>>   lengthMU       = primLengthMU
>>   newMU          = primNewMU
>>   readMU         = primReadMU
>>   writeMU        = primWriteMU
>>   copyMU         = primCopyMU
>>   unsafeFreezeMU = primUnsafeFreezeMU
>>
>>   memcpyMU     = primMemcpyMU
>>   memcpyOffMU  = primMemcpyOffMU
>>   memmoveOffMU = primMemmoveOffMU
>
> Am I moving in right direction and are there other/better solutions to
> problem?
>
> --
>  Khudyakov Alexey
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to