Skip to content

Instantly share code, notes, and snippets.

@notcome
Created February 28, 2017 08:39
Show Gist options
  • Save notcome/05d54edbf26262969b6d3a0c1011e050 to your computer and use it in GitHub Desktop.
Save notcome/05d54edbf26262969b6d3a0c1011e050 to your computer and use it in GitHub Desktop.
Haskell as script via Turtle, an example
#!/usr/bin/env stack
-- stack --install-ghc runghc --package turtle
{-# LANGUAGE OverloadedStrings #-}
import Turtle
main = do
containerArg <- format (fp%":/latex") <$> pwd
userArgs <- arguments
let dockerArgs = ["run", "-v", containerArg,
"minsheng/latex:latest"] ++ userArgs
result <- proc "docker" dockerArgs empty
case result of
ExitSuccess ->
return ()
ExitFailure exitCode ->
print $ format ("Docker fails with exit code "%d) exitCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment