Provide more building blocks and extend example

This commit is contained in:
2024-09-21 23:11:31 +02:00
parent dad5724af8
commit 5bbcc924b7
5 changed files with 17 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
module Main where
import Types
import ComputationM
import Functions
@@ -7,16 +8,16 @@ handleRecipeDir :: Token FilePath -> ComputationM ()
handleRecipeDir dir = do
dirContents <- listDirectory dir
imageFilenames <- filterComputationM isImageFilename dirContents
t <- inject ("hej", "hey.txt")
saveFile t
convertedImageFilenames <- mapComputationM convertedImageFilename imageFilenames
flip mapComputationM_ (zipTokens imageFilenames convertedImageFilenames) $ \files -> do
settings <- inject $ ResizeToWidth 800
convertImage $ tupleTokens files settings
test :: ComputationM ()
test = do
dir <- inject "retter"
dirContents <- listDirectory dir
mapComputationM_ handleRecipeDir dirContents
t <- inject ("hej", "hey.txt")
saveFile t
main :: IO ()
main = mapM_ print $ evalComputationM test