OCaml Installation Advice: Difference between revisions
Lars.kurth (talk | contribs) m (moved OCaml Advice to OCaml Installation Advice) |
m (Removed superfluous <nowiki></nowiki> tag pairs.) |
||
Line 16: | Line 16: | ||
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: |
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: |
||
<pre |
<pre> |
||
alias ocaml="ledit ocaml" |
alias ocaml="ledit ocaml" |
||
</pre> |
|||
to your startup scripts. |
to your startup scripts. |
Revision as of 21:20, 28 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.