Trial.Tomland

trial-tomland-0.0.0.0: Trial helper functions for tomland

Copyright | (c) 2020 Kowainik
License | MPL-2.0
Maintainer | Kowainik <xrom.xkov@gmail.com>
Safe Haskell | None
Language | Haskell2010

Trial.Tomland

Description

Trial helpers for `tomland`.

Synopsis

- trialCodec :: e -> TomlCodec a -> TomlCodec (Trial e a)
- trialStrCodec :: (IsString e, Semigroup e) => (Key -> TomlCodec a) -> Key -> TomlCodec (Trial e a)
- trialMaybeCodec :: TomlCodec a -> TomlCodec (Trial e (Maybe a))
- taggedTrialCodec :: tag -> (Key -> TomlCodec a) -> Key -> TomlCodec (TaggedTrial tag a)
- taggedTrialStrCodec :: (IsString tag, Semigroup tag) => (Key -> TomlCodec a) -> Key -> TomlCodec (TaggedTrial tag a)
- taggedTrialMaybeCodec :: IsString e => TomlCodec a -> TomlCodec (TaggedTrial e (Maybe a))
- taggedTrialListCodec :: (IsString e, Semigroup e) => Key -> TomlCodec a -> TomlCodec (TaggedTrial e [a])

# Documentation

trialCodec :: e -> TomlCodec a -> TomlCodec (Trial e a) #

`TomlCodec` for `Trial` that adds a given event `e` if a given codec fails.

Since: 0.0.0.0

trialStrCodec :: (IsString e, Semigroup e) => (Key -> TomlCodec a) -> Key -> TomlCodec (Trial e a) #

`TomlCodec` for `Trial` that adds an informative message if a given codec fails.

Since: 0.0.0.0

trialMaybeCodec :: TomlCodec a -> TomlCodec (Trial e (Maybe a)) #

`TomlCodec` for `Maybe` inside `Trial`. Never fails, doesn't change history of events.

Since: 0.0.0.0

taggedTrialCodec :: tag -> (Key -> TomlCodec a) -> Key -> TomlCodec (TaggedTrial tag a) #

`TomlCodec` for `TaggedTrial` that uses given `tag` in a `Fiasco` if a given codec fails, and also adds `tag` to the result.

Since: 0.0.0.0

taggedTrialStrCodec :: (IsString tag, Semigroup tag) => (Key -> TomlCodec a) -> Key -> TomlCodec (TaggedTrial tag a) #

`TomlCodec` for `TaggedTrial` that adds an informative message if a given codec fails, and also adds a tag where the field comes from.

Since: 0.0.0.0

taggedTrialMaybeCodec :: IsString e => TomlCodec a -> TomlCodec (TaggedTrial e (Maybe a)) #

`TomlCodec` for `Maybe` inside `TaggedTrial`. Never fails, doesn't change history of events, and adds a tag.

Since: 0.0.0.0

taggedTrialListCodec :: (IsString e, Semigroup e) => Key -> TomlCodec a -> TomlCodec (TaggedTrial e [a]) #

`TomlCodec` that decodes with `list` and adds `fiasco` to the result if the resulting list is empty. It's helpful to handle the case when the list is not specified at all.

Since: 0.0.0.0