prosidyc-0.3.0.0: A DSL for processing Prosidy documents.
Copyright©2020 James Alexander Feldman-Crough
LicenseMPL-2.0
Maintaineralex@fldcr.com
Safe HaskellNone
LanguageHaskell2010

Prosidy.Compile.DSL

Description

 
Synopsis

Documentation

content :: RegionLike t => Rules (Content t) f a -> Rules t f a Source #

Access the inner content of the RegionLike value t.

Series rules

(&>) :: Rules t f a -> Rules (Series t) f (Series a) -> Rules (Series t) f (Series a) infixr 3 Source #

Given a Series, perform the rule on the left hand side on the first element of the Series, and the rule on the right hand side on all items after the first.

This can be used to define rules which must be evaluated sequentially.

(&>>) :: Rules t f a -> Rules (Series t) f (Series a) -> Rules (SeriesNE t) f (SeriesNE a) infixr 1 Source #

Like (&>), but returns a combined rule which operates on a non-empty series (SeriesNE).

folded :: Monoid a => Rules t f a -> Rules (Series t) f a Source #

Lift a rule to operate on a Series by folding the results of evaluation against each element into a single result.

folded1 :: Monoid a => Rules t f a -> Rules (SeriesNE t) f a Source #

Like folded, but operates on a non-empty series.

collect :: Rules t f a -> Rules (Series t) f (Series a) Source #

Lift a rule to collect many of that rule in series

end :: Rules (Series t) f (Series a) Source #

Match the end of a Series.

endWith :: a -> Rules (Series t) f a Source #

Match the end of a Series, returning the provided value.

Metadata rules

prop :: RegionLike t => Key -> Rules t f Bool Source #

Check if a Metadata property is set on a node.

req :: forall a t f. (RegionLike t, FromSetting a) => Key -> Rules t f a Source #

Fetch a required Metadata setting from a node.

opt :: forall a t f. (RegionLike t, FromSetting a) => Key -> Rules t f (Maybe a) Source #

Fetch an optional Metadata setting from a node.

lax :: RegionLike t => Rules t f () Source #

Allow unknown properties and settings in this region.

Matchers

type Match t f a = MatchM t f a () Source #

A type used to declare alternatives in do notation.

match :: Match t f a -> Rules t f a Source #

Lifts a Match into Rules by trying each defined pattern, from top to bottom, until a match is found.

blockTag :: Functor f => Key -> Rules BlockRegion f a -> Match Block f a Source #

Match a BlockTag with the proided Key.

inlineTag :: Functor f => Key -> Rules InlineRegion f a -> Match Inline f a Source #

Match a InlineTag with the provided Key.

literalTag :: Functor f => Key -> Rules LiteralRegion f a -> Match Block f a Source #

Match a LiteralTag with the provided Key.

paragraph :: Rules (SeriesNE Inline) f a -> Match Block f a Source #

Match a paragraph which is not enclosed in a tag.

text :: (Text -> a) -> Match Inline f a Source #

Match textual content, transforming it with the provided function.

breakWith :: a -> Match Inline f a Source #

Replace inline breaks with the provided vlaue.

Get wild with actions

local :: Functor f => f a -> Rules t f a Source #

Lift a contextual item into Rules.

self :: Rules t f t Source #

Get the currently focused node as a value.

hoist :: HoistRuleFor t => (forall b. f b -> g b) -> Rules t f a -> Rules t g a Source #

Map over the contextual functor f in Rules.

Convenience classes

class FromSetting a where Source #

A class for values which can be parsed from Text.

Minimal complete definition

Nothing

Instances

Instances details
FromSetting Double Source # 
Instance details

Defined in Prosidy.Compile.DSL

FromSetting Float Source # 
Instance details

Defined in Prosidy.Compile.DSL

FromSetting Int Source # 
Instance details

Defined in Prosidy.Compile.DSL

FromSetting Integer Source # 
Instance details

Defined in Prosidy.Compile.DSL

FromSetting Natural Source # 
Instance details

Defined in Prosidy.Compile.DSL

FromSetting Word Source # 
Instance details

Defined in Prosidy.Compile.DSL

FromSetting String Source # 
Instance details

Defined in Prosidy.Compile.DSL

FromSetting Text Source # 
Instance details

Defined in Prosidy.Compile.DSL

FromSetting Text Source # 
Instance details

Defined in Prosidy.Compile.DSL

class HasContent t => RegionLike t Source #

A class for recursive nodes in a document.

Minimal complete definition

liftRegionRule

Instances

Instances details
RegionLike Document Source # 
Instance details

Defined in Prosidy.Compile.DSL

Methods

liftRegionRule :: forall (f :: Type -> Type) a. RegionRule (Content Document) f a -> RuleFor Document f a

RegionLike (Region t) Source # 
Instance details

Defined in Prosidy.Compile.DSL

Methods

liftRegionRule :: forall (f :: Type -> Type) a. RegionRule (Content (Region t)) f a -> RuleFor (Region t) f a

RegionLike (Tag t) Source # 
Instance details

Defined in Prosidy.Compile.DSL

Methods

liftRegionRule :: forall (f :: Type -> Type) a. RegionRule (Content (Tag t)) f a -> RuleFor (Tag t) f a