basic versions of contains and remove

This commit is contained in:
Folkert 2021-02-12 23:47:02 +01:00
parent b4ab02f23a
commit afe2f51660
13 changed files with 402 additions and 23 deletions

View file

@ -770,6 +770,7 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
),
);
// Dict.insert : Dict k v, k, v -> Dict k v
add_type(
Symbol::DICT_INSERT,
top_level_function(
@ -782,6 +783,24 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
),
);
// Dict.remove : Dict k v, k -> Dict k v
add_type(
Symbol::DICT_REMOVE,
top_level_function(
vec![dict_type(flex(TVAR1), flex(TVAR2)), flex(TVAR1)],
Box::new(dict_type(flex(TVAR1), flex(TVAR2))),
),
);
// Dict.contains : Dict k v, k -> Bool
add_type(
Symbol::DICT_CONTAINS,
top_level_function(
vec![dict_type(flex(TVAR1), flex(TVAR2)), flex(TVAR1)],
Box::new(bool_type()),
),
);
// Set module
// empty : Set a