All Projects → ocsigen → deriving

ocsigen / deriving

Licence: MIT License
Extension to OCaml for deriving functions from type declarations.

Programming Languages

ocaml
1615 projects

Deriving (was Deriving-ocsigen)

This release of deriving is based on the library by Jeremy Yallop. See:

Compared to the original library, it adds:

  • META file for ocamlfind compatibility
  • a type-conv compatibility mode
  • the generated code do not rely on recursive modules (this allows compatibility with js_of_ocaml)
  • minimalistic support of GADT

See CHANGES for more details.

Requirements:

  • ocaml and camlp4 (>= 3.12)
  • optcomp
  • type-conv (optionnal)

Build intructions:

 $ ./configure [--disable-tc]
 $ make

 # make install

Documention and examples of the original library:

Examples:

 $ ocaml
        Objective Caml version 4.01.0

 # #use "topfind";;
 - : unit = ()
 # #camlp4o;;
	Camlp4 Parsing version 4.01.0

 # #require "deriving";;
 # type t = A of int | B of t deriving (Show);;
 type t = A of int | B of t
 module rec Show_t : sig ... end
 # Show.show<t> (B (A 4));;
 - : string = "B A 4"

Examples with type-conv:

 $ ocaml
        Objective Caml version 4.01.0@

 # #use "topfind";;
 - : unit = ()
 # #camlp4o;;
	Camlp4 Parsing version 4.01.0

 # #require "deriving.tc";;
 # type t = A of int | B of t with show;;
 type t = A of int | B of t
 module rec Show_t : sig ... end
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].