Description
Quasi-Quoters for exec process.
README.md
process-qq: A Quasi-Quoter to execute processes
About
This is a simple package for executing external process using quasi-quoters.
Install
$ cabal update
$ cabal install process-qq
API
process-qq has three quasi-quoters, cmd
, lcmd
and enumCmd
.
The result type of cmd
is (Strict) ByteString
, lcmd
is Lazy ByteString
, enumCmd
's is MonadIO m => Enumerator ByteString m a
.
Command is failed, an Exception is thrown.
Command is executed in run-time, not compile-time.
Example
- Invoke a process simply
{-# LANGUAGE QuasiQuotes #-}
import System.Process.QQ
main = print =<< [cmd|ls|]
- Enumerate a process
main =
run_ $ [enumCmd|curl http://www.google.com/|] $$ iterHandle stdout
- Unquoting (syntax is same as shakespeare-text)
main = do
[url] <- getArgs
print =<< [cmd|curl #{url}|]