Copyright | ©2020 James Alexander Feldman-Crough |
---|---|
License | MPL-2.0 |
Maintainer | alex@fldcr.com |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- type Match i e f a = MatchM i e a f ()
- data MatchM i e a f r
- match :: (Applicative f, CanMatch i) => Match i e f a -> RuleT i e f a
- break :: RuleT () e f a -> Match Inline e f a
- breakWith :: a -> Match Inline e f a
- paragraph :: RuleT (SeriesNE Inline) e f a -> Match Block e f a
- text :: RuleT Text e f a -> Match Inline e f a
- blockTag :: Applicative f => Key -> RuleT BlockRegion e f a -> Match Block e f a
- inlineTag :: Applicative f => Key -> RuleT InlineRegion e f a -> Match Inline e f a
- literalTag :: Applicative f => Key -> RuleT LiteralRegion e f a -> Match Block e f a
- blockTag' :: Key -> RuleT BlockRegion e f a -> Match Block e f a
- inlineTag' :: Key -> RuleT InlineRegion e f a -> Match Inline e f a
- literalTag' :: Key -> RuleT LiteralRegion e f a -> Match Block e f a
DSL for matching cases
data MatchM i e a f r Source #
A monadic interface for defining fallible patterns. In practice, r
will
always be instantiated to ()
— Match
can be more clear.
Instances
Monad (MatchM i e a f) Source # | |
Functor (MatchM i e a f) Source # | |
Applicative (MatchM i e a f) Source # | |
Defined in Prosidy.Compile.Match pure :: a0 -> MatchM i e a f a0 # (<*>) :: MatchM i e a f (a0 -> b) -> MatchM i e a f a0 -> MatchM i e a f b # liftA2 :: (a0 -> b -> c) -> MatchM i e a f a0 -> MatchM i e a f b -> MatchM i e a f c # (*>) :: MatchM i e a f a0 -> MatchM i e a f b -> MatchM i e a f b # (<*) :: MatchM i e a f a0 -> MatchM i e a f b -> MatchM i e a f a0 # |
match :: (Applicative f, CanMatch i) => Match i e f a -> RuleT i e f a Source #
Finalize a Match
into a rule. This is often used to offset a match
block:
blocktags :: Match Block Void Identity String blocktags = match $ do ...
Specific matchers
paragraph :: RuleT (SeriesNE Inline) e f a -> Match Block e f a Source #
Match Paragraph
s in a block context.
Tag matchers which strictly enforce metadata.
blockTag :: Applicative f => Key -> RuleT BlockRegion e f a -> Match Block e f a Source #
inlineTag :: Applicative f => Key -> RuleT InlineRegion e f a -> Match Inline e f a Source #
literalTag :: Applicative f => Key -> RuleT LiteralRegion e f a -> Match Block e f a Source #
Strict: match an LiteralTag
with the given Key
.
Tag matchers which loosely enforce metadata.
inlineTag' :: Key -> RuleT InlineRegion e f a -> Match Inline e f a Source #
literalTag' :: Key -> RuleT LiteralRegion e f a -> Match Block e f a Source #
Lax: match an LiteralTag
with the given Key
.