
Suppose I need to manually derive Data and Typeable for SourcePos from Parsec to make sure my code compiles. I won't actually be running the code I manually derive since the constructor that includes SourcePos will be skipped. With Neil Mitchell's (and #haskell) help I'm doing this to strip token locations from my AST: import Data.Generics import qualified Text.ParserCombinators.Parsec as P instance Data SourcePos where gfoldl r k x = k x typename_SourcePos = mkTyCon "SourcePos" instance Typeable SourcePos where typeOf _ = mkTyConApp typename_SourcePos ([]) strip = everywhere (mkT f) where f (TokenPos a _) = a f x = x I know that the warnings about gunfold, toConstr and dataTypeOf are harmless but how would I define them to avoid the warnings? Also, the definition of strip above requires -fno-monomorphism- restriction. Should I not worry about it? The code runs just fine, locations are being stripped and tests pass. Thanks, Joel -- http://wagerlabs.com/