Provide more building blocks and extend example
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user