
22 Jun
2010
22 Jun
'10
12:21 p.m.
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-extension... Claus