comparison lib/ur/list.urs @ 1634:f4cb4eebf7ae

Some new List functions, based on code by Ron de Bruijn
author Adam Chlipala <adam@chlipala.net>
date Sun, 11 Dec 2011 15:02:55 -0500
parents 553a5cc3a4b5
children a613cae954ca
comparison
equal deleted inserted replaced
1633:deeeb036c8ed 1634:f4cb4eebf7ae
44 -> (a -> b -> m b) -> b -> t a -> m b 44 -> (a -> b -> m b) -> b -> t a -> m b
45 45
46 val foldlMi : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type 46 val foldlMi : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type
47 -> (int -> a -> b -> m b) -> b -> t a -> m b 47 -> (int -> a -> b -> m b) -> b -> t a -> m b
48 48
49 val filterM : m ::: (Type -> Type) -> monad m -> a ::: Type
50 -> (a -> m bool) -> t a -> m (t a)
51
49 val foldlMap : a ::: Type -> b ::: Type -> c ::: Type 52 val foldlMap : a ::: Type -> b ::: Type -> c ::: Type
50 -> (a -> b -> c * b) -> b -> t a -> t c * b 53 -> (a -> b -> c * b) -> b -> t a -> t c * b
51 54
52 val find : a ::: Type -> (a -> bool) -> t a -> option a 55 val find : a ::: Type -> (a -> bool) -> t a -> option a
53 56
88 val assocAdd : a ::: Type -> b ::: Type -> eq a -> a -> b -> t (a * b) -> t (a * b) 91 val assocAdd : a ::: Type -> b ::: Type -> eq a -> a -> b -> t (a * b) -> t (a * b)
89 92
90 (** Converting records to lists *) 93 (** Converting records to lists *)
91 94
92 val recToList : a ::: Type -> r ::: {Unit} -> folder r -> $(mapU a r) -> t a 95 val recToList : a ::: Type -> r ::: {Unit} -> folder r -> $(mapU a r) -> t a
96
97 (* Divide a list into two sections at a particular 0-based position, returning the second, first, or both parts, respectively. *)
98 val drop : t ::: Type -> int -> list t -> list t
99 val take : t ::: Type -> int -> list t -> list t
100 val splitAt : t ::: Type -> int -> list t -> list t * list t