Built-ins
This page covers the top-level built-ins that are always in scope even though they are not module members. For host console I/O, see the separate Console module.
Values and functions
| Name | Signature | Description |
|---|---|---|
Env | Environment | Host-injected execution metadata for CLI file runs, stdin runs, and the REPL. |
ignore | 'a -> unit | Discards a value when only the side effect of an expression matters. |
type Environment
type Environment =
{ ScriptName: string option
Arguments: string list }
The host exposes Env with this shape:
Env.ScriptNameisSome "path/to/script.fss"for file execution.Env.ScriptNameisNonefor stdin execution and the REPL.Env.Argumentscontains arguments passed after--.
match Env.Arguments with
| name :: _ -> Console.writeLine $"hello {name}"
| [] -> Console.writeLine "hello"
type FsKind
type FsKind =
| File of string
| Directory of string
| Missing
Fs.kind returns FsKind, which lets scripts branch on filesystem state with pattern matching:
match Fs.kind "samples" with
| Directory path -> Console.writeLine $"dir: {path}"
| File path -> Console.writeLine $"file: {path}"
| Missing -> Console.writeLine "missing"
ignore : 'a -> unit
Use ignore when an expression returns a value you intentionally do not need.
String.indexOf "x" "text" |> ignore