Skip to content

modular-implicits/generics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An OCaml Generics Library

The library derives many other implicit modules from the Generic module.

To use the derivations available you must implement the Generic module for your type:

implicit module GenBasicSum = struct 
  type t = basic 
  type rep = (int basic, string basic) sum
  let toRep = function 
                  | L x -> Left (Basic ("L", x))
                  | R x -> Right (Basic ("R", x))
  let fromRep = function
                | Left (Basic (_, x)) -> L x
                | Right (Basic (_, x)) -> R x
end

You may then use any module that Generics derives in this library or others:

assert (show (L 1) = "L 1");

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages