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.
- Void t_apply_aa() -
- Void t_apply_ab() -
- Void t_array_list_empty() -
- Void t_array_list_full() -
- Void t_compose_aa() -
- Void t_compose_ab() -
- Void t_deref_nothing() -
- Void t_deref_pattern() -
- Void t_deref_shallow() -
- Void t_deref_something() -
- Void t_force_1() -
- Void t_hasCycle_1() -
- Void t_hasCycle_2() -
- Void t_hasCycle_3() -
- Void t_hasCycle_4() -
- Void t_hasCycle_5() -
- Void t_hasCycle_6() -
- Void t_intBase_bin() -
- Void t_intBase_dec() -
- Void t_intBase_hex() -
- Void t_intBase_oct() -
- Void t_isAlnum_false() -
- Void t_isAlnum_true1() -
- Void t_isAlnum_true2() -
- Void t_isAlnum_true3() -
- Void t_isAlnum_true4() -
- Void t_isAlnum_true5() -
- Void t_isAlpha_false1() -
- Void t_isAlpha_false2() -
- Void t_isAlpha_true1() -
- Void t_isAlpha_true2() -
- Void t_isAlpha_true3() -
- Void t_isAlpha_true4() -
- Void t_isDigit_false() -
- Void t_isDigit_true1() -
- Void t_isDigit_true2() -
- Void t_isGraph_false1() -
- Void t_isGraph_false2() -
- Void t_isGraph_true1() -
- Void t_isGraph_true2() -
- Void t_isGraph_true3() -
- Void t_isGraph_true4() -
- Void t_isGraph_true5() -
- Void t_isGraph_true6() -
- Void t_isGraph_true7() -
- Void t_isLineEnding_false() -
- Void t_isLineEnding_n() -
- Void t_isLineEnding_r() -
- Void t_isLower_false1() -
- Void t_isLower_false2() -
- Void t_isLower_false3() -
- Void t_isLower_true1() -
- Void t_isLower_true2() -
- Void t_isPunct_false() -
- Void t_isPunct_true() -
- Void t_isSpace_false1() -
- Void t_isSpace_false2() -
- Void t_isSpace_true1() -
- Void t_isSpace_true2() -
- Void t_isSpace_true3() -
- Void t_isSpace_true4() -
- Void t_isUpper_false1() -
- Void t_isUpper_false2() -
- Void t_isUpper_false3() -
- Void t_isUpper_true1() -
- Void t_isUpper_true2() -
- Void t_ltruncate_illegal() -
- Void t_ltruncate_okay() -
- Void t_rep_empty() -
- Void t_rep_negative() -
- Void t_rep_normal() -
- Void t_rep_once() -
- Void t_rep_zero() -
- Void t_reverse_list_empty() -
- Void t_reverse_list_even() -
- Void t_reverse_list_odd() -
- Void t_rtruncate_illegal() -
- Void t_rtruncate_okay() -
- Void t_strEnd_empty_okay() -
- Void t_strEnd_full_negative() -
- Void t_strEnd_full_negative2() -
- Void t_strEnd_full_positive() -
- Void t_strEnd_full_positive2() -
- Void t_strEnd_illegal() -
- Void t_stringBase_dec() -
- Void t_stringBase_hex() -
- Void t_stringBase_oct() -
- Void t_substr_empty1() -
- Void t_substr_empty2() -
- Void t_substr_full1() -
- Void t_substr_full2() -
- Void t_substr_full3() -
- Void t_substr_full4() -
- Void t_substr_full5() -
- Void t_substr_full6() -
- Void t_substr_fulln1() -
- Void t_substr_fulln2() -
- Void t_substr_fulln3() -
- Void t_substr_fulln4() -
- Void t_substr_illegal() -
- Void t_thunk_2() -
- Void t_thunk_force() -
- Void t_toLower_lower() -
- Void t_toLower_other() -
- Void t_toLower_string_empty() -
- Void t_toLower_string_full() -
- Void t_toLower_upper() -
- Void t_toUpper_lower() -
- Void t_toUpper_other() -
- Void t_toUpper_string_empty() -
- Void t_toUpper_string_full() -
- Void t_toUpper_upper() -
- Void t_traverse_list_empty() -
- Void t_traverse_list_full() -
- [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