Open lpil opened 3 months ago
If you had multiple use
expressions in a block what would the desired behaviour be?
use x <- result.try(Ok(1))
use y <- result.try(Error(1))
Ok(1)
Desugaring all of them? Or just the one where the cursor is?
result.try(Ok(1), fn(x) {
use y <- result.try(Error(1))
Ok(1)
})
// Or all the way down
result.try(Ok(1), fn(x) {
result.try(Error(1), fn(y) {
Ok(1)
})
})
Just one please
Here's an attempt - https://github.com/gleam-lang/gleam/pull/3367
I was trying to implement this as well, but I was trying a different route and changing the typing step so that use
gets turned into its own typed AST node instead of turning it into a function call. I'm not sure what's best here though
I was trying to implement this as well, but I was trying a different route and changing the typing step so that
use
gets turned into its own typed AST node instead of turning it into a function call. I'm not sure what's best here though
In my opinion this would be preferable. It looks like https://github.com/gleam-lang/gleam/pull/3367 is little bit brittle.
Ok, if you want to give it a shot I'd be happy to help and share the work in progress code or I could keep working on it :)
Ok, if you want to give it a shot I'd be happy to help and share the work in progress code or I could keep working on it :)
If you already have something working, let's see your PR. If you've created Use type, then may be I can do something on top of it.
Sure! I just got started with it and didn't even get to the code action part, but you can have a look at the code here https://github.com/giacomocavalieri/gleam/commit/11b5630ee98731a1709be2c1f6b07149897eac8a
Hope it can be of any help!
For example, turning:
Into:
Related to https://github.com/gleam-lang/gleam/issues/3311