text-format-heavy-0.1.2.1: Full-weight string formatting library, analog of Python's string.format

Safe HaskellNone
LanguageHaskell2010

Data.Text.Format.Heavy.Types

Description

This module contains basic type definitions

Synopsis

Documentation

type VarName = Text Source #

Variable name

type VarFormat = Maybe Text Source #

Variable format in text form. Nothing means default format.

data FormatItem Source #

String format item.

Constructors

FString Text

Verbatim text

FVariable 

Fields

data Format Source #

String format

Constructors

Format [FormatItem] 

class (Default f, Show f) => IsVarFormat f where Source #

Can be used for different data types describing formats of specific types.

Minimal complete definition

parseVarFormat

Methods

parseVarFormat :: Text -> Either String f Source #

Left for errors.

Instances

class Formatable a where Source #

Value that can be formatted to be substituted into format string.

Minimal complete definition

formatVar

Methods

formatVar :: VarFormat -> a -> Either String Builder Source #

Format variable according to format specification. This function should usually parse format specification by itself.

data Variable Source #

Any variable that can be substituted. This type may be also used to construct heterogeneous lists: [Variable 1, Variable "x"] :: [Variable].

Constructors

Formatable a => Variable a 

formatAnyVar :: VarFormat -> Variable -> Either String Builder Source #

Format one variable according to format specification.

class VarContainer c where Source #

Data structure that contains some number of variables.

Minimal complete definition

lookupVar