Data.Yaml.Parser

yaml-0.11.7.0: Support for parsing and rendering YAML documents.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Yaml.Parser

Description

drastically, or be entirely removed, in a future release.

# Documentation

newtype YamlParser a #

Constructors

YamlParser |
Fields unYamlParser :: AnchorMap -> Either Text a

#### Instances

Instances details

MonadFail YamlParser # |
Instance details Defined in Data.Yaml.Parser Methods fail :: String -> YamlParser a #
Alternative YamlParser # |
Instance details Defined in Data.Yaml.Parser Methods empty :: YamlParser a # (<|>) :: YamlParser a -> YamlParser a -> YamlParser a # some :: YamlParser a -> YamlParser [a] # many :: YamlParser a -> YamlParser [a] #
Applicative YamlParser # |
Instance details Defined in Data.Yaml.Parser Methods pure :: a -> YamlParser a # (<*>) :: YamlParser (a -> b) -> YamlParser a -> YamlParser b # liftA2 :: (a -> b -> c) -> YamlParser a -> YamlParser b -> YamlParser c # (*>) :: YamlParser a -> YamlParser b -> YamlParser b # (<*) :: YamlParser a -> YamlParser b -> YamlParser a #
Functor YamlParser # |
Instance details Defined in Data.Yaml.Parser Methods fmap :: (a -> b) -> YamlParser a -> YamlParser b # (<$) :: a -> YamlParser b -> YamlParser a #
Monad YamlParser # |
Instance details Defined in Data.Yaml.Parser Methods (>>=) :: YamlParser a -> (a -> YamlParser b) -> YamlParser b # (>>) :: YamlParser a -> YamlParser b -> YamlParser b # return :: a -> YamlParser a #
MonadPlus YamlParser # |
Instance details Defined in Data.Yaml.Parser Methods mzero :: YamlParser a # mplus :: YamlParser a -> YamlParser a -> YamlParser a #
Monoid (YamlParser a) # |
Instance details Defined in Data.Yaml.Parser Methods mempty :: YamlParser a # mappend :: YamlParser a -> YamlParser a -> YamlParser a # mconcat :: [YamlParser a] -> YamlParser a #
Semigroup (YamlParser a) # |
Instance details Defined in Data.Yaml.Parser Methods (<>) :: YamlParser a -> YamlParser a -> YamlParser a # sconcat :: NonEmpty (YamlParser a) -> YamlParser a # stimes :: Integral b => b -> YamlParser a -> YamlParser a #

lookupAnchor :: AnchorName -> YamlParser (Maybe YamlValue) #

withAnchor :: AnchorName -> Text -> (YamlValue -> YamlParser a) -> YamlParser a #

withMapping :: Text -> ([(Text, YamlValue)] -> YamlParser a) -> YamlValue -> YamlParser a #

withSequence :: Text -> ([YamlValue] -> YamlParser a) -> YamlValue -> YamlParser a #

withText :: Text -> (Text -> YamlParser a) -> YamlValue -> YamlParser a #

typeMismatch :: Text -> YamlValue -> YamlParser a #

class FromYaml a where #

Methods

fromYaml :: YamlValue -> YamlParser a #

#### Instances

Instances details

FromYaml Text # |
Instance details Defined in Data.Yaml.Parser Methods fromYaml :: YamlValue -> YamlParser Text #
FromYaml YamlValue # |
Instance details Defined in Data.Yaml.Parser Methods fromYaml :: YamlValue -> YamlParser YamlValue #
FromYaml Int # |
Instance details Defined in Data.Yaml.Parser Methods fromYaml :: YamlValue -> YamlParser Int #
FromYaml a => FromYaml [a] # |
Instance details Defined in Data.Yaml.Parser Methods fromYaml :: YamlValue -> YamlParser [a] #

data YamlValue #

Constructors

Mapping [(Text, YamlValue)] Anchor |
Sequence [YamlValue] Anchor |
Scalar ByteString Tag Style Anchor |
Alias AnchorName |

#### Instances

Instances details

Show YamlValue # |
Instance details Defined in Data.Yaml.Parser Methods showsPrec :: Int -> YamlValue -> ShowS # show :: YamlValue -> String # showList :: [YamlValue] -> ShowS #
FromYaml YamlValue # |
Instance details Defined in Data.Yaml.Parser Methods fromYaml :: YamlValue -> YamlParser YamlValue #

type AnchorMap = Map AnchorName YamlValue #

data RawDoc #

Constructors

RawDoc YamlValue AnchorMap |

#### Instances

Instances details

Show RawDoc # |
Instance details Defined in Data.Yaml.Parser Methods showsPrec :: Int -> RawDoc -> ShowS # show :: RawDoc -> String # showList :: [RawDoc] -> ShowS #

parseRawDoc :: (FromYaml a, MonadThrow m) => RawDoc -> m a #

(.:) :: FromYaml a => [(Text, YamlValue)] -> Text -> YamlParser a #

data YamlParseException #

Constructors

UnexpectedEndOfEvents |
UnexpectedEvent Event |
FromYamlException Text |

#### Instances

Instances details

Exception YamlParseException # |
Instance details Defined in Data.Yaml.Parser Methods toException :: YamlParseException -> SomeException # fromException :: SomeException -> Maybe YamlParseException # displayException :: YamlParseException -> String #
Show YamlParseException # |
Instance details Defined in Data.Yaml.Parser Methods showsPrec :: Int -> YamlParseException -> ShowS # show :: YamlParseException -> String # showList :: [YamlParseException] -> ShowS #

sinkValue :: MonadThrow m => ConduitM Event o (WriterT AnchorMap m) YamlValue #

sinkRawDoc :: MonadThrow m => ConduitM Event o m RawDoc #

readYamlFile :: FromYaml a => FilePath -> IO a #