Esc
Start typing to search...

Standard Library

The Keel standard library provides essential modules for common programming tasks. Modules must be imported before use.

Importing Modules

-- Import specific functions
import List exposing (map, filter)

-- Or use qualified access
import List

List.map (|x| x * 2) [1, 2, 3]

Available Modules

ModuleDescription
ListList manipulation (map, filter, fold, etc.)
StringString operations (split, join, trim, etc.)
MathMathematical functions (abs, sqrt, sin, etc.)
DecimalArbitrary-precision decimal arithmetic (rounding, parsing, conversion)
IOInput/output, files, and environment
HttpHTTP client with composable request builders
JsonJSON parsing, encoding, and field extraction
DataFramePolars-backed tabular data (read, filter, aggregate, join, window functions, expressions, labels, recode)
TableCross-tabulation and summary tables for statistical analysis
ValueLabelSetBidirectional Int↔String mappings for statistical value labels
DateDate operations (create, parse, format, compare, arithmetic)
TimeTime-of-day operations (create, parse, format, compare, arithmetic)
DurationTime span operations (create, convert, arithmetic, comparison)
DateTimeUTC-based date and time operations (parse, format, manipulate, Date/Time interop)
ResultComposable error handling (map, andThen, withDefault)
MaybeComposable optional handling (map, andThen, withDefault)

Note: Keel also supports file inlining for composing programs from multiple files at compile time. This is a language feature using inline "file" passing (...), not a stdlib module.

Note: File system operations in the IO module, HTTP requests, and DataFrame file operations are disabled by default for security. See the IO Security Guide for configuration options.

Built-in Types

These types are always available without imports:

Maybe

type Maybe a = Just a | Nothing

Represents an optional value.

let present: Maybe Int = Just 42
let absent: Maybe Int = Nothing

case present of
    Just n -> n
    Nothing -> 0
Try it

Result

type Result a e = Ok a | Err e

Represents success or failure.

let success: Result Int String = Ok 42
let failure: Result Int String = Err "not found"

case success of
    Ok n -> n
    Err msg -> 0