adds List.last

This commit is contained in:
Celso Bonutti Filho 2020-12-21 19:44:24 -03:00
parent b5dcde267a
commit 51a302957f
6 changed files with 198 additions and 6 deletions

View file

@ -465,6 +465,15 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
add_type(
Symbol::LIST_FIRST,
top_level_function(
vec![list_type(flex(TVAR1))],
Box::new(result_type(flex(TVAR1), list_was_empty.clone())),
),
);
// last : List elem -> Result elem [ ListWasEmpty ]*
add_type(
Symbol::LIST_LAST,
top_level_function(
vec![list_type(flex(TVAR1))],
Box::new(result_type(flex(TVAR1), list_was_empty)),