package OCanren-ppx

  1. Overview
  2. Docs
Implementation of miniKanren relational (logic) EDSL: PPX extensions

Install

Dune Dependency

Authors

Maintainers

Sources

OCanren-ppx-0.2.0.tbz
sha256=77dd4b9d2b41f908ee4871612e78f455f9f0200a8c70321fcc82ebb53c86b4f0
sha512=c5dab91f59060f5dd5aecef5665e9235d8317cf071603070b0eef84ba6dc3a6ac027a8cf8aa37262109edb309b83c05f355a53c6718e43438164740c6b8715d4

doc/src/ppx_distrib/ppx_distrib.ml.html

Source file ppx_distrib.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
25
26
27
28
29
30
open Base
open Ppxlib
open Printf

let name = "distrib"

let () =
  Ppxlib.Driver.register_transformation
    ~impl:(fun ss ->
        let open Ppx_distrib_expander in
        let m = object(self)
          inherit Ast_traverse.map as super
          method! structure ss = (* TODO: Maybe we don't need this *)
            List.concat @@ List.map ~f:(self#do_structure_item) ss

          method do_structure_item si =
            match si.pstr_desc with
            | Pstr_type (flg,tydecls) ->
              List.concat @@ List.map tydecls
                ~f:(fun tydecl ->
                    if suitable_tydecl tydecl
                    then str_type_decl ~loc:si.pstr_loc (flg, tydecls)
                    else [{si with
                            pstr_desc = Pstr_type (flg, List.map ~f:(super#type_declaration) tydecls)}]
                  )
            | _ -> [super#structure_item si]
        end in
      m#structure ss
    )
    name
OCaml

Innovation. Community. Security.