tomland-1.3.3.2: Bidirectional TOML serialization
Copyright(c) 2018-2022 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 #

Existential wrapper for Value.

Since: 0.0.0

Constructors

AnyValue (Value t) 

Instances

Instances details
Show AnyValue # 
Instance details

Defined in Toml.Type.AnyValue

NFData AnyValue # 
Instance details

Defined in Toml.Type.AnyValue

Methods

rnf :: AnyValue -> () #

Eq AnyValue # 
Instance details

Defined in Toml.Type.AnyValue

reifyAnyValues :: forall (t :: TValue). Value t -> [AnyValue] -> Either TypeMismatchError [Value t] #

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) #

Function for creating Array from list of AnyValue.

Matching

data MatchError #

Value type mismatch error.

Constructors

MatchError 

Instances

Instances details
Generic MatchError # 
Instance details

Defined in Toml.Type.AnyValue

Associated Types

type Rep MatchError 
Instance details

Defined in Toml.Type.AnyValue

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

Defined in Toml.Type.AnyValue

NFData MatchError # 
Instance details

Defined in Toml.Type.AnyValue

Methods

rnf :: MatchError -> () #

Eq MatchError # 
Instance details

Defined in Toml.Type.AnyValue

type Rep MatchError # 
Instance details

Defined in Toml.Type.AnyValue

type Rep MatchError = D1 ('MetaData "MatchError" "Toml.Type.AnyValue" "tomland-1.3.3.2-I5kA5P8vNG58yDGCdySnke" '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 :: forall (t :: TValue) a. TValue -> Value t -> Either MatchError a #

Helper function to create MatchError.

matchBool :: forall (t :: TValue). Value t -> Either MatchError Bool #

Extract Bool from Value.

matchInteger :: forall (t :: TValue). Value t -> Either MatchError Integer #

Extract Integer from Value.

matchDouble :: forall (t :: TValue). Value t -> Either MatchError Double #

Extract Double from Value.

matchText :: forall (t :: TValue). Value t -> Either MatchError Text #

Extract Text from Value.

matchZoned :: forall (t :: TValue). Value t -> Either MatchError ZonedTime #

Extract ZonedTime from Value.

matchLocal :: forall (t :: TValue). Value t -> Either MatchError LocalTime #

Extract LocalTime from Value.

matchDay :: forall (t :: TValue). Value t -> Either MatchError Day #

Extract Day from Value.

matchHours :: forall (t :: TValue). Value t -> Either MatchError TimeOfDay #

Extract TimeOfDay from Value.

matchArray :: forall a (t :: TValue). (AnyValue -> Either MatchError a) -> Value t -> Either MatchError [a] #

Extract list of elements of type a from array.

applyAsToAny :: forall r (t :: TValue). (AnyValue -> r) -> Value t -> r #

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