Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 7.08 KB

File metadata and controls

68 lines (48 loc) · 7.08 KB

BetterOCaml

Website betterocaml.ml GitHub license Compatibility Maintenance

An efficient, intuitive and cross-platform web IDE for the OCaml language (recent: v4.08.1), with your code interpreted and running in your browser! (no server is needed!)

Installation / Usage

The IDE is hosted here, https://BetterOCaml.ml/, but you can host your own version by simply copying the files from the src/ directory on your host (on a folder of your laptop, or a folder of your web-server, see http://ocaml.besson.link/ for an example).

It is a purely static website: once your browser downloads the files from the server (about 35 Mb), it will run the OCaml code in its javascript engine, without sending anything to a distant server! Your data is secure, and this website does not use any third party service cookie 🙅‍♂️ 🍪.

Without installing any software on your laptop or smartphone, use this web-based editor to access to a complete OCaml REPL and text editor, with syntax highlighting, a full support of recent OCaml syntax and the entire standard library, and multiple-files that you can save to or load from your computer. Note that there is only a partial support for Graphics and it works better on Google Chrome or Chromum, no support for Unix* modules, and of course no Sys.command function.

How to use ?

editor

The editor is made of 4 parts, as seen in this screenshot:

  • 1 Controls : with these buttons you can add, execute, save and load code in the editor and access to settings;
  • 2 Tabs : this is where you can switch between multiple files;
  • 3 Editor : you can type code here and execute with Ctrl+Enter. Each OCaml statement must be finished with ;;, and toplevel directives are not supported;
  • 4 Output & Console : this the output of OCaml, showing values and messages printed to sdtout, you can also type command here (after the # sign), which much ends with ;; and type Enter.

🎨 Theme

You can choose the theme in the settings, in the top right corner. Your preference should be used the next time you come back on the editor. There are currently three themes (two dark themes, "default" and "Monokai", and a light one, "MDN").

If you have any suggestion for a new theme, open an issue 👍 !

✨ Use offline?

💻 On a laptop or desktop

  • If you visit the editor webpage using your favorite browser, and if it works fine, you can add the link to your ⭐ "favorites", and then later on, if you open the direct link, it should work and load back BetterOCaml... even if your browser is offline!

  • This can only work if you don't clean-up or delete the cache of your browser, but it should work even if you turn-off and turn-on again your laptop!

  • We recently added support for an app manifest and service workers, so this web app is now a Progressive Web App (PWA), which can be installed on your laptop and used later on, even if you're offline! After being intalled, the app should appear in your global application menu (it works on Chromium on both Windows and Ubuntu).

If you can't install it as a PWA, @Naereen recommends trying WebCatalog, a multi-platform desktop app (for *NIX, Windows and Mac OS), and you can then use it to "install" the BetterOCaml editor, along with its integrated OCaml interpreter (of course), as a "native" desktop app. It then appears in the menu of your system, and it works offline! See this 1:30min tutorial in video.

☎️ On a smartphone

  • It also works fine on smartphone running any recent OS and browser, 👌 and the app should be "responsive" and switch to a vertical layout if your screen is too narrow.
  • Loading the OCaml toplevel can take a few seconds on a mobile 3G/4G or 🐌 slow Wifi networks: it's over 30 Mb, as it includes all of OCaml standard library!
  • The Progressive Web App can be installed on your smartphone: there should be a small + button near the address bar, or a "Install it" option in the menu. Once you install it, there should be an icon in the home screen (but not in the app menu) that launches the app in full size mode (like a browser, but no address bar). It works fine on Chrom(e|ium) and Firefox mobile on Android, at least.
  • If you think that this is not enough, and that the website should be bundled as a native iOS/Android app, please vote 👍 on this issue.

About this project

🛠️ Dependencies

BetterOCaml is made with these open-source tools:

Contributing?

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

🆘 Need help?

If something is wrong or if you encounter any issue when using BetterOCaml, please open an issue first (you have to create a GitHub account first).

📜 License

This project is released publicly under the terms of the Apache 2.0 license.

Authors

This project was initiated and is maintained by @jbdo99, with help and contributions from a few other people.