Skip to content

Instantly share code, notes, and snippets.

@Wilfred
Created September 12, 2018 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wilfred/57fdf70b38a6c36e20c6e819897254d8 to your computer and use it in GitHub Desktop.
Save Wilfred/57fdf70b38a6c36e20c6e819897254d8 to your computer and use it in GitHub Desktop.
playing with modules in ocaml
module type HasLength = sig
type t
val my_length : t -> int
end
module UnitHasLength = struct
type t = unit
let my_length (items: unit): int = 0
end
let inc_length (x: HasLength) = (my_length x) + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment