Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
;; documentation comment
type $my_record = record {
;; field documentation
field1: u32,
field2: $other_record,
field3: list[string],
field4: in-buffer[u8],
}
;; comment on this type
type $other_record = (f32, f64)
type $errno = variant {
invalid,
too_big(string),
way_too_big($my_record)
}
;; importing types from other modules
use $other_type from $other_module
fn the_meaning_of_life() -> u32;
fn read(
fd: handle $fd,
buf: out-buffer[u8]
) -> result[u32, $errno];
fn write(
fd: handle $fd,
buf: in-buffer[u8]
) -> result[u32, $errno];
fn multivalue_return() -> u32, u64;
fn tuple_return() -> (u32, u64);
;; documentation on functions
fn what_in_the_world(record: $my_record);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment