---
title: Std.Base
---

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

## Types

### Ordering

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

Result of comparing two values.

### Proxy

```saga
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

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

Convert a value to a human-readable string.

### Debug

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

Convert a value to a programmer-facing debug representation.

### Semigroup

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

Types that support an associative combine operation.

### Ord

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

Types with a total ordering.

### Enum

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

Types that can be converted to and from integers.

### KnownSymbol

```saga
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

```saga
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`

