Weak type when composing pretty printers

The classical example of capturing mutable reference works:

let fake_id _  =
  let store = ref None in
  fun _ _ x -> match !store with
  | None -> store:= Some x; x
  | Some x -> x

let safe_and_polymorphic x y = fake_id Fun.id x y
let unsound_if_it_were_polymorphic = fake_id Fun.id
3 Likes

I see. That is a great example.

Thanks for your patient help!