mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
make CCList an applicative instance
This commit is contained in:
parent
9488ff51c6
commit
633ded75c2
2 changed files with 4 additions and 0 deletions
|
|
@ -160,6 +160,8 @@ let (>>=) l f = flat_map f l
|
||||||
|
|
||||||
let (<$>) = map
|
let (<$>) = map
|
||||||
|
|
||||||
|
let pure f = [f]
|
||||||
|
|
||||||
let (<*>) funs l = product (fun f x -> f x) funs l
|
let (<*>) funs l = product (fun f x -> f x) funs l
|
||||||
|
|
||||||
let sorted_merge ?(cmp=Pervasives.compare) l1 l2 =
|
let sorted_merge ?(cmp=Pervasives.compare) l1 l2 =
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,8 @@ val diagonal : 'a t -> ('a * 'a) t
|
||||||
(** All pairs of distinct positions of the list. [list_diagonal l] will
|
(** 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]. *)
|
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) t -> 'a t -> 'b t
|
||||||
|
|
||||||
val (<$>) : ('a -> 'b) -> 'a t -> 'b t
|
val (<$>) : ('a -> 'b) -> 'a t -> 'b t
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue