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
| Module | Description |
|---|---|
| List | List manipulation (map, filter, fold, etc.) |
| String | String operations (split, join, trim, etc.) |
| Math | Mathematical functions (abs, sqrt, sin, etc.) |
| Decimal | Arbitrary-precision decimal arithmetic (rounding, parsing, conversion) |
| IO | Input/output, files, and environment |
| Http | HTTP client with composable request builders |
| Json | JSON parsing, encoding, and field extraction |
| DataFrame | Polars-backed tabular data (read, filter, aggregate, join, window functions, expressions, labels, recode) |
| Table | Cross-tabulation and summary tables for statistical analysis |
| ValueLabelSet | Bidirectional Int↔String mappings for statistical value labels |
| Date | Date operations (create, parse, format, compare, arithmetic) |
| Time | Time-of-day operations (create, parse, format, compare, arithmetic) |
| Duration | Time span operations (create, convert, arithmetic, comparison) |
| DateTime | UTC-based date and time operations (parse, format, manipulate, Date/Time interop) |
| Result | Composable error handling (map, andThen, withDefault) |
| Maybe | Composable 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 itResult
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