| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Data.Markup.Warn
Description
Warning helpers for markup parsing.
Synopsis
- data MarkupWarning
- data ParserWarning
- type Warn a = These [MarkupWarning] a
- warnError :: Warn a -> a
- warnEither :: Warn a -> Either [MarkupWarning] a
- warnMaybe :: Warn a -> Maybe a
- showWarnings :: [MarkupWarning] -> String
- concatWarns :: [Warn [a]] -> Warn [a]
Documentation
data MarkupWarning Source #
markup-parse generally tries to continue on parse errors, and return what has/can still be parsed, together with any warnings.
Constructors
| BadEmptyElemTag | A tag ending with "/>" that is not an element of |
| SelfCloserWithChildren | A tag ending with "/>" that has children. Cannot happen in the parsing phase. |
| LeafWithChildren | Only a |
| TagMismatch NameTag NameTag | A CloseTag with a different name to the currently open StartTag. |
| UnmatchedEndTag | An EndTag with no corresponding StartTag. |
| UnclosedTag | An StartTag with no corresponding EndTag. |
| EndTagInTree | An EndTag should never appear in |
| EmptyContent | Empty Content, Comment, Decl or Doctype |
| BadDecl | Badly formed declaration |
| MarkupParser ParserWarning |
Instances
data ParserWarning Source #
Warnings originating in the stream/token parser.
Constructors
| ParserLeftover String | |
| ParserError String | |
| ParserUncaught |
Instances
| Eq ParserWarning Source # | |||||
Defined in Data.Markup.Warn Methods (==) :: ParserWarning -> ParserWarning -> Bool # (/=) :: ParserWarning -> ParserWarning -> Bool # | |||||
| Ord ParserWarning Source # | |||||
Defined in Data.Markup.Warn Methods compare :: ParserWarning -> ParserWarning -> Ordering # (<) :: ParserWarning -> ParserWarning -> Bool # (<=) :: ParserWarning -> ParserWarning -> Bool # (>) :: ParserWarning -> ParserWarning -> Bool # (>=) :: ParserWarning -> ParserWarning -> Bool # max :: ParserWarning -> ParserWarning -> ParserWarning # min :: ParserWarning -> ParserWarning -> ParserWarning # | |||||
| Data ParserWarning Source # | |||||
Defined in Data.Markup.Warn Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ParserWarning -> c ParserWarning # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ParserWarning # toConstr :: ParserWarning -> Constr # dataTypeOf :: ParserWarning -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ParserWarning) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ParserWarning) # gmapT :: (forall b. Data b => b -> b) -> ParserWarning -> ParserWarning # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ParserWarning -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ParserWarning -> r # gmapQ :: (forall d. Data d => d -> u) -> ParserWarning -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ParserWarning -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ParserWarning -> m ParserWarning # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ParserWarning -> m ParserWarning # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ParserWarning -> m ParserWarning # | |||||
| Generic ParserWarning Source # | |||||
Defined in Data.Markup.Warn Associated Types
| |||||
| Show ParserWarning Source # | |||||
Defined in Data.Markup.Warn Methods showsPrec :: Int -> ParserWarning -> ShowS # show :: ParserWarning -> String # showList :: [ParserWarning] -> ShowS # | |||||
| type Rep ParserWarning Source # | |||||
Defined in Data.Markup.Warn type Rep ParserWarning = D1 ('MetaData "ParserWarning" "Data.Markup.Warn" "markup-parse-0.3.0.0-inplace" 'False) (C1 ('MetaCons "ParserLeftover" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: (C1 ('MetaCons "ParserError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "ParserUncaught" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
type Warn a = These [MarkupWarning] a Source #
A type synonym for the common returning type of many functions. A common computation pipeline is to take advantage of the These Monad instance eg
markup s bs = bs & (tokenize s >=> gather s) & second (Markup s)
warnEither :: Warn a -> Either [MarkupWarning] a Source #
Returns Left on any warnings
showWarnings :: [MarkupWarning] -> String Source #
concatWarns :: [Warn [a]] -> Warn [a] Source #