New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment requirements for mutually recursive functions are non-intuitive #601

Closed
0x53A opened this Issue Aug 8, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@0x53A
Contributor

0x53A commented Aug 8, 2017

This fails:

module Program =

    let rec messageLoop (state:int) = async {
        return! someOther(state)
    } // <-- I need to indent this closing brace one more, then it compiles
    and someOther(state:int) = async {
        return! messageLoop(state)
    }

Workaround1: indent it one more
Workaround2: module rec


Whereas this works:

module Program =

    let a (state:int) = async {
        return state
    }
    let b (state:int) = async {
        return state
    }
@n074v41l4bl34u

This comment has been minimized.

Show comment
Hide comment
@n074v41l4bl34u

n074v41l4bl34u Aug 12, 2017

The indentation comes from this form:

module Program =
    let rec messageLoop (state:int) = 
      async {
        return! someOther(state)
      }
    and someOther(state:int) = 
      async {
          return! messageLoop(state)
      }

and hence "workaround1" is the correct way to write it.

n074v41l4bl34u commented Aug 12, 2017

The indentation comes from this form:

module Program =
    let rec messageLoop (state:int) = 
      async {
        return! someOther(state)
      }
    and someOther(state:int) = 
      async {
          return! messageLoop(state)
      }

and hence "workaround1" is the correct way to write it.

@0x53A

This comment has been minimized.

Show comment
Hide comment
@0x53A

0x53A Aug 12, 2017

Contributor

I find it non-intuitive because it only fails with let rec ... and. If you have two unrelated let-bound asyncs, then you don't need the additional indendation.

Contributor

0x53A commented Aug 12, 2017

I find it non-intuitive because it only fails with let rec ... and. If you have two unrelated let-bound asyncs, then you don't need the additional indendation.

@dsyme dsyme added the area: syntax label Nov 16, 2017

@0x53A

This comment has been minimized.

Show comment
Hide comment
@0x53A
Contributor

0x53A commented Jan 15, 2018

@0x53A 0x53A closed this Jan 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment