package repr

  1. Overview
  2. Docs

Source file higher.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(** Defunctionalised higher-kinded types. See "Lightweight Higher-Kinded
    Polymorphism" (Yallop and White, 2014) for more details. *)

type ('a, 'f) app

module Branded = struct
  module type S = sig
    type 'a t
    type br

    external inj : 'a t -> ('a, br) app = "%identity"
    external prj : ('a, br) app -> 'a t = "%identity"
  end

  module Make (T : sig
    type 'a t
  end) : S with type 'a t := 'a T.t = struct
    type 'a t = 'a T.t
    type br

    external inj : 'a t -> ('a, br) app = "%identity"
    external prj : ('a, br) app -> 'a t = "%identity"
  end
end
OCaml

Innovation. Community. Security.