Target

lib/Target.gob

The platform the program is being compiled for, as values a program can match on:

let sigbus : Int = match Target.os {
    Darwin -> 10
    Linux -> 7
}

Every arm of such a match is checked on every build, whichever target is chosen, and adding a constructor here makes each of them non-exhaustive: the compiler lists every place a new target has to be taught about. Only the chosen target's arm is compiled. os and arch are each a bare constructor once lowered, which the optimizer puts in place of every read of them before it decides the match. So an arm may call a foreign symbol that exists only on its own target, and the link never sees it elsewhere.

Each type lists the targets the compiler supports. Lowering the primitives below stops the compile if the chosen target has no constructor here.

type OS = Darwin | Linux
type Arch = Arm64
let os : OS

The constructors --target chose.

let arch : Arch