From 8f4c1a24b7a83bb96bd18072b2fa20b544f56706 Mon Sep 17 00:00:00 2001 From: Nicola Mometto Date: Tue, 6 Mar 2018 15:37:57 +0000 Subject: [PATCH] default uses labelled argument --- src/iter/CCLazy_list.ml | 10 +++++----- src/iter/CCLazy_list.mli | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/iter/CCLazy_list.ml b/src/iter/CCLazy_list.ml index 3fc011ea..40a416d9 100644 --- a/src/iter/CCLazy_list.ml +++ b/src/iter/CCLazy_list.ml @@ -82,11 +82,11 @@ let rec flat_map ~f l = Lazy.force res ) -let default b a = +let default ~default l = lazy ( - match a with - | lazy Nil -> Lazy.force b - | lazy a -> a + match l with + | lazy Nil -> Lazy.force default + | lazy l -> l ) (*$= @@ -96,7 +96,7 @@ let default b a = module Infix = struct let (>|=) x f = map ~f x let (>>=) x f = flat_map ~f x - let (<|>) = default + let (<|>) a b = default ~default:b a end include Infix diff --git a/src/iter/CCLazy_list.mli b/src/iter/CCLazy_list.mli index 06983522..5f850518 100644 --- a/src/iter/CCLazy_list.mli +++ b/src/iter/CCLazy_list.mli @@ -45,7 +45,7 @@ val append : 'a t -> 'a t -> 'a t val flat_map : f:('a -> 'b t) -> 'a t -> 'b t (** Monadic flatten + map. *) -val default : 'a t -> 'a t -> 'a t +val default : default:'a t -> 'a t -> 'a t (** Choice operator. @since NEXT_RELEASE *)