I have below duplicate code, but i don't know how to use TH instance code.
------------------------------> duplicate code start
<------------------------------
instance Variable PageType where
toVariant = toVariant . show
fromVariant x = fmap (\v -> read v :: PageType) $ fromVariant x
If this isn't an exercise to learn TH, you might also want to try
scoped type variables (7.8.7) to connect the 'read v' annotation
to the instance head:
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/other-type-extensions.html#scoped-type-variables
Claus
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe