tomland-1.0.0: Bidirectional TOML serialization

Safe HaskellSafe
LanguageHaskell2010

Toml.Type.AnyValue

Contents

Description

Existential wrapper over Value type and matching functions.

Synopsis

Documentation

data AnyValue Source #

Existential wrapper for Value.

Constructors

AnyValue (Value t) 
Instances
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
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.0.0-inplace" False) (C1 (MetaCons "MatchError" PrefixI True) (S1 (MetaSel (Just "valueExpected") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 TValue) :*: S1 (MetaSel (Just "valueActual") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (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.