Skip to content

Instantly share code, notes, and snippets.

@objmagic
Last active January 20, 2016 20:58
Show Gist options
  • Save objmagic/d78aea92c6384bb35c05 to your computer and use it in GitHub Desktop.
Save objmagic/d78aea92c6384bb35c05 to your computer and use it in GitHub Desktop.
let-rec-and generalization happens after resolutions of all mutually recursive funtions
module S1 = struct
let f p sep =
let r = p () in
match r with
| None -> `A (sep ())
| Some l -> `B l
end
module S2 = struct
type t = A
let rec p1 () = A
and p3 () = None
and f p sep = (* not fully generalized for p1, p2, p4 *)
let r = p () in
match r with
| None -> `A (sep ())
| Some l -> `B l
and p4 () =
f p3 p1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment