API

API reference

Standard-library modules, signatures, and source documentation.

These pages are generated from Fango source comments and checked signatures. For an introduction and worked examples, use the guides.

Source documentation is being added module by module. The list below contains the modules imported so far; the library guides cover the remaining topics.

Browse modules

  • AsyncConcurrent tasks, cancellation, and channels.
  • BasicsThe standard classes, operators, and arithmetic helpers.
  • BytesImmutable byte sequences.
  • CharConversions between characters and their code points.
  • ConsoleThe program's standard streams as the `Console` effect.
  • DeriveThe derivers for the standard classes: `deriving (Eq, Ord, Show)` uses them. They are ordinary `deriver` declarations, which is how any library opens `deriving` to its own class; see `Meta`.
  • DictImmutable dictionaries ordered by key.
  • EncodingCharacter encodings: converting between text and bytes.
  • ExpectExpectations for tests.
  • FailThe conventional failure effect.
  • FailureInspecting detached failures.
  • FileFiles and directories.
  • HttpWhat HTTP/1.1 requests and responses share: headers, bodies, versions, and protocol errors.
  • Http.ClientAn HTTP/1.1 client.
  • Http.GZipGzip content coding for HTTP bodies.
  • Http.ServerA concurrent HTTP/1.1 server.
  • Http.Server.RouteRouting requests to handlers by method and path.
  • Http.WireHTTP/1.1 framing that requests and responses share: header blocks, body framing, and writing a message after its start line.
  • IOPermission for real native interaction, with structured errors and line data. Console owns the standard streams; File owns file handles. Generic byte IO uses Bytes.Source and Bytes.Sink rather than a shared handle.
  • IteratorImmutable cursors over a step function.
  • JsonParsing and emitting JSON as typed values.
  • Json.FieldThe JSON field options and the string escaping both JSON derivers share.
  • Json.PullThe JSON pull parser and the decoding protocol behind `Json.Decode`.
  • ListImmutable lists and their basic traversals.
  • MaybeOptional values.
  • MetaThe compile-time stage: code values, type and effect reflection, attributes, and the builders derivers use.
  • NetTCP listeners and connections.
  • ParserDirect-style parsers over immutable lists of arbitrary tokens.
  • PreludeThe default scope. Every module that does not carry `{-# no-prelude #-}` resolves as though these imports stood at the top of its own file, so they grant qualified access exactly as a written import does: `List.map` needs no import, while `map` alone does. The module itself exports nothing.
  • ProcessThe running program's arguments, environment variables, and exit status. The prelude does not expose it; import `Process`.
  • RandomRandom numbers as an effect.
  • RangeNumeric ranges traversed without building a list.
  • ReaderBuffered byte readers.
  • RegexRegular expressions, with the syntax and semantics of Go's `regexp` package (RE2): matching runs in time linear in the input, search is leftmost-first, and lookaround and backreferences are not supported. There is no callback replacement, byte input, or mutable configuration.
  • ResultComputations that succeed with a value or fail with an error.
  • Runtime.EntryProgram entry assembly: the default handlers `main`'s effects run under.
  • Runtime.IOShared internal stream conversions for Console and File.
  • Runtime.LocalLocal mutable state confined to a scoped callback.
  • Runtime.NativeTypes for native Go sidecars.
  • Runtime.PromptThe REPL's handler levels.
  • Runtime.ScopeCleanup scopes: releasing what a computation acquired, however it exits.
  • StateA state effect and its runners.
  • STMSoftware transactional memory: shared variables that tasks read and update in composable atomic transactions.
  • STM.MVarA transactional variable that is either full or empty, after Haskell's `TMVar`.
  • STM.QueueA transactional first-in, first-out queue, unbounded or bounded, after Haskell's `TQueue` and `TBQueue`.
  • StreamReusable descriptions of a sequence.
  • StringOperations on text.
  • TestOrganizing and running tests.
  • Test.ReporterHandlers for test progress and the command-line test entry point.
  • Text.BuilderText assembled by appending.
  • Text.ReaderReading characters from a byte reader through an encoding.
  • Text.WriterWriting text to a byte writer through an encoding.
  • TimeGregorian dates, zoned moments, exact durations, and calendar periods. Import the individual Time modules, normally with aliases such as `import Time.Date as Date`. Values are immutable; calendar arithmetic never consults a system clock. Zone conversion and formatting are total; the few fallible operations use `Fail Error`, and each one's comment names the constructors it can raise.
  • Time.ClockScoped access to the current moment and a default zone. Install runSystem or runSystemIn explicitly in production. Tests can freeze time with runFixed, advance each reading with runStepped, or let real time pass from a chosen moment with runOffset. withZone changes only the default zone of an enclosing clock. Existing values never consult this effect for arithmetic. Handlers nest and are inherited by tasks like other effects. None carries Fail; an advancing clock outside the supported instants is a runtime fault.
  • Time.DateGregorian calendar dates from 0001-01-01 through 9999-12-31, independent of timezones. Construction rejects invalid fields. Month and year arithmetic clamp the day; combined periods apply months first, then days. Only construction, parsing, and movement that would leave the calendar fail.
  • Time.DateTimeAn exact moment viewed in a timezone. Equality and ordering compare the moment; sameRepresentation also compares the zone identifier. Calendar calculations use the stored zone, so equal moments in different zones can advance to different moments. Viewing a moment in another zone never fails: see Time.Instant for the supported range that makes this so.
  • Time.DurationExact elapsed time at nanosecond precision. Unlike Time.Period, a duration has no calendar units. Use `hours 24` when exactly 24 hours are intended. The representation is floor seconds plus a nonnegative nanosecond fraction, so the range is signed 64-bit seconds. Arithmetic is total: a result beyond that range wraps like Int, which takes inputs near 10^17 hours. Conversions to sub-second units answer Nothing when the integer would overflow.
  • Time.InstantA moment on the Unix time line without a timezone: floor seconds and a nanosecond fraction. Supported moments run from 0001-01-02T00:00:00Z through 9999-12-30T23:59:59.999999999Z, one day inside the calendar at each end so that interpreting any instant in any zone yields a local date within years 1 through 9999. Use Time.DateTime to view an instant in a zone.
  • Time.InternalRaw value representations and shared text machinery for the Time modules. The constructors here bypass validation: application code must use the checked constructors of Time.Date, Time.TimeOfDay, and Time.Instant, which re-export these types without their constructors.
  • Time.PeriodCalendar adjustments, not elapsed seconds. Years become months and weeks become days. Application adds months with day clamping, then adds days. Combining periods before application can differ from applying each in turn. Construction and combination are total; a component beyond 64 bits wraps like Int, and application to a date checks the calendar range instead.
  • Time.TimeOfDayA nanosecond-precise clock reading without a date or timezone. Midnight belongs to the start of a day; 24:00 and leap seconds are not accepted.
  • Time.ZoneImmutable timezone rules. UTC and fixed offsets are pure; loading a named IANA zone performs IO and caches successful loads for this process. System timezone data takes precedence over the Go toolchain's embedded fallback. The machine's zone is available only explicitly through `system`. Aliases retain their requested name.
  • TraceThe call stack of the running program, for logging and diagnostics.
  • TuplePairs and triples, and their accessors.
  • UrlURLs: parsing, printing, resolution, and percent-encoding, following RFC 3986.
  • WriterBuffered byte writers.