Prelude module
The standard Prelude will be imported by all Kaya programs and modules unless the -noprelude compiler option is used. It provides many essential and useful functions and data types used by the Kaya standard library and applications.
Generally, only the standard library itself should not automatically import this module.
Data types
- Prelude::List<a> - Linked list type.
- Prelude::Maybe<a> - Optional values.
Exceptions
- CantDerefNothing - Tried to dereference an empty Maybe
- FileNotFound - File not found
- NegativeLengthString - Negative string length specified
- PositionOutOfRange - Position out of range
Functions
- a apply(a(b) f,b arg) - Apply a function to an argument.
- [a] array(List<a> xs) - Coerce a linked list to an array.
- Void behead(String x) - Remove the first character of a string, in-place.
- a(c) compose(a(b) f,b(c) g) - Compose two functions.
- a deref(Maybe<a> v) - Dereference a Maybe.
- a force(a() f) - Evaluate a suspended function.
- Void gc() - Force a garbage collection
- Void gcDisable() - Switch off garbage collector.
- Void gcEnable() - Switch on garbage collector.
- Int gcFreeBytes() - Debugging function
- Int gcHeapSize() - Debugging function
- Void gcIncremental() - Enable incremental garbage collection.
- Int gcSetFSD(Int fsd) - Debugging function
- Void gcSetMaxHeapSize(Int size) - Debugging function
- Int gcTotalBytes() - Debugging function
- Int intBase(String str,Int base) - Convert a string, in the given base, to an integer
- Bool isAlnum(Char c) - Checks if the character is a digit or alphabetical
- Bool isAlpha(Char c) - Checks if the character is alphabetical
- Bool isDigit(Char c) - Checks if the character is a digit
- Bool isGraph(Char c) - Checks if the character is printable and not whitespace
- Bool isLineEnding(Char c) - Checks if the character is (part of) a line ending
- Bool isLower(Char c) - Checks if the character is a lower-case letter
- Bool isPunct(Char c) - Checks if the character is punctuation
- Bool isSpace(Char c) - Checks if the character is whitespace
- Bool isUpper(Char c) - Checks if the character is an upper-case letter
- Void ltruncate(Int i,String x) - Remove characters from the left of a string, in-place.
- Void onDestroy(var a object,var Void(a) destroyFn) - Register a function to call when object is garbage collected
- Void putStr(String text) - Send a string to standard output
- Void putStrLn(String text) - Send a string and a newline to standard output.
- String rep(String str,Int x) - Repeat a string
- Void reverse(var List<a> xs) - Reverse a linked list in place.
- Void rtruncate(Int i,String x) - Remove characters from the right of a string, in-place.
- String strEnd(String x,Int i) - Return the end of a String.
- String stringBase(Int num,Int base) - Convert an integer in the given base to a string.
- String substr(String x,Int i,Int len) - Return a substring.
- [Tainted<String> ] taint([String] ss) - Taint an array of strings
- a() thunk(a val) - Turn a value into a function.
- Char toLower(Char c) - Converts the character to a lower-case letter
- String toLower(String s) - Returns a copy of the string with all letters lower-cased
- Char toUpper(Char c) - Converts the character to an upper-case letter
- String toUpper(String s) - Returns a copy of the string with all letters upper-cased
- Void traverse(Bool(a, Int) block,List<a> list) - Iteration over linked lists