Skip to content

Instantly share code, notes, and snippets.

@hcarty
Created May 11, 2015 14:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hcarty/b2dab5324d0d4344d771 to your computer and use it in GitHub Desktop.
Save hcarty/b2dab5324d0d4344d771 to your computer and use it in GitHub Desktop.
Snippet to toggle requiring/not requiring ;; in utop
(* Put this in ~/.ocamlinit to be able to toggle requiring ;; on and off *)
let toggle_semi =
let original = !UTop.parse_toplevel_phrase in
let no_semi str eos_is_error = original (str ^ ";;") eos_is_error in
let semi = ref true in
fun () ->
UTop.parse_toplevel_phrase := if !semi then no_semi else original;
semi := not !semi
;;
(* Include this line to not require ;; by default *)
toggle_semi ();;
@hcarty
Copy link
Author

hcarty commented Apr 12, 2020

Ah, not bad!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment