command-qq- Quasiquoters for external commands

Safe HaskellNone




Quasiquoters for external commands



Default shell

sh_ :: QuasiQuoter Source

Simple quasiquoter for the default shell

sh analog that always constructs an action of type IO () and so can always be used without type annotations

>>> [sh_|echo "hello, world!"|]
hello, world!

sh :: QuasiQuoter Source

Quasiquoter for the default shell

Constructs polymorphic action of type Eval a => a from passed string.

Uses SHELL environment variable as path to shell executable or /bin/sh if it is unset.

>>> [sh|echo "hello, world!"|] :: IO ExitCode
>>> [sh|echo "hello, world!"|] :: IO Text
"hello, world!\n"

Haskell values can be embedded with Ruby-like syntax:

>>> let apples = 7
>>> [sh|echo "#{apples} apples!"|] :: IO Text
"7 apples!\n"


shell :: FilePath -> QuasiQuoter Source

Shell's quasiquoter constructor

"Shell" here means executable that has the following API:


e.g. sh, bash, zsh, ksh, tcsh, python, etc

interpreter :: FilePath -> QuasiQuoter Source

Interpreter's quasiquoter constructor

"Interpreter" here means executable that has the following API:


e.g. perl, ruby, ghc, etc


quoter :: (String -> Q Exp) -> QuasiQuoter Source

Construct quasiquoter from function taking the string and producing Haskell expression.

Other kinds of quasiquoters (patterns, types or declarations quasiquoters) will fail at compile time

callCommand Source


:: FilePath

Command path

-> [String]

Arguments that go to command before quasiquoter contents

-> String

Quasiquoter contents

-> Q Exp 

Construct Haskell expression for external command call

substituteVars :: String -> Q Exp Source

Construct Haskell expression from the string, substituting variables for their values. Variable expansion uses a ruby-like syntax