The command-qq package

[Tags: bsd3, library]

Features:

 >>> [sh_| echo hello world! |]
 hello world!
 ghci = quoter $ callCommand "ghc" ["-ignore-dot-ghci", "-e"]

Then you can use ghci in ghci!

 >>> [ghci| putStrLn "hello world!" |] :: IO ()
 hello world!

For more examples, see System.Command.QQ.Predef

See README.md for an example

See examples/CommandT.hs


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.2.0.0, 0.2.1.0, 0.2.2.0, 0.3.0.0
Change logCHANGELOG.md
Dependenciesbase (==4.*), process, template-haskell, text [details]
LicenseBSD3
AuthorMatvey Aksenov
Maintainermatvey.aksenov@gmail.com
CategorySystem
Home pagehttp://biegunka.github.io/command-qq/
Source repositoryhead: git clone https://github.com/biegunka/command-qq
this: git clone https://github.com/biegunka/command-qq(tag 0.3.0.0)
UploadedWed Jun 4 17:22:19 UTC 2014 by MatveyAksenov
DistributionsNixOS:0.3.0.0
Downloads1985 total (47 in last 30 days)
Votes
0 []
StatusDocs available [build log]
Successful builds reported [all 1 reports]

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for command-qq-0.3.0.0

command-qq

Hackage Build Status Build Status

>>> import System.Command.QQ
>>> putStr =<< unlines . reverse . lines <$> [sh|cowsay "Hello, I am command-qq!"|]
                ||     ||
                ||----w |
            (__)\       )\/\
         \  (oo)\_______
        \   ^__^
 -------------------------
< Hello, I am command-qq! >
 _________________________

Install

% cabal install command-qq

Features

Quasiquotation syntax for external interpreters

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

Custom quasiquoters

ghci = quoter $ callCommand "ghc" ["-ignore-dot-ghci", "-e"]

Then you can use ghci in ghci!

>>> [ghci| putStrLn "hello world!" |] :: IO ()
hello world!

For more examples, see System.Command.QQ.Predef

Haskell values embedding

Let's define Embed instance for a custom data type:

data Bang = Bang

instance Embed Bang where
  embed Bang = "!"

Then you can use variables of Bang type in quoted strings!

>>> [sh_| echo hello#{Bang} |]
hello!
>>> let bang = Bang in [sh_| echo hello#{bang} |]
hello!

Note, command-qq does not support full Haskell in embeddings, only variables/constructors names and literals

DSLs

See examples/CommandT.hs