shell-monad-0.5.0: shell monad

Safe HaskellNone
LanguageHaskell98

Control.Monad.Shell.Quote

Description

Shell quoting

Synopsis

Documentation

newtype Quoted a Source

A value that is safely quoted so that it can be exposed to the shell.

While the constructor is exposed, you should avoid directly constucting Quoted values. Instead, use quote.

Constructors

Q 

Fields

getQ :: a
 

Instances

Eq a => Eq (Quoted a) 
Ord a => Ord (Quoted a) 
Show a => Show (Quoted a) 
Monoid a => Monoid (Quoted a) 
Param (Quoted Text)

Quoted Text arguments are passed as-is.

class Quotable t where Source

Quotes a value to allow it to be safely exposed to the shell.

The method used is to replace ' with '"'"' and wrap the value inside single quotes. This works for POSIX shells, as well as other shells like csh.

Methods

quote :: t -> Quoted Text Source

Instances

Quotable String 
Quotable Text 
Quotable (Val String) 
Show v => Quotable (Val v)

Any Showable value can be quoted, just use 'quote (Val v)'

Quotable (Val Text) 

newtype Val v Source

An arbitrary value.

Constructors

Val v 

Instances

Quotable (Val String) 
Show v => Quotable (Val v)

Any Showable value can be quoted, just use 'quote (Val v)'

Quotable (Val Text) 
Show v => Param (Val v)

Any value that can be shown can be passed to cmd; just wrap it inside a Val.