Implement the try keyword with desugaring

This commit is contained in:
Sam Mohr 2024-11-01 17:34:11 -07:00
parent 69dd8d77f3
commit 308defac46
No known key found for this signature in database
GPG key ID: EA41D161A3C1BC99
9 changed files with 196 additions and 10 deletions

View file

@ -98,6 +98,16 @@ pub enum CalledVia {
/// This call is a result of lowering a reference to a module-params-extended def
NakedParamsVar,
/// This call is the result of desugaring a `try` expression into an early return on Err
/// e.g. `try parseDate input` becomes:
///
/// ```roc
/// when parseDate input is
/// Err err -> return Err err
/// Ok value -> value
/// ```
Try,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]