De-duplicate code

This commit is contained in:
Niels G. W. Serup 2024-09-25 19:45:10 +02:00
parent 544b02c3a6
commit fd3e5f6986
No known key found for this signature in database
GPG Key ID: 38EEEBCE67324F19
1 changed files with 8 additions and 9 deletions

View File

@ -74,6 +74,11 @@ runFunction f input = genDependency (makeDependency input (Function f))
runFunctionIO :: FunctionIO -> Token a -> DepGenM' b
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 f input = genDependencyM $ \target -> do
top <- get
@ -114,19 +119,13 @@ readTemplate :: Token FilePath -> DepGenM' Template
readTemplate = runFunctionIO ReadTemplate
convertImage :: Token ((FilePath, FilePath), ImageConversionSettings) -> DepGenM ()
convertImage input = do
_ <- runFunctionIO ConvertImage input
pure ()
convertImage = runFunctionIO' ConvertImage
saveFile :: Token (String, FilePath) -> DepGenM ()
saveFile input = do
_ <- runFunctionIO SaveFile input
pure ()
saveFile = runFunctionIO' SaveFile
makeDir :: Token FilePath -> DepGenM ()
makeDir input = do
_ <- runFunctionIO MakeDir input
pure ()
makeDir = runFunctionIO' MakeDir
runPandoc :: Token FilePath -> DepGenM' String
runPandoc = runFunctionIO RunPandoc