Skip to content
// EFFECT DAYS 2026

Toml unstable

Parses TOML configuration files.

The implementation covers the TOML values and table forms used by Effect's configuration-file CLI primitive while avoiding a generated parser runtime.

1 exports Since v4.0.0 Source

Decoding

parse

unstable
Since v4.0.0

Parses a TOML document into a null-prototype record.

Details

Returns Result.succeed with the parsed record, or Result.fail with an EncodingError when the input is not valid TOML. Offset date-times are represented by Date, matching the package this parser replaces. Local dates and times remain strings.

Signature

declare function parse(input: string): Result<Record<string, unknown>, EncodingError>

Example Parsing a TOML document

import { Result } from "effect"
import { Toml } from "effect/encoding"
Toml.parse("port = 8080") // => Result.succeed({ port: 8080 })
Result.isFailure(Toml.parse("port = ")) // => true