hs-pkg-config-0.1.0.0: Create pkg-config configuration files

Copyright(c) 2014 Peter Trsko
LicenseBSD3
Maintainerpeter.trsko@gmail.com
Stabilityexperimental
PortabilityDeriveDataTypeable, DeriveGeneric, NoImplicitPrelude
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.PkgConfig.Internal.Template

Contents

Description

Simple string template used by pkg-config.

Synopsis

Template

type PkgTemplate = Template Source

Template consists of variables and literal strings. All special characters ('$', '#', '\' and end-of-line sequences) contained in literals are escaped when serialized.

newtype Template Source

Template is a possibly empty sequence of fragments represented by Fragment data type.

Constructors

Template [Fragment] 

Instances

data Fragment Source

Template fragment ca be either literal or variable. Literals are subject to escaping rules when serialized.

Constructors

Literal !Text 
Variable !Text 

Smart Constructors

var :: Text -> PkgTemplate Source

Construct variable fragment of template.

>>> var "prefix" <> lit "/bin"
$prefix/bin

lit :: Text -> PkgTemplate Source

Construct literal fragment of template. This is useful if language extension OverloadedStrings is not enabled.

>>> var "prefix" <> lit "/bin"
$prefix/bin

strLit :: String -> PkgTemplate Source

Create PkgTemplate literal from String by packing it in to strict Text first.

singletonLit :: Char -> PkgTemplate Source

Crate one character long PkgTemplate literal.

Serialize

Serialize Template

toLazyText :: Template -> Text Source

Serialize template in to lazy Text.

toStrictText :: Template -> Text Source

Serialize template in to strict Text.

toTextBuilder :: Template -> Builder Source

Serialize template in to Builder.

Serialize Fragment

fragmentToBuilder :: Fragment -> Builder Source

Serialize fragment in to Builder.

fragmentToStrictText :: Fragment -> Text Source

Serialize fragment in to strict Text. For literals function performs escaping of special characters.

Query Template

variables :: PkgTemplate -> [Text] Source

List all variables mentioned in PkgTemplate.