Merge remote-tracking branch 'origin/trunk' into builtins-list-take-last

This commit is contained in:
Folkert 2021-11-09 16:18:19 +01:00
commit 94efbd0e95
16 changed files with 415 additions and 8 deletions

View file

@ -1093,6 +1093,23 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
Box::new(list_type(flex(TVAR1))),
);
// find : List elem, (elem -> Bool) -> Result elem [ NotFound ]*
{
let not_found = SolvedType::TagUnion(
vec![(TagName::Global("NotFound".into()), vec![])],
Box::new(SolvedType::Wildcard),
);
let (elem, cvar) = (TVAR1, TVAR2);
add_top_level_function_type!(
Symbol::LIST_FIND,
vec![
list_type(flex(elem)),
closure(vec![flex(elem)], cvar, Box::new(bool_type())),
],
Box::new(result_type(flex(elem), not_found)),
)
}
// Dict module
// len : Dict * * -> Nat