
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