views:

5395

answers:

5

I can't seem to find a compiler/plugin for mono. Does one exist?

+3  A: 

You can download the F# zip file from Microsoft and then run (for example) "mono fsi.exe".

sblom
It looks like this link is dead.
epotter
Updated the link to point to the latest download. Thanks for the heads-up, @epotter.
sblom
+10  A: 

Yes, there's one. Check this out: F# for Mono

Jose Basilio
+13  A: 
  1. Go here and download the fsharp.zip
  2. Unzip it and open the created folder (currently "FSharp-1.9.9.9")
  3. Open the terminal and run ./install-mono.sh as root (On some systems, it is necessary to convert the newline characters in that script from CRLF to LF)

This will give you the basic functionality which means you will be able to run "mono fsi.exe" and compiled F# apps as "mono myApp.exe".

Usefull tips:

  1. It makes sense to create scripts for the compiler and F# interactive.

    /usr/local/bin/fsc

    #!/bin/sh exec /usr/bin/mono /usr/local/src/FSharp-1.9.9.9/bin/fsc.exe $@

    /usr/local/bin/fsi

    #!/bin/sh exec /usr/bin/mono /usr/local/src/FSharp-1.9.9.9/bin/fsi.exe $@

  2. F# interactive (fsi.exe) is trying to reference System.Windows.Forms by default so in order to run it WinForms support in Mono will be required

  3. fsi.exe works better in Xterm than in Gnome Terminal.

Piotr Zurek
Any particular version of Mono needed? I have 2.0, which I assume is pretty old, and F# complains that some DLLs are missing, in particular System.Windows.Forms...
Nels Beckman
+2  A: 

What Piotr Zurek said is basically what i did to get F# and mono to work on Ubuntu 9.04, with the following comments:

  1. Rember to install WinForm support with Mono. Otherwise you can't start fsi.exe.
  2. ./install-mono.sh should be run with root privileges (sudo ./install-mono.sh).
  3. Gnome Terminal dosn't play well with fsi.exe. Start a normal xterm and run fsi.exe whithin that.
huusom
+6  A: 

Just beware, tail calls does not seem to work on Mono, so your application will probably run out of stack space rather quickly.

leppie
Not sure this is still true: See last comment http://flyingfrogblog.blogspot.com/2009/01/mono-does-not-support-tail-calls.html
Tristan