match package:tomland

General function to create bidirectional converters for key-value pairs. In order to use this function you need to create TomlBiMap for your type and AnyValue:
_MyType :: TomlBiMap MyType AnyValue
And then you can create codec for your type using match function:
myType :: Key -> TomlCodec MyType
myType = match _MyType
Return both the result of a parse and a chunk of input that was consumed during parsing. This relies on the change of the stateOffset value to evaluate how many tokens were consumed. If you mess with it manually in the argument parser, prepare for troubles.
Extract list of elements of type a from array.
Extract Bool from Value.
Extract Day from Value.
Extract Double from Value.
Extract TimeOfDay from Value.
Extract Integer from Value.
Extract LocalTime from Value.
Extract Text from Value.
Extract ZonedTime from Value.
Value type mismatch error.
Bidirectional converter for sum types. For example, given the data type:
data Example
= Foo Int
| Bar Bool Int
the TOML codec will look like
matchFoo :: Example -> Maybe Int
matchFoo (Foo num) = Just num
matchFoo _         = Nothing

matchBar :: Example -> Maybe (Bool, Int)
matchBar (Bar b num) = Just (b, num)
matchBar _           = Nothing

barCodec :: TomlCodec (Bool, Int)
barCodec = Toml.pair
(Toml.bool "a")
(Toml.int "b")

exampleCodec :: TomlCodec Example
exampleCodec =
dimatch matchFoo Foo (Toml.int "foo")
<|> dimatch matchBar (uncurry Bar) (Toml.table barCodec "bar")
Helper function to create MatchError.
Data type that holds expected vs. actual type.