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

Safe Haskell | None
Language | Haskell2010

Data.Yaml.Internal

Synopsis

- data ParseException
  - = NonScalarKey
  - | UnknownAlias {
    - _anchorName :: AnchorName
    }
  - | UnexpectedEvent {
    - _received :: Maybe Event
    - _expected :: Maybe Event
    }
  - | InvalidYaml (Maybe YamlException)
  - | MultipleDocuments
  - | AesonException String
  - | OtherParseException SomeException
  - | NonStringKey JSONPath
  - | NonStringKeyAlias AnchorName Value
  - | CyclicIncludes
  - | LoadSettingsException FilePath ParseException
- prettyPrintParseException :: ParseException -> String
- data Warning = DuplicateKey JSONPath
- parse :: ReaderT JSONPath (ConduitM Event o Parse) Value
- type Parse = StateT ParseState (ResourceT IO)
- decodeHelper :: FromJSON a => ConduitM () Event Parse () -> IO (Either ParseException ([Warning], Either String a))
- decodeHelper_ :: FromJSON a => ConduitM () Event Parse () -> IO (Either ParseException ([Warning], a))
- decodeAllHelper :: FromJSON a => ConduitM () Event Parse () -> IO (Either ParseException ([Warning], Either String [a]))
- decodeAllHelper_ :: FromJSON a => ConduitM () Event Parse () -> IO (Either ParseException ([Warning], [a]))
- textToScientific :: Text -> Either String Scientific
- stringScalar :: StringStyle -> Maybe Text -> Text -> Event
- type StringStyle = Text -> (Tag, Style)
- defaultStringStyle :: StringStyle
- isSpecialString :: Text -> Bool
- specialStrings :: HashSet Text
- isNumeric :: Text -> Bool
- objToStream :: ToJSON a => StringStyle -> a -> [Event]
- objToEvents :: ToJSON a => StringStyle -> a -> [Event] -> [Event]

# Documentation

data ParseException Source #

Constructors

NonScalarKey |
UnknownAlias |

Fields

- _anchorName :: AnchorName

UnexpectedEvent |

Fields

- _received :: Maybe Event
- _expected :: Maybe Event

InvalidYaml (Maybe YamlException) |
MultipleDocuments |
AesonException String |
OtherParseException SomeException |
NonStringKey JSONPath |
NonStringKeyAlias AnchorName Value |
CyclicIncludes |
LoadSettingsException FilePath ParseException |

#### Instances

Instances details

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

prettyPrintParseException :: ParseException -> String Source #

Alternative to `show` to display a `ParseException` on the screen. Instead of displaying the data constructors applied to their arguments, a more textual output is returned. For example, instead of printing:

    InvalidYaml (Just (YamlParseException {yamlProblem = "did not find expected ',' or '}'", yamlContext = "while parsing a flow mapping", yamlProblemMark = YamlMark {yamlIndex = 42, yamlLine = 2, yamlColumn = 12}})))

It looks more pleasant to print:

    YAML parse exception at line 2, column 12,
    while parsing a flow mapping:
    did not find expected ',' or '}'

Since 0.8.11

data Warning Source #

Constructors

DuplicateKey JSONPath |

#### Instances

Instances details

Show Warning Source # |
Instance details Defined in Data.Yaml.Internal Methods showsPrec :: Int -> Warning -> ShowS Source # show :: Warning -> String Source # showList :: [Warning] -> ShowS Source #
Eq Warning Source # |
Instance details Defined in Data.Yaml.Internal Methods (==) :: Warning -> Warning -> Bool Source # (/=) :: Warning -> Warning -> Bool Source #

parse :: ReaderT JSONPath (ConduitM Event o Parse) Value Source #

type Parse = StateT ParseState (ResourceT IO) Source #

decodeHelper :: FromJSON a => ConduitM () Event Parse () -> IO (Either ParseException ([Warning], Either String a)) Source #

decodeHelper_ :: FromJSON a => ConduitM () Event Parse () -> IO (Either ParseException ([Warning], a)) Source #

decodeAllHelper :: FromJSON a => ConduitM () Event Parse () -> IO (Either ParseException ([Warning], Either String [a])) Source #

decodeAllHelper_ :: FromJSON a => ConduitM () Event Parse () -> IO (Either ParseException ([Warning], [a])) Source #

textToScientific :: Text -> Either String Scientific Source #

stringScalar :: StringStyle -> Maybe Text -> Text -> Event Source #

Encodes a string with the supplied style. This function handles the empty string case properly to avoid https://github.com/snoyberg/yaml/issues/24

Since: 0.11.2.0

type StringStyle = Text -> (Tag, Style) Source #

defaultStringStyle :: StringStyle Source #

Since: 0.11.2.0

isSpecialString :: Text -> Bool Source #

Determine whether a string must be quoted in YAML and can't appear as plain text. Useful if you want to use `setStringStyle`.

Since: 0.10.2.0

specialStrings :: HashSet Text Source #

Strings which must be escaped so as not to be treated as non-string scalars.

Since: 0.8.32

isNumeric :: Text -> Bool Source #

Since: 0.8.32

objToStream :: ToJSON a => StringStyle -> a -> [Event] Source #

Encode a value as a YAML document stream.

Since: 0.11.2.0

objToEvents :: ToJSON a => StringStyle -> a -> [Event] -> [Event] Source #

Encode a value as a list of `Event`s.

Since: 0.11.2.0