Moduletomland-1.3.3.3Haskell2010
Toml.Codec.Types
SPDX-License-Identifier : MPL-2.0 Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable
Contains general underlying monad for bidirectional conversion.
- 4 types
- 2 values
- Packagetomland-1.3.3.3
- Exports6
- LanguageHaskell2010
- LicenceMPL-2.0
- SourceTypes.hs
Toml Codec
1 declarationToml Environment
1 declarationImmutable environment for TOML conversion.
Toml State
2 declarationsMutable context for TOML conversion. We are introducing our own implemetation of state with MonadState instance due to some limitation in the design connected to the usage of State.
This newtype is equivalent to the following transformer:
MaybeT (State TOML)
Constructors
TomlStateunTomlState :: TOML -> (Maybe a, TOML)
Instances5Monad, Functor, Applicative, Alternative, MonadState
Monad TomlStateDefined in tomland-1.3.3.3 · Toml.Codec.TypesFunctor TomlStateDefined in tomland-1.3.3.3 · Toml.Codec.TypesApplicative TomlStateDefined in tomland-1.3.3.3 · Toml.Codec.TypesAlternative TomlStateDefined in tomland-1.3.3.3 · Toml.Codec.Typess ~ TOML => MonadState s TomlStateDefined in tomland-1.3.3.3 · Toml.Codec.Types
Codec
1 declarationMonad for bidirectional conversion. Contains pair of functions:
How to read value of type
o(out) from immutable environment context (TomlEnv)?How to store a value of type
i(in) in stateful context (TomlState) and return a value of typeo?
This approach with the bunch of utility functions allows to
have single description for from/to TOML conversion.
In practice this type will always be used in the following way:
type TomlCodec a = Codec a a
Type parameter i if fictional. Here some trick is used. This trick is
implemented in the codec package and
described in more details in related blog post:
https://blog.poisson.chat/posts/2016-10-12-bidirectional-serialization.html.
Constructors
Instances3Functor, Applicative, Alternative
Functor (Codec i)Defined in tomland-1.3.3.3 · Toml.Codec.TypesApplicative (Codec i)Defined in tomland-1.3.3.3 · Toml.Codec.TypesAlternative (Codec i)Defined in tomland-1.3.3.3 · Toml.Codec.Types
Function alternative
1 declarationAlternative instance for function arrow but without empty.