command-qq: Quasiquoters for external commands

[ bsd2, library, system ] [ Propose Tags ] [ Report a vulnerability ]

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

See README.md for an example

  • DSLs

See examples/CommandT.hs


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.1.0, 0.2.2.0, 0.3.0.0, 0.3.1.0
Change log CHANGELOG.md
Dependencies base (>=4 && <5), process, template-haskell, text [details]
License BSD-2-Clause
Author Matvey Aksenov
Maintainer matvey.aksenov@gmail.com
Category System
Home page http://biegunka.github.io/command-qq/
Source repo head: git clone https://github.com/biegunka/command-qq
this: git clone https://github.com/biegunka/command-qq(tag 0.3.1.0)
Uploaded by MatveyAksenov at 2020-01-09T08:52:38Z
Distributions NixOS:0.3.1.0
Reverse Dependencies 3 direct, 0 indirect [details]
Downloads 5913 total (33 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-01-09 [all 1 reports]

Readme for command-qq-0.3.1.0

[back to package description]

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