I have a set of wrapper newtypes that are always of the same format:
newtype MyType = MyType Obj deriving (A,B,C,D)
where Obj, A, B, C, and D are always the same. Only MyType varies.
A, B, C, and D are automagically derived by GHC using the
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
feature.
I would like to use some macro system (perhaps Template Haskell?) to
reduce this to something like
defObj MyType
I've read through some Template Haskell documentation and examples,
but I find it intimidatingly hard to follow. Does anyone has some code
suggestions or pointers to something similar?