fmease / lushui

The reference compiler of the Lushui programming language
Apache License 2.0
5 stars 0 forks source link

Make let/in and use/in expressions more ergonomic to use #72

Open fmease opened 3 years ago

fmease commented 3 years ago

The in after each assignment seems a bit superfluous if the scope (the expression following the in) is on a separate line. Obviously, it's still necessary if everything is written in line. Also, it should be allowed to place the in in the next line.

Allowed right now and allowed with this change:

main: IO Unit =
    use core.unit.unit as u in
    let a = f x y 0 in
    let b = <> a g in
    let c = apply
        stuff in
    m c b b

Possible with this change:

main: IO Unit =
    use core.unit.unit as u
    let a = f x y 0
    let b = <> a g
    let c = apply
        stuff
    m c b b

Is this too liberal? Maybe we should only allow leaving it off if the scope is a let/in or use/in expression.

Then (for example):

main: IO Unit =
    use core.unit.unit as u
    let a = f x y 0
    let b = <> a g
    let c = apply
        stuff
    in m c b b