tomland-1.3.3.0: Bidirectional TOML serialization
Copyright(c) 2018-2021 Kowainik
LicenseMPL-2.0
MaintainerKowainik <xrom.xkov@gmail.com>
StabilityStable
PortabilityPortable
Safe HaskellNone
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
Eq AnyValue Source # 
Instance details

Defined in Toml.Type.AnyValue

Show AnyValue Source # 
Instance details

Defined in Toml.Type.AnyValue

NFData AnyValue Source # 
Instance details

Defined in Toml.Type.AnyValue

Methods

rnf :: 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
Eq MatchError Source # 
Instance details

Defined in Toml.Type.AnyValue

Show MatchError Source # 
Instance details

Defined in Toml.Type.AnyValue

Generic MatchError Source # 
Instance details

Defined in Toml.Type.AnyValue

Associated Types

type Rep MatchError :: Type -> Type #

NFData MatchError Source # 
Instance details

Defined in Toml.Type.AnyValue

Methods

rnf :: MatchError -> () #

type Rep MatchError Source # 
Instance details

Defined in Toml.Type.AnyValue

type Rep MatchError = D1 ('MetaData "MatchError" "Toml.Type.AnyValue" "tomland-1.3.3.0-inplace" '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.