From: Matthias Goergens Date: Thu, 17 Jun 2010 21:16:18 +0000 (+0100) Subject: stdext/Either: A module for type ('a, 'b) t = Left of 'a | Right of 'b X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e8c7eb3866b4461dd7221f1e08942f7c7531bc66;p=xcp%2Fxen-api-libs.git stdext/Either: A module for type ('a, 'b) t = Left of 'a | Right of 'b and helper functions. Signed-off-by: Matthias Goergens --- diff --git a/stdext/Makefile b/stdext/Makefile index 728d3ea..cba57bd 100644 --- a/stdext/Makefile +++ b/stdext/Makefile @@ -22,7 +22,7 @@ OCAML_TEST_LIB = $(shell ocamlfind query oUnit)/oUnit.cmxa STDEXT_OBJS = fun listext filenameext stringext arrayext hashtblext pervasiveext threadext ring \ qring fring opt bigbuffer unixext range vIO trie config date encodings fe fecomms \ - forkhelpers gzip sha1sum zerocheck base64 backtrace tar mapext os + forkhelpers gzip sha1sum zerocheck base64 backtrace tar mapext os either INTF = $(foreach obj, $(STDEXT_OBJS),$(obj).cmi) LIBS = stdext.cma stdext.cmxa diff --git a/stdext/either.ml b/stdext/either.ml index fe0679d..42e6fe1 100644 --- a/stdext/either.ml +++ b/stdext/either.ml @@ -1,5 +1,4 @@ open Pervasiveext -open Listext type ('a,'b) t = Left of 'a | Right of 'b @@ -13,7 +12,7 @@ let to_option = function | Right x -> Some x | Left _ -> None -let cat_right l = List.unbox_list ++ List.map to_option $ l +let cat_right l = Opt.cat_some ++ List.map to_option $ l let join = function | Right (Right x) -> Right x