mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
List prepend implementation with tests, and a few small code clarity changes to list_push implementation
This commit is contained in:
parent
fc52bdc59a
commit
68b13d29fd
7 changed files with 214 additions and 10 deletions
|
@ -510,7 +510,7 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
|||
),
|
||||
);
|
||||
|
||||
// push : List elem -> elem -> List elem
|
||||
// push : List elem, elem -> List elem
|
||||
add_type(
|
||||
Symbol::LIST_PUSH,
|
||||
SolvedType::Func(
|
||||
|
@ -519,6 +519,15 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
|||
),
|
||||
);
|
||||
|
||||
// prepend : List elem, elem -> List elem
|
||||
add_type(
|
||||
Symbol::LIST_PREPEND,
|
||||
SolvedType::Func(
|
||||
vec![list_type(flex(TVAR1)), flex(TVAR1)],
|
||||
Box::new(list_type(flex(TVAR1))),
|
||||
),
|
||||
);
|
||||
|
||||
// single : a -> List a
|
||||
add_type(
|
||||
Symbol::LIST_SINGLE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue