package preface
Source file traversable.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72open Preface_core.Fun module Core (Req : Preface_specs.Traversable.WITH_TRAVERSE) = Req module Core_over_applicative (A : Preface_specs.APPLICATIVE) (Req : Preface_specs.Traversable.WITH_TRAVERSE with type 'a t = 'a A.t) = Core (Req) module Core_over_monad (M : Preface_specs.MONAD) (Req : Preface_specs.Traversable.CORE with type 'a t = 'a M.t) = Core (Req) module Operation (C : Preface_specs.Traversable.CORE) = struct type 'a t = 'a C.t type 'a iter = 'a C.iter let sequence x = C.traverse id x end module Via (C : Preface_specs.Traversable.CORE) (O : Preface_specs.Traversable.OPERATION with type 'a t = 'a C.t and type 'a iter = 'a C.iter) = struct include C include O end module Over_applicative (A : Preface_specs.APPLICATIVE) (Req : Preface_specs.Traversable.WITH_TRAVERSE with type 'a t = 'a A.t) = struct module Core = Core_over_applicative (A) (Req) module Operation = Operation (Core) include Core include Operation end module Over_monad (M : Preface_specs.MONAD) (Req : Preface_specs.Traversable.WITH_TRAVERSE with type 'a t = 'a M.t) = struct module Core = Core_over_monad (M) (Req) module Operation = Operation (Core) include Core include Operation end module Join_with_monad (I : Preface_specs.MONAD) (T : functor (M : Preface_specs.MONAD) -> Preface_specs.TRAVERSABLE with type 'a t = 'a M.t and type 'a iter = 'a I.t) = struct module Traversable = T include I end module Join_with_applicative (I : Preface_specs.APPLICATIVE) (T : functor (A : Preface_specs.APPLICATIVE) -> Preface_specs.TRAVERSABLE with type 'a t = 'a A.t and type 'a iter = 'a I.t) = struct module Traversable = T include I end