SagaSaga
Standard Library

Std.Base

Core traits and primitive type class instances. Loaded before all other modules; cannot import from other modules.

Types

Ordering

type Ordering =
  | Lt
  | Eq
  | Gt
  deriving (Show, Debug, Eq)

Result of comparing two values.

Proxy

type Proxy (n : Symbol) =
  | Proxy

Phantom type carrying a type-level symbol. Used to make KnownSymbol dispatch unambiguous at the call site (the symbol appears in the Proxy's type parameter).

Traits

Show

trait Show a {
  fun show : a -> String
}

Convert a value to a human-readable string.

Debug

trait Debug a {
  fun debug : a -> String
}

Convert a value to a programmer-facing debug representation.

Semigroup

trait Semigroup a {
  fun combine : a -> a -> a
}

Types that support an associative combine operation.

Ord

trait Ord a : Eq {
  fun compare : a -> a -> Ordering
}

Types with a total ordering.

Enum

trait Enum a {
  fun to_enum : a -> Int
  fun from_enum : Int -> a
}

Types that can be converted to and from integers.

KnownSymbol

trait KnownSymbol (n : Symbol) {
  fun symbol_name : Proxy n -> String
}

Reflect a type-level symbol to its source name as a String. Implemented universally by the compiler for every concrete symbol literal.

Functions

tap

fun tap : a -> b -> a -> a

Applies a function to a value, discards the result, and returns the value unchanged. Useful for debugging without disrupting an expression: x |> tap dbg |> process