make CCList an applicative instance

This commit is contained in:
Simon Cruanes 2014-07-16 18:08:57 +02:00
parent 9488ff51c6
commit 633ded75c2
2 changed files with 4 additions and 0 deletions

View file

@ -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 =

View file

@ -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