HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduletomland-1.3.3.3Haskell2010

Toml.Codec.Combinator.Set

SPDX-License-Identifier : MPL-2.0 Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable

TOML-specific combinators for converting between TOML and Haskell Set-like data types.

There are two way to represent list-like structures with the tomland library.

  • Ordinary array sets of primitives:

    foo = [100, 200, 300]
    
  • Sets via tables:

    foo =
        [ {x = 100}
        , {x = 200}
        , {x = 300}
        ]
    
    OR
    
    [[foo]]
        x = 100
    [[foo]]
        x = 200
    [[foo]]
        x = 300
    

You can find both types of the codecs in this module for different set-like structures. See the following table for the better understanding:

Haskell Type

TOML

TomlCodec

Set Text

a = ["foo", "bar", "baz"]

arraySetOf Toml._Text "a"

IntSet

a = [11, 42]

arrayIntSet "a"

HashSet Text

a = ["foo", "bar"]

arrayHashSetOf Toml._Text "a"

Set Text

x = [{a = "foo"}, {a = "bar"}]

set (Toml.text "a") "x"

HashSet Text

x = [{a = "foo"}, {a = "bar"}]

hashSet (Toml.text "a") "x"

  • 6 values
  • Packagetomland-1.3.3.3
  • Exports6
  • LanguageHaskell2010
  • LicenceMPL-2.0
  • SourceSet.hs

Array sets

3 declarations
valuearraySetOf :: Ord a => TomlBiMap a AnyValue -> Key -> TomlCodec (Set a)
#

Codec for sets. Takes converter for single value and returns a set of values.

Example:

Haskell Set Int can look like this in your TOML file:

foo = [1, 2, 3]

In case of the missing field, the following error will be seen:

tomland decode error:  Key foo is not found

Codec for sets of ints. Takes converter for single value and returns a set of ints.

Example:

Haskell IntSet can look like this in your TOML file:

foo = [1, 2, 3]

In case of the missing field, the following error will be seen:

tomland decode error:  Key foo is not found

Codec for hash sets. Takes converter for single hashable value and returns a set of hashable values.

Example:

Haskell HashSet Int can look like this in your TOML file:

foo = [1, 2, 3]

In case of the missing field, the following error will be seen:

tomland decode error:  Key foo is not found

Table Sets

3 declarations
valueset :: Ord a => TomlCodec a -> Key -> TomlCodec (Set a)
#

Codec for set of values. Represented in TOML as array of tables.

Example:

Haskell Set Int can look like this in your TOML file:

foo =
  [ {a = 1}
  , {a = 2}
  ]

Decodes to an empty Set in case of the missing field in TOML.