Prelude
Prelude
The prelude module defines Zirric’s core types and foundational annotations.
Annotations
Countable
annotation Countable
No documentation.
Members:
@Returns(Int) length(@Has(Countable) value)
Default
annotation Default
Transparently indicates the assumed default value of a parameter or field.
Fields:
@Type(AnyType) value— The default value for a parameter.
Deprecated
annotation Deprecated
Annotates a declaration as deprecated with a reason.
Fields:
@String @Default("without alternative") reason
Doc
annotation Doc
Provides access to the documentation string of a declaration.
Fields:
@String description— The documentation string without leading comment
markers and whitespace.
ErrType
annotation ErrType
No documentation.
Fields:
@Type(AnyType) type
Error
annotation Error
No documentation.
Members:
@Returns(String) toString(@Has(Error) err)
Has
annotation Has
Requests passed values to have the given annotation type present. Do not
annotate types with @Has.
Fields:
@Type(AnnotationType) annotationType— The required annotation type.
Iterable
annotation Iterable
No documentation.
Members:
iterate(@Has(Iterable) value, @Func yield)
Numeric
annotation Numeric
A numeric value, either floating point or integer.
Members:
@Returns(Number) get()
Numeric (conversion)
annotation Numeric
Annotates a declaration as numeric, providing a way to convert it to a number.
Members:
@Returns(Number) toNumber(@Has(Numeric) value)
OkType
annotation OkType
No documentation.
Fields:
@Type(AnyType) type
Returns
annotation Returns
Annotates a function declaration to return a value of the given type.
Fields:
@Type(AnyType) type
Type
annotation Type
Annotates a declaration to be of a given type. Instead of annotating
@Type(SomeType), the shorthand @SomeType can be used.
Fields:
@Type(AnyType) type— The type of the annotation.
Enum
Number
enum Number
No documentation.
Cases:
FloatInt
Optional
@json.Inline()
enum Optional
No documentation.
Cases:
@json.Type(json.Null) None@json.Inline Some { value }
Result
enum Result
No documentation.
Cases:
Ok { @Any value }Err { @Has(Error) error }
Extern Types
Annotation
extern type Annotation
All annotations are of type Annotation.
AnnotationType
extern type AnnotationType
All annotation types are of type AnnotationType.
Any
extern type Any
Anything is a value of type Any.
AnyType
extern type AnyType
All types are of type AnyType.
Array
extern type Array
A finite list of values.
Fields:
@Type(Int) length— The length of the array.
Bool
extern type Bool
Represents boolean values like True and False. Typically used for
conditionals and flags.
Members:
toggle()— Negates a boolean value.
Char
extern type Char
A single character from a string.
Dict
extern type Dict
An associative array of keys and their values.
Fields:
@Type(Int) length— The length of the dictionary.
Float
@Numeric({ f -> f })
extern type Float
A floating point number.
Func
extern type Func
A callable function.
Fields:
@Type(Int) arity— The amount of function parameters to be passed.
Int
@Numeric({ i -> i })
extern type Int
A whole integer number.
Module
extern type Module
All modules are of type Module.
ModuleType
extern type ModuleType
All module types are of type ModuleType.
Null
extern type Null
The type of the null value.
String
extern type String
No documentation.
Fields:
@Type(Int) length
Data
Range
data Range
No documentation.
Fields:
@Int start@Int end
Extern Constants
null
@Type(Null)
extern let null
Represents the absence of a value.
Variables
false
@Bool
let false = 0 != 0
No documentation.
true
@Bool
let true = 0 == 0
No documentation.