OCaml Installation Advice: Difference between revisions
Lars.kurth (talk | contribs) (Created page with "<!-- MoinMoin name: OCaml_Advice --> <!-- Comment: --> <!-- WikiMedia name: OCaml Advice --> <!-- Page revision: 00000001 --> <!-- Original date: Thu Oct 8 18:13:14 2…") |
Lars.kurth (talk | contribs) m (moved OCaml Advice to OCaml Installation Advice) |
(No difference)
|
Revision as of 19:29, 10 November 2011
OCaml Installation Advice
Editable Top-Level
OCaml provides a top-level (entered by running "ocaml") which is an excellent way to test code snippets. However, the ordinary interface lacks any editing features. This is most easily remedied using the ledit program by adding:
alias ocaml="ledit ocaml"
to your startup scripts.
Emacs
Tuareg-mode
Although the OCaml distribution provides a simple editing mode for emacs, the Tuareg mode is better in many ways, including reliability.
Type Throwback
Types in ML programs are almost always inferred by the ML compiler. This greatly improves brevity but the lack of type information can be a hindrance to the programmer when developing software in ML. OCaml addresses this issue by providing a mechanism for type throwback. To use type throwback with emacs you can install the ocaml-mode package and then compile your code using the -dtypes compiler option. The key combination C-c C-t then brings up the inferred type of the current subexpression.
Eclipse
ocaIDE is a nice ocaml pluggin for Eclipse. You can go to the definition of any function in holding CTRL + left click. You can also have code auto-completion with CTRL+SPACE.