
5 Jun
2012
5 Jun
'12
10:46 p.m.
On 5 June 2012 22:45, Simon Peyton-Jones
So Andres has explained how to do what Johan asks. Does that mean that Bas’s problem is solved?
My problem can't be solved with GeneralizedNewtypeDeriving since a UUID is not a newtype but an abstract data type defined in another package[1]. However, the template-haskell from the vector-th-unbox package which Reiner mentioned does the job perfectly: derivingUnbox "UUID" [d| instance Unbox' UUID (Word32, Word32, Word32, Word32) |] [| \ uuid -> UUID.toWords uuid|] [| \ (a,b,c,d) -> UUID.fromWords a b c d |] Thanks Reiner for pointing me to this package! Cheers, Bas [1] http://hackage.haskell.org/packages/archive/uuid/latest/doc/html/src/Data-UU...