mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-11 16:51:53 +03:00
expose recursive definitions
This commit is contained in:
parent
cd7e760293
commit
4d762c0574
@ -153,9 +153,25 @@ pub fn canonicalize_module_defs<'a>(
|
||||
}
|
||||
}
|
||||
}
|
||||
DeclareRec(_defs) => {
|
||||
panic!("TODO support exposing recursive defs");
|
||||
DeclareRec(defs) => {
|
||||
for def in defs {
|
||||
for (symbol, variable) in def.pattern_vars.iter() {
|
||||
if exposed_symbols.contains(symbol) {
|
||||
// This is one of our exposed symbols;
|
||||
// record the corresponding variable!
|
||||
exposed_vars_by_symbol.push((*symbol, *variable));
|
||||
|
||||
// Remove this from exposed_symbols,
|
||||
// so that at the end of the process,
|
||||
// we can see if there were any
|
||||
// exposed symbols which did not have
|
||||
// corresponding defs.
|
||||
exposed_symbols.remove(symbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InvalidCycle(identifiers, _) => {
|
||||
panic!("TODO gracefully handle potentially attempting to expose invalid cyclic defs {:?}" , identifiers);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ listMap : ConsList a, (a -> b) -> ConsList b
|
||||
listMap = \list, f ->
|
||||
when list is
|
||||
Nil -> Nil
|
||||
Cons x xs -> Cons (f x) (listMap f xs)
|
||||
Cons x xs -> Cons (f x) (listMap xs f)
|
||||
|
||||
map : Result e a, (a -> b) -> Result e b
|
||||
map = \result, f ->
|
||||
|
Loading…
Reference in New Issue
Block a user