diff --git a/core/CCList.ml b/core/CCList.ml index 2fca2327..b95942ed 100644 --- a/core/CCList.ml +++ b/core/CCList.ml @@ -160,6 +160,8 @@ let (>>=) l f = flat_map f l let (<$>) = map +let pure f = [f] + let (<*>) funs l = product (fun f x -> f x) funs l let sorted_merge ?(cmp=Pervasives.compare) l1 l2 = diff --git a/core/CCList.mli b/core/CCList.mli index 6a72b547..a94820f5 100644 --- a/core/CCList.mli +++ b/core/CCList.mli @@ -64,6 +64,8 @@ val diagonal : 'a t -> ('a * 'a) t (** All pairs of distinct positions of the list. [list_diagonal l] will return the list of [List.nth i l, List.nth j l] if [i < j]. *) +val pure : 'a -> 'a t + val (<*>) : ('a -> 'b) t -> 'a t -> 'b t val (<$>) : ('a -> 'b) -> 'a t -> 'b t