Ticket #48 (closed enhancement: wontfix)
Generate Unbox instances using TH
|Reported by:||Khudyakov||Owned by:|
|Cc:||alexey.skladnoy@…, bgamari, PHO, haskell.org@…|
It would be very nice and useful feature. Tuple-like data types are very frequently used.
data Point a = Point a a
It's not different from (a,a) and therefore could have Unboxed instance. However writing such instance is highly impractical. Obvious workaround is to make Point a newtype and to use GeneraliedNewtypeDeriving?:
newtype Point a = Point (a,a) deriving instance (U.Unbox a) => U.Unbox (Point a a) deriving instance (U.Unbox a) => G.Vector U.Vector (Point a a) deriving instance (U.Unbox a) => M.MVector U.MVector (Point a a)
This approach looks a little ugly to me. And if newtype couldn't be used for any reason it won't work.
Since to my knowledge TH doesn't offer any control on inlining it's not possible implement.