A question on idiomatic Gleam: is there a general preference between nesting case expressions vs. using multiple subjects?
An illustrative example:
Nested:
case status {
Ok(user) -> {
case is_admin {
True -> show_admin_panel(user)
False -> show_home(user)
}
}
Error(_) -> redirect_to_login()
}
With multiple subjects:
case status, is_admin {
Ok(user), True -> show_admin_panel(user)
Ok(user), False -> show_home(user)
Error(_), _ -> redirect_to_login()
}
I was just manually refactoring some code from nested to multiple subjects, and it got me wondering if a "Convert to multiple subjects" Code Action in the LS would be an interesting proposal.