nyan-interpolation-core-0.9.0.1: Customize your nyan interpolator!
Safe HaskellNone
LanguageHaskell2010

Text.Interpolation.Nyan.Core.Internal.Base

Synopsis

Documentation

import Data.Text
import Data.Text.Lazy

Interpolation data

data IntData Source #

Information about single piece that is to be interpolated.

Constructors

IntData 

Fields

  • idMode :: Text

    How to use the value in the braces. This is some text before the brances, usually one letter or nothing.

  • idCode :: Text

    The inserted code. This is what appears in braces.

Instances

Instances details
Eq IntData Source # 
Instance details

Defined in Text.Interpolation.Nyan.Core.Internal.Base

Methods

(==) :: IntData -> IntData -> Bool #

(/=) :: IntData -> IntData -> Bool #

Show IntData Source # 
Instance details

Defined in Text.Interpolation.Nyan.Core.Internal.Base

data ParsedIntPiece Source #

Piece of interpolation string.

Constructors

PipString Text

Mere text.

PipNewline Text

Some line feed. This must be preferred over PipString.

PipLeadingWs Word

Whitespaces at the beginning of the line. This must be preferred over PipString.

PipEmptyLine

Line without any text. The line feed is not included here. This must be preferred over PipLeadingWs.

PipInt IntData

Interpolator piece.

data IntPiece Source #

Finalized piece of interpolation string.

Constructors

IpString Text

Mere text.

IpInt IntData

Interpolator piece.

Instances

Instances details
Eq IntPiece Source # 
Instance details

Defined in Text.Interpolation.Nyan.Core.Internal.Base

Show IntPiece Source # 
Instance details

Defined in Text.Interpolation.Nyan.Core.Internal.Base

Switches

data ReturnType Source #

Return type of the interpolator.

data PreviewLevel Source #

Requested preview level.

Constructors

PreviewNone

Do nothing special.

PreviewExact

Print the resulting text as-is (without substitutions).

PreviewInvisible

Print the text, replacing invisible characters with special symbols.

data DefaultSwitchesOptions Source #

Default switches options set in the interpolator, those that are used in [int||...|].

When no default value for a switch is specified, this switch is left mandatory for specifying in the interpolator.

basicDefaultSwitchesOptions :: DefaultSwitchesOptions Source #

Default DefaultSwitchesOptions.

This set of switches tries to leave the text as much unmodified as possible.

It does not define default switches used by Text.Interpolation.Nyan module, and you will likely want to enable at least some options here.

recommendedDefaultSwitchesOptions :: DefaultSwitchesOptions Source #

DefaultSwitchesOptions used in the Text.Interpolation.Nyan module in the default interpolator.

newtype ValueInterpolator Source #

How to expand values in #{} into Haskell AST.

Constructors

ValueInterpolator 

data InterpolatorOptions Source #

Options set when creating an interpolator.

Constructors

InterpolatorOptions 

Fields

  • defaultSwitchesOptions :: DefaultSwitchesOptions

    Default switches options.

  • valueInterpolator :: ValueInterpolator

    Expands text in #{} into AST.

    We have to leave this changeable because there is no "perfect" expander. Using the most appropriate one would require relying on haskell-src-exts package which is quite a heavy-weight dependency. Some users would prefer a simpler solution which would only allow variables in #{}.

    Interpreting the passed text in tricky ways is valid. For instance, for specialized interpolators #{var} could be expanded to local'var, view varLens, or more complex Haskell code.

  • invisibleCharsPreview :: InvisibleCharsPreview

    In case, when the switches are set to preview the resulting text with invisibles being marked specially (!!), how to update the pieces of text.