--- This attempts to locate derived code, so as to not add ticks
--- to compiler generated code. An alternative is to tie *all* the
--- method functions to the deriving class name in the deriving list.
-
--- This fuction works because we use the location of the datatype
--- we are building the instance for as the location of derived code.
-
-isDerivedLHsBind :: LHsBind Id -> Bool
-isDerivedLHsBind (L pos t@(AbsBinds _ _ [(_,the_id,_,_)] _)) =
- case splitTyConApp_maybe (varType the_id) of
- Just (tyCon,[ty]) | isClassTyCon tyCon ->
- case splitTyConApp_maybe ty of
- Just (tyCon',_) -> getSrcSpan (tyConName tyCon') == getSrcSpan the_id
- _ -> False
- _ -> False
-isDerivedLHsBind _ = False
-