Copyright | (c) 2018-2022 Kowainik |
---|---|
License | MPL-2.0 |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Stability | Stable |
Portability | Portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- validateItems :: [TomlItem] -> Either ValidationError TOML
- data ValidationError
- groupItems :: [TomlItem] -> Forest TomlItem
- groupWithParent :: Maybe Key -> [TomlItem] -> (Forest TomlItem, [TomlItem])
- validateItemForest :: Forest TomlItem -> Either ValidationError TOML
Decoding
validateItems :: [TomlItem] -> Either ValidationError TOML Source #
data ValidationError Source #
Error that happens during validating TOML which is already syntactically correct. For the list of all possible validation errors and their explanation, see the following issue on GitHub:
Instances
Show ValidationError Source # | |
Defined in Toml.Parser.Validate showsPrec :: Int -> ValidationError -> ShowS # show :: ValidationError -> String # showList :: [ValidationError] -> ShowS # | |
Eq ValidationError Source # | |
Defined in Toml.Parser.Validate (==) :: ValidationError -> ValidationError -> Bool # (/=) :: ValidationError -> ValidationError -> Bool # |
Internal helpers
groupItems :: [TomlItem] -> Forest TomlItem Source #
This function takes flat list of TomlItem
s and groups it into list of
Tree
s by putting all corresponding items inside tables and table arrays. It
doesn't perform any validation, just groups items according to prefixes of their
keys. So, for example, if you have the following keys as flat list:
aaa # ordinary key aaa.bbb # ordinary key [foo] # table nam foo.bar foo.baz [xxx] # table name [xxx.yyy] # table name zzz
the following tree structure will be created:
aaa aaa.bbb [foo] ├──── foo.bar └──── foo.baz [xxx] └──── [yyy] └──── zzz