tomland-1.3.3.2: Bidirectional TOML serialization
Copyright(c) 2018-2022 Kowainik
LicenseMPL-2.0
MaintainerKowainik <xrom.xkov@gmail.com>
StabilityStable
PortabilityPortable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Toml.Type.AnyValue

Contents

Description

Existential wrapper over Value type and matching functions.

Since: 0.0.0

Synopsis

Documentation

data AnyValue Source #

Existential wrapper for Value.

Since: 0.0.0

Constructors

forall (t :: TValue). AnyValue (Value t) 

Instances

Instances details
Show AnyValue Source # 
Instance details

Defined in Toml.Type.AnyValue

NFData AnyValue Source # 
Instance details

Defined in Toml.Type.AnyValue

Methods

rnf :: AnyValue -> () #

Eq AnyValue Source # 
Instance details

Defined in Toml.Type.AnyValue

reifyAnyValues :: Value t -> [AnyValue] -> Either TypeMismatchError [Value t] Source #

Checks whether all elements inside given list of AnyValue have the same type as given Value. Returns list of Value t without given Value.

toMArray :: [AnyValue] -> Either MatchError (Value 'TArray) Source #

Function for creating Array from list of AnyValue.

Matching

data MatchError Source #

Value type mismatch error.

Constructors

MatchError 

Instances

Instances details
Generic MatchError Source # 
Instance details

Defined in Toml.Type.AnyValue

Associated Types

type Rep MatchError :: Type -> Type #

Show MatchError Source # 
Instance details

Defined in Toml.Type.AnyValue

NFData MatchError Source # 
Instance details

Defined in Toml.Type.AnyValue

Methods

rnf :: MatchError -> () #

Eq MatchError Source # 
Instance details

Defined in Toml.Type.AnyValue

type Rep MatchError Source # 
Instance details

Defined in Toml.Type.AnyValue

type Rep MatchError = D1 ('MetaData "MatchError" "Toml.Type.AnyValue" "tomland-1.3.3.2-JRrBhNpiCh26pzVBpYNNR0" 'False) (C1 ('MetaCons "MatchError" 'PrefixI 'True) (S1 ('MetaSel ('Just "valueExpected") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TValue) :*: S1 ('MetaSel ('Just "valueActual") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 AnyValue)))

mkMatchError :: TValue -> Value t -> Either MatchError a Source #

Helper function to create MatchError.

matchArray :: (AnyValue -> Either MatchError a) -> Value t -> Either MatchError [a] Source #

Extract list of elements of type a from array.

applyAsToAny :: (AnyValue -> r) -> Value t -> r Source #

Make function that works with AnyValue also work with specific Value.