4
想要找到遗留代码库中的所有位置,以便在if条件下使用变量foo。如何添加类型实例声明
我的代码是
import Language.C
import Data.Generics
import Control.Monad
import Text.Read
parseAndFindFoos :: FilePath -> IO (Either ParseError [Position])
parseAndFindFoos path = liftM (fmap findFooLocations) (parseCFilePre path)
findFooLocations input = fmap posOf (listify isIfOfInterest input)
isIfOfInterest (CIf cond _ _ _) = not (null (listify isFooIdent cond))
isFooIdent (Ident name) = (name == "foo")
我怎么能添加对(分型词位)的实例声明?