#indent "off" in F#

Posted by anta40 on Stack Overflow See other posts from Stack Overflow or by anta40
Published on 2010-04-30T15:41:46Z Indexed on 2010/04/30 15:57 UTC
Read the original article Hit count: 406

Filed under:
|

I just started learning F#, and tried a code from the wiki:

I prefer tabs to spaces, so I change the code a bit into this:

#indent "off"
open System
open System.Windows.Forms

let form = new Form(Visible=true, TopMost=true, Text="Welcome to F#")

let label =
    let temp = new Label()
    let x = 3 + (4 * 5)
    temp.Text <- sprintf "x = %d" x
    temp

form.Controls.Add(label)

[<STAThread>]
Application.Run(form)

The output is:

Microsoft (R) F# 2.0 Compiler build 4.0.30319.1 Copyright (c) Microsoft Corporation. All Rights Reserved.

fstest2.fs(1,1): warning FS0062: This construct is for ML compatibility. Conside r using a file with extension '.ml' or '.mli' instead. You can disable this warn ing by using '--mlcompatibility' or '--nowarn:62'.

fstest2.fs(9,2): error FS0010: Unexpected keyword 'let' or 'use' in expression. Expected 'in' or other token.

fstest2.fs(13,1): error FS0597: Successive arguments should be separated by spac es or tupled, and arguments involving function or method applications should be parenthesized

fstest2.fs(9,14): error FS0374: Invalid expression on left of assignment

fstest2.fs(16,1): error FS0010: Unexpected identifier in definition

Guess the error is somewhere in the let label block, but couldn't figure it out.

© Stack Overflow or respective owner

Related posts about F#

Related posts about indentation