Skip to content

About

include functor as PPX

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

Repository files navigation

ppx_include_functor

ci workflow status GitHub release status opam package status

Transformation for include functor in standard OCaml. Attempts to imitate OxCaml include functor.

Installation

opam pin git+https://github.com/sim642/ppx_include_functor.git

Usage

In dune:

(preprocess (pps ppx_include_functor))

Syntax

Use [%%functor include Comparable.Make] as a module item instead of include functor Comparable.Make.

For example,

module M = struct
  type t = ...
  [@@deriving compare, sexp]

  [%%functor include Comparable.Make]
end

is transformed (roughly) into

module M = struct
  module T = struct
    type t = ...
    [@@deriving compare, sexp]
  end

  include T
  include Comparable.Make(T)
end

Caveats

Unlike in OxCaml:

  • Auxiliary module Include_functor_* (like T) is exposed.
  • Generative functors are not supported.
  • Not supported in module signatures.

About

include functor as PPX

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages