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")
我怎麼能添加對(分型詞位)的實例聲明?