| Copyright | (c) 2018-2021 Kowainik |
|---|---|
| License | MPL-2.0 |
| Maintainer | Kowainik <xrom.xkov@gmail.com> |
| Stability | Stable |
| Portability | Portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Toml.Codec.Combinator.Common
Description
This module implements common utilities for writing custom codecs without diving into internal implementation details. Most of the time you don't need to implement your own codecs and can reuse existing ones. But if you need something that library doesn't provide, you can find functions in this module useful.
Since: 1.3.0.0
Synopsis
- match :: forall a. TomlBiMap a AnyValue -> Key -> TomlCodec a
- whenLeftBiMapError :: Key -> Either TomlBiMapError a -> (a -> Validation [TomlDecodeError] b) -> Validation [TomlDecodeError] b
Documentation
match :: forall a. TomlBiMap a AnyValue -> Key -> TomlCodec a Source #
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 ::TomlBiMapMyTypeAnyValue
And then you can create codec for your type using match function:
myType ::Key->TomlCodecMyType myType =match_MyType
Since: 0.4.0
whenLeftBiMapError :: Key -> Either TomlBiMapError a -> (a -> Validation [TomlDecodeError] b) -> Validation [TomlDecodeError] b Source #