mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Merge branch 'trunk' into str_trim_left
This commit is contained in:
commit
07cd3850d7
62 changed files with 3288 additions and 7733 deletions
|
@ -985,6 +985,13 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
|||
Box::new(list_type(flex(TVAR1))),
|
||||
);
|
||||
|
||||
// takeLast : List elem, Nat -> List elem
|
||||
add_top_level_function_type!(
|
||||
Symbol::LIST_TAKE_LAST,
|
||||
vec![list_type(flex(TVAR1)), nat_type()],
|
||||
Box::new(list_type(flex(TVAR1))),
|
||||
);
|
||||
|
||||
// drop : List elem, Nat -> List elem
|
||||
add_top_level_function_type!(
|
||||
Symbol::LIST_DROP,
|
||||
|
@ -1093,6 +1100,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue