move List.map* into roc

This commit is contained in:
Brendan Hansknecht 2024-07-12 15:32:49 -07:00
parent 7d8fbfbe85
commit c734a27b59
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
16 changed files with 60 additions and 1445 deletions

View file

@ -2,36 +2,12 @@ use roc_module::symbol::Symbol;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HigherOrder {
ListMap {
xs: Symbol,
},
ListMap2 {
xs: Symbol,
ys: Symbol,
},
ListMap3 {
xs: Symbol,
ys: Symbol,
zs: Symbol,
},
ListMap4 {
xs: Symbol,
ys: Symbol,
zs: Symbol,
ws: Symbol,
},
ListSortWith {
xs: Symbol,
},
ListSortWith { xs: Symbol },
}
impl HigherOrder {
pub fn function_arity(&self) -> usize {
match self {
HigherOrder::ListMap { .. } => 1,
HigherOrder::ListMap2 { .. } => 2,
HigherOrder::ListMap3 { .. } => 3,
HigherOrder::ListMap4 { .. } => 4,
HigherOrder::ListSortWith { .. } => 2,
}
}
@ -42,10 +18,7 @@ impl HigherOrder {
use HigherOrder::*;
match self {
ListMap { .. } | ListSortWith { .. } => 2,
ListMap2 { .. } => 3,
ListMap3 { .. } => 4,
ListMap4 { .. } => 5,
ListSortWith { .. } => 2,
}
}