HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduletoml-parser-2.0.0.0Haskell2010

Toml.Schema.FromValue

Use FromValue to define a transformation from some Value to an application domain type.

Use ParseTable to help build FromValue instances that match tables. It will make it easy to track which table keys have been used and which are left over.

Warnings can be emitted using warn and warnTable (depending on what) context you're in. These warnings can provide useful feedback about problematic values or keys that might be unused now but were perhaps meaningful in an old version of a configuration file.

Toml.Schema.FromValue.Generic can be used to derive instances of FromValue automatically for record types.

  • 2 classes
  • 8 values

Deserialization classes

2 declarations
classclass FromValue a where
#

Class for types that can be decoded from a TOML value.

Methods

Instances31FromValue, …
  • FromValue IntegerDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches integer values

  • FromValue NaturalDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches non-negative integer values

  • FromValue Int16Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue Int32Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue Int64Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue Int8Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue Word16Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue Word32Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue Word64Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue Word8Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue BoolDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches true and false

  • FromValue CharDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches single-character strings with fromValue and arbitrary strings with listFromValue to support String

  • FromValue DoubleDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches floating-point and integer values

  • FromValue FloatDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches floating-point and integer values

  • FromValue IntDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue WordDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue TextDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches string literals

  • FromValue TextDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches string literals

  • FromValue DayDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches local date literals

  • FromValue LocalTimeDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches local date-time literals

  • FromValue TimeOfDayDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches local time literals

  • FromValue ZonedTimeDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches offset date-time literals

  • FromValue TableDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
  • FromValue ValueDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches all values, used for pass-through

  • Integral a => FromValue (Ratio a)Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches floating-point and integer values.

    TOML specifies Floats should be implemented as IEEE 754 binary64 values. so note that the given Rational will be converted from a double representation and will often be an approximation rather than the exact value.

  • FromValue a => FromValue (Seq a)Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches arrays

  • FromValue a => FromValue (NonEmpty a)Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches non-empty arrays or reports an error.

  • FromValue a => FromValue [a]Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Implemented in terms of listFromValue

  • (Generic a, GFromArray (Rep a)) => FromValue (GenericTomlArray a)Defined in toml-parser-2.0.0.0 · Toml.Schema.Generic

    Instance derived using genericFromArray

  • (Generic a, GParseTable (Rep a)) => FromValue (GenericTomlTable a)Defined in toml-parser-2.0.0.0 · Toml.Schema.Generic

    Instance derived using genericParseTable

  • (Ord k, FromKey k, FromValue v) => FromValue (Map k v)Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue
classclass FromKey a where
#

Convert from a table key

Methods

Instances3FromKey
  • FromKey TextDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches all strings

  • FromKey TextDefined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches all strings

  • a ~ Char => FromKey [a]Defined in toml-parser-2.0.0.0 · Toml.Schema.FromValue

    Matches all strings

Containers

2 declarations
valuemapOf
  1. :: Ord k
  2. => (l -> Text -> Matcher l k)

    key matcher

  3. -> (Text -> Value' l -> Matcher l v)

    value matcher

  4. -> Value' l
  5. -> Matcher l (Map k v)
#

Table matching function used to help implement fromValue for tables. Key matching function is given the annotation of the key for error reporting. Value matching function is given the key in case values can depend on their keys.

valuelistOf :: (Int -> Value' l -> Matcher l a) -> Value' l -> Matcher l [a]
#

List matching function used to help implemented fromValue for arrays. The element matching function is given the list index in case values can depend on their index.

Tables

5 declarations

Errors

1 declaration