LIST_REVERSE works, so long as the list is made up of ints equal to 1

This commit is contained in:
Chad Stearns 2020-07-02 22:39:58 -04:00
parent d8a8741aed
commit 7bd7e697b0
4 changed files with 41 additions and 6 deletions

View file

@ -630,6 +630,28 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
)
});
// reverse : Attr * (List (Attr * a)) -> Attr * (List (Attr * a))
add_type(Symbol::LIST_REVERSE, {
let_tvars! { a, star1, star2 };
unique_function(
vec![SolvedType::Apply(
Symbol::ATTR_ATTR,
vec![
flex(star1),
SolvedType::Apply(Symbol::LIST_LIST, vec![flex(a)]),
],
)],
SolvedType::Apply(
Symbol::ATTR_ATTR,
vec![
boolean(star2),
SolvedType::Apply(Symbol::LIST_LIST, vec![flex(a)]),
],
),
)
});
// push : Attr * (List a)
// , a
// -> Attr * (List a)