use std::collections::HashMap;
use crate::types::{Effect, StackType, Type};
use super::macros::*;
pub(super) fn add_signatures(sigs: &mut HashMap<String, Effect>) {
builtin!(sigs, "tcp.listen", (a Int -- a Int Bool));
builtin!(sigs, "tcp.accept", (a Int -- a Int Bool));
builtin!(sigs, "tcp.read", (a Int -- a String Bool));
builtin!(sigs, "tcp.write", (a String Int -- a Bool));
builtin!(sigs, "tcp.close", (a Int -- a Bool));
}
pub(super) fn add_docs(docs: &mut HashMap<&'static str, &'static str>) {
docs.insert(
"tcp.listen",
"Start listening on a port. Returns (fd Bool) -- Bool is false on failure.",
);
docs.insert(
"tcp.accept",
"Accept a connection. Returns (fd Bool) -- Bool is false on failure.",
);
docs.insert(
"tcp.read",
"Read from a connection. Returns (String Bool) -- Bool is false on failure.",
);
docs.insert(
"tcp.write",
"Write to a connection. Returns Bool -- false on failure.",
);
docs.insert(
"tcp.close",
"Close a connection. Returns Bool -- false on failure.",
);
}