Commits

camlspotter  committed dbff3a8

added ok, ng, !!%

  • Participants
  • Parent commits f8985d2

Comments (0)

Files changed (5)

 - Added List.{partition, partition_map}
 - Tweaked String.{is_prefix, is_postfix} labels
 - Added String.{is_prefix', is_postfix', drop_postfix}
+- Added ok, ng, !!%
 
 2.1.2
 ------------
 (* Printf *)
 let sprintf = Printf.sprintf
 let (!%) = Printf.sprintf
+let (!!%) = Format.eprintf
 
 let with_ref r v f =
   let back_v = !r in

File lib/base.mli

 val (!%)    : ('a, unit, string) format -> 'a
 (** [Printf.sprintf], prefix style. Bought from ITPL. *)
 
+val (!!%)    : ('a, Format.formatter, unit) format -> 'a
+(** [Format.eprintf], prefix style. *)
+
 val memoize : ('c -> 'd) -> 'c -> 'd
 (** Memozation by hash *)
 

File lib/result.ml

   
 module Pervasives = struct
 
+  let ok x = `Ok x
+  let ng x = `Error x
+
   let from_Ok to_exn = function
     | `Ok v -> v
     | `Error e -> raise (to_exn e)

File lib/result.mli

 (** Haskell's either *)
 
 module Pervasives : sig
+  val ok : 'a -> [> `Ok of 'a ]
+  val ng : 'a -> [> `Error of 'a ]
+  (** No Good *)
+
   val from_Ok : ('error -> exn) -> [< ('a, 'error) t] -> 'a
 
   val result : ('a -> 'b) -> ('c -> 'b) -> [< ('a, 'c) t] -> 'b