annotate lib/ur/list.urs @ 2290:ab6ca12debeb

Add small benchmark (WIP).
author ziv@mit.edu
date Sun, 15 Nov 2015 18:10:24 -0500
parents d9f918b79b5a
children
rev   line source
adamc@794 1 datatype t = datatype Basis.list
adamc@794 2
adamc@846 3 val show : a ::: Type -> show a -> show (t a)
adamc@846 4 val eq : a ::: Type -> eq a -> eq (t a)
adamc@794 5
adamc@845 6 val foldl : a ::: Type -> b ::: Type -> (a -> b -> b) -> b -> t a -> b
adamc@850 7 val foldlAbort : a ::: Type -> b ::: Type -> (a -> b -> option b) -> b -> t a -> option b
adamc@850 8 val foldlMapAbort : a ::: Type -> b ::: Type -> c ::: Type
adamc@850 9 -> (a -> b -> option (c * b)) -> b -> t a -> option (t c * b)
adamc@845 10
adamc@1057 11 val foldr : a ::: Type -> b ::: Type -> (a -> b -> b) -> b -> t a -> b
adamc@1057 12
adamc@916 13 val length : a ::: Type -> t a -> int
adamc@916 14
adamc@794 15 val rev : a ::: Type -> t a -> t a
adamc@794 16
adamc@821 17 val revAppend : a ::: Type -> t a -> t a -> t a
adamc@821 18
adamc@821 19 val append : a ::: Type -> t a -> t a -> t a
adamc@821 20
adamc@794 21 val mp : a ::: Type -> b ::: Type -> (a -> b) -> t a -> t b
adamc@794 22
adamc@821 23 val mapPartial : a ::: Type -> b ::: Type -> (a -> option b) -> t a -> t b
adamc@821 24
adamc@1279 25 val mapi : a ::: Type -> b ::: Type -> (int -> a -> b) -> t a -> t b
adamc@1279 26
adamc@796 27 val mapX : a ::: Type -> ctx ::: {Unit} -> (a -> xml ctx [] []) -> t a -> xml ctx [] []
adamc@800 28
adam@1539 29 val mapXi : a ::: Type -> ctx ::: {Unit} -> (int -> a -> xml ctx [] []) -> t a -> xml ctx [] []
adam@1539 30
adamc@800 31 val mapM : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type
adamc@830 32 -> (a -> m b) -> t a -> m (t b)
adamc@830 33
adamc@1107 34 val mapPartialM : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type -> (a -> m (option b)) -> t a -> m (t b)
adamc@1107 35
adamc@830 36 val mapXM : m ::: (Type -> Type) -> monad m -> a ::: Type -> ctx ::: {Unit}
adamc@830 37 -> (a -> m (xml ctx [] [])) -> t a -> m (xml ctx [] [])
adamc@821 38
adam@1768 39 val mapXiM : m ::: (Type -> Type) -> monad m -> a ::: Type -> ctx ::: {Unit} -> (int -> a -> m (xml ctx [] [])) -> t a -> m (xml ctx [] [])
adam@1768 40
adamc@821 41 val filter : a ::: Type -> (a -> bool) -> t a -> t a
adamc@822 42
adamc@822 43 val exists : a ::: Type -> (a -> bool) -> t a -> bool
adamc@822 44
adamc@840 45 val foldlM : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type
adamc@840 46 -> (a -> b -> m b) -> b -> t a -> m b
adamc@840 47
adam@1547 48 val foldlMi : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type
adam@1547 49 -> (int -> a -> b -> m b) -> b -> t a -> m b
adam@1547 50
adam@1634 51 val filterM : m ::: (Type -> Type) -> monad m -> a ::: Type
adam@1634 52 -> (a -> m bool) -> t a -> m (t a)
adam@1634 53
adamc@822 54 val foldlMap : a ::: Type -> b ::: Type -> c ::: Type
adamc@822 55 -> (a -> b -> c * b) -> b -> t a -> t c * b
adamc@839 56
adam@2095 57 val mem : a ::: Type -> eq a -> a -> t a -> bool
adam@2095 58
adam@1519 59 val find : a ::: Type -> (a -> bool) -> t a -> option a
adam@1519 60
adamc@839 61 val search : a ::: Type -> b ::: Type -> (a -> option b) -> t a -> option b
adamc@843 62
adamc@843 63 val all : a ::: Type -> (a -> bool) -> t a -> bool
adamc@844 64
adamc@844 65 val app : m ::: (Type -> Type) -> monad m -> a ::: Type
adamc@844 66 -> (a -> m unit) -> t a -> m unit
adamc@845 67
adam@1840 68 val tabulateM : m ::: (Type -> Type) -> monad m -> a ::: Type
adam@1840 69 -> (int -> m a) -> int -> m (t a)
adam@1840 70
adamc@908 71 val mapQuery : tables ::: {{Type}} -> exps ::: {Type} -> t ::: Type
adamc@908 72 -> [tables ~ exps] =>
adam@1394 73 sql_query [] [] tables exps
adamc@908 74 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables) -> t)
adamc@908 75 -> transaction (list t)
adamc@845 76
adamc@1107 77 val mapQueryM : tables ::: {{Type}} -> exps ::: {Type} -> t ::: Type
adamc@1107 78 -> [tables ~ exps] =>
adam@1394 79 sql_query [] [] tables exps
adamc@1107 80 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables) -> transaction t)
adamc@1107 81 -> transaction (list t)
adamc@1107 82
adamc@1107 83 val mapQueryPartialM : tables ::: {{Type}} -> exps ::: {Type} -> t ::: Type
adamc@1107 84 -> [tables ~ exps] =>
adam@1394 85 sql_query [] [] tables exps
adamc@1107 86 -> ($(exps ++ map (fn fields :: {Type} => $fields) tables) -> transaction (option t))
adamc@1107 87 -> transaction (list t)
adamc@1107 88
adam@1321 89 val sort : a ::: Type -> (a -> a -> bool) (* > predicate *) -> t a -> t a
adam@1321 90
adam@1322 91 val nth : a ::: Type -> list a -> int -> option a
adam@1345 92 val replaceNth : a ::: Type -> list a -> int -> a -> list a
adam@1322 93
adamc@845 94 (** Association lists *)
adamc@845 95
adamc@845 96 val assoc : a ::: Type -> b ::: Type -> eq a -> a -> t (a * b) -> option b
adamc@845 97
adamc@845 98 val assocAdd : a ::: Type -> b ::: Type -> eq a -> a -> b -> t (a * b) -> t (a * b)
greenrd@1481 99
greenrd@1481 100 (** Converting records to lists *)
greenrd@1481 101
greenrd@1481 102 val recToList : a ::: Type -> r ::: {Unit} -> folder r -> $(mapU a r) -> t a
adam@1634 103
adam@1634 104 (* Divide a list into two sections at a particular 0-based position, returning the second, first, or both parts, respectively. *)
adam@1634 105 val drop : t ::: Type -> int -> list t -> list t
adam@1634 106 val take : t ::: Type -> int -> list t -> list t
adam@1634 107 val splitAt : t ::: Type -> int -> list t -> list t * list t