add List.range

This commit is contained in:
Folkert 2021-03-29 23:00:49 +02:00
parent 4ce520fed6
commit d718e21fd3
11 changed files with 253 additions and 2 deletions

View file

@ -799,7 +799,7 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
)
});
// keepOks : List before, (before -> Result * after) -> List after
// keepErrs: List before, (before -> Result * after) -> List after
add_type(Symbol::LIST_KEEP_ERRS, {
let_tvars! { star, cvar, before, after};
top_level_function(
@ -815,6 +815,14 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
)
});
// range : Int a, Int a -> List (Int a)
add_type(Symbol::LIST_RANGE, {
top_level_function(
vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))],
Box::new(list_type(int_type(flex(TVAR1)))),
)
});
// map : List before, (before -> after) -> List after
add_type(
Symbol::LIST_MAP,