De-duplicate code
This commit is contained in:
parent
544b02c3a6
commit
fd3e5f6986
|
@ -74,6 +74,11 @@ runFunction f input = genDependency (makeDependency input (Function f))
|
||||||
runFunctionIO :: FunctionIO -> Token a -> DepGenM' b
|
runFunctionIO :: FunctionIO -> Token a -> DepGenM' b
|
||||||
runFunctionIO f input = genDependency (makeDependency input (FunctionIO f))
|
runFunctionIO f input = genDependency (makeDependency input (FunctionIO f))
|
||||||
|
|
||||||
|
runFunctionIO' :: FunctionIO -> Token a -> DepGenM ()
|
||||||
|
runFunctionIO' f input = do
|
||||||
|
_ <- runFunctionIO f input
|
||||||
|
pure ()
|
||||||
|
|
||||||
mapDepGenM :: (Token a -> DepGenM' b) -> Token [a] -> DepGenM' [b]
|
mapDepGenM :: (Token a -> DepGenM' b) -> Token [a] -> DepGenM' [b]
|
||||||
mapDepGenM f input = genDependencyM $ \target -> do
|
mapDepGenM f input = genDependencyM $ \target -> do
|
||||||
top <- get
|
top <- get
|
||||||
|
@ -114,19 +119,13 @@ readTemplate :: Token FilePath -> DepGenM' Template
|
||||||
readTemplate = runFunctionIO ReadTemplate
|
readTemplate = runFunctionIO ReadTemplate
|
||||||
|
|
||||||
convertImage :: Token ((FilePath, FilePath), ImageConversionSettings) -> DepGenM ()
|
convertImage :: Token ((FilePath, FilePath), ImageConversionSettings) -> DepGenM ()
|
||||||
convertImage input = do
|
convertImage = runFunctionIO' ConvertImage
|
||||||
_ <- runFunctionIO ConvertImage input
|
|
||||||
pure ()
|
|
||||||
|
|
||||||
saveFile :: Token (String, FilePath) -> DepGenM ()
|
saveFile :: Token (String, FilePath) -> DepGenM ()
|
||||||
saveFile input = do
|
saveFile = runFunctionIO' SaveFile
|
||||||
_ <- runFunctionIO SaveFile input
|
|
||||||
pure ()
|
|
||||||
|
|
||||||
makeDir :: Token FilePath -> DepGenM ()
|
makeDir :: Token FilePath -> DepGenM ()
|
||||||
makeDir input = do
|
makeDir = runFunctionIO' MakeDir
|
||||||
_ <- runFunctionIO MakeDir input
|
|
||||||
pure ()
|
|
||||||
|
|
||||||
runPandoc :: Token FilePath -> DepGenM' String
|
runPandoc :: Token FilePath -> DepGenM' String
|
||||||
runPandoc = runFunctionIO RunPandoc
|
runPandoc = runFunctionIO RunPandoc
|
||||||
|
|
Loading…
Reference in New Issue