Versionbump: Template Haskell in System.FilePath.Glob.TH
This commit is contained in:
parent
b054d3cbdd
commit
0d40f85634
@ -21,13 +21,13 @@ import qualified Data.Map.Strict as Map
|
|||||||
|
|
||||||
deriving instance Lift CompOptions
|
deriving instance Lift CompOptions
|
||||||
|
|
||||||
patternFile' :: CompOptions -> FilePath -> TExpQ (Map Text Pattern)
|
patternFile' :: CompOptions -> FilePath -> Code Q (Map Text Pattern)
|
||||||
patternFile' opts file = do
|
patternFile' opts file = liftCode $ do
|
||||||
qAddDependentFile file
|
qAddDependentFile file
|
||||||
patternStrings <- runIO $ filter (not . isComment) . Text.lines <$> Text.readFile file
|
patternStrings <- runIO $ filter (not . isComment) . Text.lines <$> Text.readFile file
|
||||||
unsafeTExpCoerce . appE [e|Map.fromList|] . listE $ map (\pat'@(Text.unpack -> pat) -> [e|(pat', compileWith opts pat)|]) patternStrings
|
unsafeTExpCoerce . appE [e|Map.fromList|] . listE $ map (\pat'@(Text.unpack -> pat) -> [e|(pat', compileWith opts pat)|]) patternStrings
|
||||||
|
|
||||||
patternFile :: CompOptions -> FilePath -> TExpQ [Pattern]
|
patternFile :: CompOptions -> FilePath -> Code Q [Pattern]
|
||||||
patternFile opts file = [||Map.elems $$(patternFile' opts file)||]
|
patternFile opts file = [||Map.elems $$(patternFile' opts file)||]
|
||||||
|
|
||||||
isComment :: Text -> Bool
|
isComment :: Text -> Bool
|
||||||
|
|||||||
Reference in New Issue
Block a user