camlspotter avatar camlspotter committed 5677ae6

compiled

Comments (0)

Files changed (7)

 MyOCamlProgram(gen_phantom, $(PHANTOM_GEN))
 
 phantom2.ml: phantom2_head.ml phantom2_tail.ml gen_phantom.run
-    ./gen_phantom ml > $@
+    ./gen_phantom.run ml > $@
 
 phantom2.mli: phantom2_head.mli phantom2_tail.mli gen_phantom.run
-    ./gen_phantom mli > $@
+    ./gen_phantom.run mli > $@
 
 clean:
 	rm -f phantom2.ml phantom2.mli
- 
     let r = f v in
     Hashtbl.replace cache v r;
     r
+
+let (@@) f g = fun x -> f (g x)
+let (^^) f x = f x
 val failwithf : ('a, unit, string, 'b) format4 -> 'a
 
 val memoize : ('c -> 'd) -> 'c -> 'd
+
+val (@@) : ('b -> 'c) -> ('a -> 'b) -> ('a -> 'c)
+  (** funciton composition: Haskell's (.) *)
+val (^^) : ('a -> 'b) -> 'a -> 'b
+  (** Haskell's ($) *)
         (list (fun ppf -> fprintf ppf " * ")
            t) (Xlist.from_to 1 n)
 
-let max = 16
+let max = 3
 
 let type_ts ppf n =
   let kwd = if n = 0 then "type" else "and" in
   fprintf ppf "%s %a = <@." kwd ts n;
   fprintf ppf "    list : 'content list;@.";
+  fprintf ppf "    array : 'content array;@.";
   fprintf ppf "    get : %a;@." get_type n;
   for i = 1 to n do
     fprintf ppf "    get%d : %a;@." i t i
     (list (fun ppf -> fprintf ppf "; ")
        (fun ppf i -> fprintf ppf "v%d" i)) (Xlist.from_to 1 n)
   
+let def_array ppf n =
+  fprintf ppf "[|%a|]"
+    (list (fun ppf -> fprintf ppf "; ")
+       (fun ppf i -> fprintf ppf "v%d" i)) (Xlist.from_to 1 n)
+  
 let def_get ppf = function
   | 0 -> fprintf ppf "()"
   | 1 -> fprintf ppf "v1"
   let kwd = if n = 0 then "let rec" else "and" in
   fprintf ppf "%s %a = object@." kwd call n;
   fprintf ppf "  method list = %a@." def_list n;
+  fprintf ppf "  method array = %a@." def_array n;
   fprintf ppf "  method get = %a@." def_get n;
   for i = 1 to n do
     fprintf ppf "  method get%d = v%d@." i i
 let unsafe x = x
 let magic x = x
 
-type ('phantoms, 'content) ts = 'content list
-

phantom2_head.mli

 val magic : ('phantom1, 'content) t -> ('phantom2, 'content) t
   (** unsafe replacement of phantom *)
 
-type ('phantoms, 'content) ts = 'content list
+(** tsN : encoding of heterogeneous phantom tuple/list *)
 
-(** tsN : encoding of heterogeneous phantom tuple/list *)
 
 module Phantom_intf = Phantom_intf
 module Phantom = Phantom
+module Phantom2 = Phantom2
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.