Installing F# on Mac OS X is easy (with MacPorts):
$ sudo port install fsharp
I have version 1.9.4.19 installed. Microsoft released a newer version several weeks ago, however it doesn't seem to have made it into MacPorts yet. Then to start F# Interactive:
$ fsi --readline --no-gui
There is basic history with the up/down arrows, but the usual emacs key bindings are not available, so entering and editing text is very slow and painful. I tried to fix this with rlwrap.
$ sudo port install rlwrap
As fsi is already using readline, rlwrap needs the
-a
option, See the man page for details, but on the mac you are required to provide a string (representing a password prompt the wrapped application might show) argument for this option. It is completely unnecessary for me at the moment, so I just picked something obvious as a placeholder.$ rlwrap -aPassword: fsi --readline --no-gui
F# Interactive starts up with the usual splash text, but there seems to be some control characters automatically input and the console clears to something like this:
- 0;3R0;3R;3R;3R;3R;3R;3R
The emacs key bindings work, so this text can be deleted with
C-a C-k
and terminating the now empty line as per normal in fsi with ;;
brings up the usual fsi prompt.Unfortunately, if you type in an invalid expression eg. x = 3;;, the cursor is placed in the middle of the error message. When pressing up arrow to go back through the history, sometimes the prompt is replaced by partial text from a viewed history line.
So this is a pretty dodgy solution. If anyone knows how to get it to work properly, please leave a comment.
No comments:
Post a Comment