Commits

camlspotter committed 6f45d89

incompatible: removed some ~f labels and old haskell $s (now we use & instead)

Comments (0)

Files changed (3)

 
 let (&.) f g = fun x -> f (g x)
 let (^.) = (&.)
-let (&) f x = f x
-let (&~) g f = g ~f;;
-let (^$) = (&)
-let (^$$) = (&~)
-let (|!) e f = f e
-let (|>) e f = f e
+external (&) : ('a -> 'b) -> 'a -> 'b = "%apply"
+external (&~) : (f:'a -> 'b) -> 'a -> 'b = "%apply"
+external (|!) : 'a -> ('a -> 'b) -> 'b = "%revapply"
+external (|>) : 'a -> ('a -> 'b) -> 'b =  "%revapply"
+
+external id : 'a -> 'a = "%identity"
+external (!&) : _ -> unit = "%ignore"
 
 exception Finally of exn * exn
 ;;
 val (&.) : ('b -> 'c) -> ('a -> 'b) -> ('a -> 'c)
   (** funciton composition: Haskell's (.) *)
 
-val (&) : ('a -> 'b) -> 'a -> 'b
-val (^$) : ('a -> 'b) -> 'a -> 'b
-val (&~) : (f:'a -> 'b) -> 'a -> 'b
-val (^$$) : (f:'a -> 'b) -> 'a -> 'b
+external (&) : ('a -> 'b) -> 'a -> 'b = "%apply"
+external (&~) : (f:'a -> 'b) -> 'a -> 'b = "%apply"
   (** Haskell's ($) *)
 
-val (|!) : 'a -> ('a -> 'b) -> 'b
-val (|>) : 'a -> ('a -> 'b) -> 'b
+external (|!) : 'a -> ('a -> 'b) -> 'b = "%revapply"
+external (|>) : 'a -> ('a -> 'b) -> 'b =  "%revapply"
   (** F#'s (|>) *)
 
+external id : 'a -> 'a = "%identity"
+external (!&) : _ -> unit = "%ignore"
+
 exception Finally of exn * exn
 
 val protect    : f:('a -> 'b) -> 'a -> finally: ('a -> unit) -> 'b
   
   type test_unary = string -> test_unary_result
   
-  let gen_uop ~stat ~f  file : test_unary_result =
+  let gen_uop ~stat ~f file : test_unary_result =
     try 
       let st = stat file in
       if f st then `True st else `False st
   val _c : test_unary (* FILE exists and is character special*)
   val _d : test_unary (* FILE exists and is a directory*)
   *)
-  let _d' = uop ^$$ fun stat -> stat.st_kind = S_DIR
+  let _d' = uop &~ fun stat -> stat.st_kind = S_DIR
   let _d = simplify _d'
   ;;
   
   (*
   val _f : test_unary (* FILE exists and is a regular file*)
   *)
-  let _f' = uop ^$$ fun stat -> stat.st_kind = S_REG
+  let _f' = uop &~ fun stat -> stat.st_kind = S_REG
   let _f = simplify _f'
 
   (*
   val _G : test_unary (* FILE exists and is owned by the effective group ID*)
   val _h : test_unary (* FILE exists and is a symbolic link (same as -L)*)
   *)
-  let _h' = luop ^$$ fun stat -> stat.st_kind = S_LNK
+  let _h' = luop &~ fun stat -> stat.st_kind = S_LNK
   let _h = simplify _h'
 
   (*
   val _r : test_unary (* FILE exists and read permission is granted*)
   val _s : test_unary (* FILE exists and has a size greater than zero*)
   *)
-  let _s' = uop ^$$ fun stat -> stat.st_size > 0
+  let _s' = uop &~ fun stat -> stat.st_size > 0
   let _s = simplify _s'
 
   (*