| 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 |
Toml.Codec.BiMap.Conversion
Description
Implementations of BiMap for specific Haskell types and TOML
values. Usually, you use codecs from the Toml.Codec.Combinator module.
You may need to use these BiMaps instead of codecs in the
following situations:
- When using
arrayOfcombinator (or similar). - When using
tableMapcombinator (for keys). - When implementing custom
BiMapfor your types.
Since: 1.3.0.0
Synopsis
- _Bool :: TomlBiMap Bool AnyValue
- _Int :: TomlBiMap Int AnyValue
- _Word :: TomlBiMap Word AnyValue
- _Word8 :: TomlBiMap Word8 AnyValue
- _Integer :: TomlBiMap Integer AnyValue
- _Natural :: TomlBiMap Natural AnyValue
- _Double :: TomlBiMap Double AnyValue
- _Float :: TomlBiMap Float AnyValue
- _Text :: TomlBiMap Text AnyValue
- _LText :: TomlBiMap Text AnyValue
- _ByteString :: TomlBiMap ByteString AnyValue
- _LByteString :: TomlBiMap ByteString AnyValue
- _String :: TomlBiMap String AnyValue
- _ZonedTime :: TomlBiMap ZonedTime AnyValue
- _LocalTime :: TomlBiMap LocalTime AnyValue
- _Day :: TomlBiMap Day AnyValue
- _TimeOfDay :: TomlBiMap TimeOfDay AnyValue
- _Array :: forall a. TomlBiMap a AnyValue -> TomlBiMap [a] AnyValue
- _NonEmpty :: TomlBiMap a AnyValue -> TomlBiMap (NonEmpty a) AnyValue
- _Set :: Ord a => TomlBiMap a AnyValue -> TomlBiMap (Set a) AnyValue
- _HashSet :: Hashable a => TomlBiMap a AnyValue -> TomlBiMap (HashSet a) AnyValue
- _IntSet :: TomlBiMap IntSet AnyValue
- _ByteStringArray :: TomlBiMap ByteString AnyValue
- _LByteStringArray :: TomlBiMap ByteString AnyValue
- _Coerce :: Coercible a b => TomlBiMap a AnyValue -> TomlBiMap b AnyValue
- _EnumBounded :: (Show a, Enum a, Bounded a) => TomlBiMap a AnyValue
- _Read :: (Show a, Read a) => TomlBiMap a AnyValue
- _TextBy :: forall a. (a -> Text) -> (Text -> Either Text a) -> TomlBiMap a AnyValue
- _Validate :: forall a. (a -> Either Text a) -> TomlBiMap a AnyValue -> TomlBiMap a AnyValue
- _Hardcoded :: forall a. (Show a, Eq a) => a -> TomlBiMap a a
- _KeyText :: TomlBiMap Key Text
- _KeyString :: TomlBiMap Key String
- _KeyInt :: TomlBiMap Key Int
- _Just :: Show r => TomlBiMap (Maybe r) r
- _Left :: (Show l, Show r) => TomlBiMap (Either l r) l
- _Right :: (Show l, Show r) => TomlBiMap (Either l r) r
- _LTextText :: BiMap e Text Text
- _NaturalInteger :: TomlBiMap Natural Integer
- _NonEmptyList :: TomlBiMap (NonEmpty a) [a]
- _StringText :: BiMap e String Text
- _ReadString :: (Show a, Read a) => TomlBiMap a String
- _BoundedInteger :: (Integral a, Bounded a, Show a) => TomlBiMap a Integer
- _EnumBoundedText :: forall a. (Show a, Enum a, Bounded a) => TomlBiMap a Text
- _ByteStringText :: TomlBiMap ByteString Text
- _LByteStringText :: TomlBiMap ByteString Text
Primitive
Boolean
Integral
Floating
Text
_ByteString :: TomlBiMap ByteString AnyValue Source #
UTF-8 encoded ByteString BiMap for AnyValue.
Usually used as the byteString combinator.
Since: 0.5.0
_LByteString :: TomlBiMap ByteString AnyValue Source #
UTF-8 encoded lazy ByteString BiMap for AnyValue.
Usually used as the lazyByteString combinator.
Since: 0.5.0
Time
Arrays
_NonEmpty :: TomlBiMap a AnyValue -> TomlBiMap (NonEmpty a) AnyValue Source #
Takes a BiMap of a value and returns a BiMap for a NonEmpty
list of values and AnyValue as an array. Usually used as the
arrayNonEmptyOf combinator.
Since: 0.5.0
_Set :: Ord a => TomlBiMap a AnyValue -> TomlBiMap (Set a) AnyValue Source #
Takes a BiMap of a value and returns a BiMap for a Set of
values and AnyValue as an array. Usually used as the
arraySetOf combinator.
Since: 0.5.0
_HashSet :: Hashable a => TomlBiMap a AnyValue -> TomlBiMap (HashSet a) AnyValue Source #
Takes a BiMap of a value and returns a BiMap for a HashSet of
values and AnyValue as an array. Usually used as the
arrayHashSetOf combinator.
Since: 0.5.0
_IntSet :: TomlBiMap IntSet AnyValue Source #
IntSet bimap for AnyValue. Usually used as the
arrayIntSet combinator.
Since: 0.5.0
_ByteStringArray :: TomlBiMap ByteString AnyValue Source #
ByteString BiMap for AnyValue encoded as a list of bytes
(non-negative integers between 0 and 255). Usually used as the
byteStringArray combinator.
Since: 1.2.0.0
_LByteStringArray :: TomlBiMap ByteString AnyValue Source #
Lazy ByteString BiMap for AnyValue encoded as a list of
bytes (non-negative integers between 0 and 255). Usually used as
lazyByteStringArray combinator.
Since: 1.2.0.0
Coerce
Custom
_EnumBounded :: (Show a, Enum a, Bounded a) => TomlBiMap a AnyValue Source #
BiMap for nullary sum data types (enumerations) with Show,
Enum and Bounded instances. Usually used as the
enumBounded combinator.
Since: 1.1.0.0
_Validate :: forall a. (a -> Either Text a) -> TomlBiMap a AnyValue -> TomlBiMap a AnyValue Source #
By the given BiMap validates it with the given predicate that returns
Either the value, if the validation is successful, or the Value of the error
that should be returned in case of validation failure.
Usually used as the validate or
validateIf combinator.
Since: 1.3.0.0
_Hardcoded :: forall a. (Show a, Eq a) => a -> TomlBiMap a a Source #
BiMap for hardcoded values.
It returns the same value in case of success and ArbitraryError in other case.
Since: 1.3.2.0
Keys
_KeyInt :: TomlBiMap Key Int Source #
Bidirectional converter between Key and Int. Usually used
as an argument for tableIntMap.
Since: 1.3.0.0
General purpose
Internal helpers
_NonEmptyList :: TomlBiMap (NonEmpty a) [a] Source #
_EnumBoundedText :: forall a. (Show a, Enum a, Bounded a) => TomlBiMap a Text Source #
Helper BiMap for _EnumBounded and Text.
Since: 1.1.0.0
_ByteStringText :: TomlBiMap ByteString Text Source #
Helper BiMap for Text and strict ByteString
Since: 0.5.0
_LByteStringText :: TomlBiMap ByteString Text Source #
Helper BiMap for Text and lazy ByteString.
Since: 0.5.0