I am making a small package that defines wrappers for tuples and adds instances of them, e.g.
newtype Tuple2 a = Tuple2 { untuple2 :: (a, a) } deriving (...) tuple2 :: a -> a -> Tuple2 a tuple2 = ... instance Traversable Tuple2 where ... instance Foldable Tuple2 where ... instance Functor Tuple2 where ... instance Applicative Tuple2 where ...
This repeats from 2 to 15 , so it looks like a job for the Haskell template.
The generated code is always compatible with Haskell 98, so I want the end result to be also compatible with the Haskell 98 package. Is it possible to generate a code fragment using the Haskell template and make a package out of it that does not use TH? (I would prefer an automatic way, if possible.)
Petr pudlรกk
source share