beck / The preludeSource

The prelude

Every name in scope in every module, with the scheme inference reads for it.

Traits

What a user's type may implement to join something the language already has.

TraitMethods
Numdef add(self, other: Self) -> Self, def sub(self, other: Self) -> Self, def mul(self, other: Self) -> Self, def div(self, other: Self) -> Self

Types

TypeDeclaration
EncodingErrorunion EncodingError = BadEncoding(encoding: Str, why: Str)
Envelopemodel Envelope[T] {seq: Int, at: Int, actor: Str, body: T}
HttpErrorunion HttpError = HttpUnreachable(host: Str, why: Str) | HttpTimedOut(host: Str, millis: Int) | HttpBadResponse(why: Str) | HttpStatus(status: Int, body: Str)
HttpRequestmodel HttpRequest {method: Str, path: Str, headers: Map[Str, Str], body: Str, port: Int, tls: Bool, secrets: Map[Str, secret[Str]]}
HttpResponsemodel HttpResponse {status: Int, headers: Map[Str, Str], body: Str}
Jsonunion Json = JsonNull | JsonBool(value: Bool) | JsonNumber(value: Float) | JsonStr(value: Str) | JsonList(items: list[Json]) | JsonObject(fields: Map[Str, Json])
JsonErrorunion JsonError = BadJson(why: Str)
Optionunion Option[T] = Some(value: T) | None
Proposalmodel Proposal {session: Session, command: Command}
Resultunion Result[T, E] = Ok(value: T) | Err(error: E)
Sessionmodel Session {actor: Str, claims: Map[Str, Str]}
TimeErrorunion TimeError = BadTime(why: Str)
UuidErrorunion UuidError = BadUuid(why: Str)

Names

99 of them.

NameType
!=(a, a) -> Bool
%(Int, Int) -> Int
*(Int, Int) -> Int
+(Int, Int) -> Int
-(Int, Int) -> Int
/(Int, Int) -> Int
<(a, a) -> Bool
<=(a, a) -> Bool
==(a, a) -> Bool
>(a, a) -> Bool
>=(a, a) -> Bool
abs(Int) -> Int
and(Bool, Bool) -> Bool
base64_decode(Str) -> Str ! {raises(EncodingError)}
base64_encode(Str) -> Str
concat_lists(list[list[a]]) -> list[a]
cos(Float) -> Float
decide(Stream[Proposal], Signal[a], (a, Proposal) -> Result[list[b], c] ! {e}) -> Stream[b] ! {e}
digest(Str) -> Str
digest_eq(Str, Str) -> Bool
digest_keyed(secret[Str], Str) -> Str ! {cap.sign}
durable(Signal[a]) -> Signal[a] ! {durable}
filter_list(list[a], (a) -> Bool ! {e}) -> list[a] ! {e}
filter_map(Stream[a], (a) -> Option[b] ! {e}) -> Stream[b] ! {e}
float(Int) -> Float
fold((a, Envelope[b]) -> a ! {e}, a, Stream[b]) -> Signal[a]
hex_decode(Str) -> Str ! {raises(EncodingError)}
hex_encode(Str) -> Str
html_attr(Str, a) -> Attr
html_el(Str, list[Attr], list[Html]) -> Html
html_key(a) -> Attr
html_on(Str, a) -> Attr
html_text(a) -> Html
http_fetch(Str, HttpRequest) -> HttpResponse ! {raises(HttpError)}
internal_of(a) -> internal[a]
is_some(Option[a]) -> Bool
json_parse(Str) -> Json ! {raises(JsonError)}
json_render(Json) -> Str
list_all(list[a], (a) -> Bool ! {e}) -> Bool ! {e}
list_any(list[a], (a) -> Bool ! {e}) -> Bool ! {e}
list_append(list[a], a) -> list[a]
list_contains(list[a], a) -> Bool
list_drop(list[a], Int) -> list[a]
list_flat_map(list[a], (a) -> list[b] ! {e}) -> list[b] ! {e}
list_fold(list[a], b, (b, a) -> b ! {e}) -> b ! {e}
list_get(list[a], Int) -> Option[a]
list_index_of(list[a], a) -> Option[Int]
list_is_empty(list[a]) -> Bool
list_len(list[a]) -> Int
list_reverse(list[a]) -> list[a]
list_slice(list[a], Int, Int) -> list[a]
list_take(list[a], Int) -> list[a]
list_zip_with(list[a], list[b], (a, b) -> c ! {e}) -> list[c] ! {e}
map2((a, b) -> c ! {e}, Signal[a], Signal[b]) -> Signal[c] ! {e}
map_contains(Map[a, b], a) -> Bool
map_get(Map[a, b], a) -> Option[b]
map_insert(Map[a, b], a, b) -> Map[a, b]
map_keys(Map[a, b]) -> list[a]
map_len(Map[a, b]) -> Int
map_list(list[a], (a) -> b ! {e}) -> list[b] ! {e}
map_merge(Map[a, b], Map[a, b]) -> Map[a, b]
map_remove(Map[a, b], a) -> Map[a, b]
map_values(Map[a, b]) -> list[b]
merge_clients() -> Stream[Proposal] ! {ingress}
negate(Int) -> Int
not(Bool) -> Bool
now() -> Int ! {nondet}
or(Bool, Bool) -> Bool
per_session(Signal[a], (a, Session) -> b ! {e}) -> Signal[b] ! {e}
reveal(internal[a]) -> a ! {cap.internal}
secret_env(Str) -> secret[Str] ! {env}
signal_map(Signal[a], (a) -> b ! {e}) -> Signal[b] ! {e}
sin(Float) -> Float
sort_by(list[a], (a) -> b ! {e}) -> list[a] ! {e}
sqrt(Float) -> Float
str(a) -> Str
str_chars(Str) -> list[Str]
str_contains(Str, Str) -> Bool
str_ends_with(Str, Str) -> Bool
str_index_of(Str, Str) -> Option[Int]
str_is_empty(Str) -> Bool
str_join(list[Str], Str) -> Str
str_len(Str) -> Int
str_lower(Str) -> Str
str_repeat(Str, Int) -> Str
str_replace(Str, Str, Str) -> Str
str_slice(Str, Int, Int) -> Str
str_split(Str, Str) -> list[Str]
str_starts_with(Str, Str) -> Bool
str_to_int(Str) -> Option[Int]
str_trim(Str) -> Str
str_upper(Str) -> Str
time_format(Int) -> Str
time_parse(Str) -> Int ! {raises(TimeError)}
trunc(Float) -> Int
unwrap_or(Option[a], a) -> a
uuid() -> Str ! {nondet}
uuid_parse(Str) -> Str ! {raises(UuidError)}
uuid_version(Str) -> Int ! {raises(UuidError)}

`http_fetch` is the one name whose row the table above cannot state in full: it also performs `net.out(host)`, for the host written as its first argument. That argument has to be a literal — the cluster's egress policy is derived from those atoms, so a computed host is a call the deployment could not be told about.