{-# LANGUAGE TemplateHaskell #-} module Main where import Development.Shake import Development.Shake.Persist -- it is just example. md5sum :: FilePath -> Action String md5sum file = do Stdout out <- command [] "md5sum" [file] pure out main :: IO () main = shakeArgs shakeOptions $ do want ["show", "show-th"] m5 <- newCachePersist "suffix" md5sum m5' <- $(persist [|md5sum|]) "random-file" %> \out -> writeFile' out out "show" ~> do value <- m5 "random-file" liftIO $ do putStrLn "Notice md5sum program execution" putStrLn value "show-th" ~> do -- cached separately value <- m5' "random-file" liftIO $ putStrLn value