command-qq-0.3.1.0: Quasiquoters for external commands

Safe HaskellSafe
LanguageHaskell2010

System.Command.QQ.Eval

Description

Evalute passed arguments with external interpreter

Synopsis

Documentation

class Eval r where Source #

Different interesting return types for quasiquoters

Instances here mostly resemble the types of things in System.Process

Methods

eval :: String -> [String] -> r Source #

Instances
Eval (IO ()) Source #

The most basic instance: nothing is known about what happened in external command

External command's stdout and stderr go to caller's stdout and stderr respectively

>>> [sh|echo hello world|] :: IO ()
hello world
Instance details

Defined in System.Command.QQ.Eval

Methods

eval :: String -> [String] -> IO () Source #

(s ~ ExitCode, o ~ Text, e ~ Text) => Eval (IO (s, o, e)) Source #

Return exit code, stdout, and stderr of external process

>>> [sh|echo hello world; echo bye world >&2; exit 1|] :: IO (ExitCode, Text, Text)
(ExitFailure 1,"hello world\n","bye world\n")
Instance details

Defined in System.Command.QQ.Eval

Methods

eval :: String -> [String] -> IO (s, o, e) Source #

Eval (IO ExitCode) Source #

Return exit code of the external process

>>> [sh|exit 0|] :: IO ExitCode
ExitSuccess
>>> [sh|exit 7|] :: IO ExitCode
ExitFailure 7
Instance details

Defined in System.Command.QQ.Eval

Methods

eval :: String -> [String] -> IO ExitCode Source #

Eval (IO String) Source #

Return stdout of external process as String

Does not care whether external process has failed or not.

>>> [sh|echo -n hello world|] :: IO String
"hello world"
Instance details

Defined in System.Command.QQ.Eval

Methods

eval :: String -> [String] -> IO String Source #

Eval (IO Text) Source #

Return stdout of the external process as Text

Does not care whether external process has failed or not.

>>> [sh|echo -n hello world|] :: IO Text
"hello world"
Instance details

Defined in System.Command.QQ.Eval

Methods

eval :: String -> [String] -> IO Text Source #

(i ~ Text, o ~ (ExitCode, Text, Text)) => Eval (i -> IO o) Source #

Return exit code, stdout, and stderr of the external process and pass supplied Text to its stdin

>>> [sh|while read line; do echo ${#line}; done|] "hello\nworld!\n"
(ExitSuccess,"5\n6\n","")
Instance details

Defined in System.Command.QQ.Eval

Methods

eval :: String -> [String] -> i -> IO o Source #