Avoid extra untupling in this case for now

This commit is contained in:
Niels G. W. Serup 2024-09-26 00:06:30 +02:00
parent 5d5dbbec74
commit e770a350d6
No known key found for this signature in database
GPG Key ID: 38EEEBCE67324F19
2 changed files with 5 additions and 1 deletions

View File

@ -26,6 +26,7 @@ module DependencyGenerator
, convertImage , convertImage
, saveFile , saveFile
, copyFile , copyFile
, copyFile'
, makeDir , makeDir
, runPandoc , runPandoc
) where ) where
@ -204,6 +205,9 @@ copyFile (a, b) = do
b' <- toToken b b' <- toToken b
runFunctionIO' CopyFile $ TupleToken (a', b') runFunctionIO' CopyFile $ TupleToken (a', b')
copyFile' :: Token (FilePath, FilePath) -> DepGenM ()
copyFile' = runFunctionIO' CopyFile
makeDir :: TokenableTo FilePath a => a -> DepGenM () makeDir :: TokenableTo FilePath a => a -> DepGenM ()
makeDir a = runFunctionIO' MakeDir =<< toToken a makeDir a = runFunctionIO' MakeDir =<< toToken a

View File

@ -17,7 +17,7 @@ handleRecipeDir outputDir template indexName dir = do
imageFilenames <- filterDepGenM areImageFilenames dirContents imageFilenames <- filterDepGenM areImageFilenames dirContents
imagePaths <- mapDepGenM (curry joinPaths dir) imageFilenames imagePaths <- mapDepGenM (curry joinPaths dir) imageFilenames
imagePathsOut <- mapDepGenM (curry joinPaths outputDir) imageFilenames imagePathsOut <- mapDepGenM (curry joinPaths outputDir) imageFilenames
mapDepGenM_ ((copyFile =<<) . untupleDepGenM) (ZipToken (imagePaths, imagePathsOut)) mapDepGenM_ copyFile' (ZipToken (imagePaths, imagePathsOut))
thumbnailImagePaths <- mapDepGenM (thumbnailImagePath outputDir) imageFilenames thumbnailImagePaths <- mapDepGenM (thumbnailImagePath outputDir) imageFilenames
mapDepGenM_ mapDepGenM_
(\files -> convertImage (files, inject $ ResizeToWidth 800)) (\files -> convertImage (files, inject $ ResizeToWidth 800))