package preface

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file writer.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
module R (Req_m : Model.COVARIANT_1) (Req_t : Model.T0) = struct
  type 'a t = ('a * Req_t.t) Req_m.t

  let equal f a b =
    Req_m.equal
      (fun (x, tape_x) (y, tape_y) -> f x y && Req_t.equal tape_x tape_y)
      a b
  ;;

  let pp f ppf x =
    Format.fprintf ppf "%a"
      (Req_m.pp (fun ppf (x, tape) ->
           Format.fprintf ppf "(%a, %a)" f x Req_t.pp tape ) )
      x
  ;;

  let generator g = Req_m.generator (QCheck2.Gen.tup2 g Req_t.generator)

  let observable o =
    Req_m.observable (QCheck2.Observable.pair o Req_t.observable)
  ;;
end

module Suite
    (Req_m : Model.COVARIANT_1)
    (M : Preface_specs.MONAD with type 'a t = 'a Req_m.t)
    (Req_t : Model.T0)
    (Tape : Preface_specs.MONOID with type t = Req_t.t)
    (A : Model.T0)
    (B : Model.T0)
    (C : Model.T0)
    (D : Model.T0) =
struct
  module W = Preface_make.Writer.Over_monad (M) (Tape)
  include Monad.Suite (R (Req_m) (Req_t)) (W) (A) (B) (C) (D)
end

module Suite_functor
    (Req_m : Model.COVARIANT_1)
    (M : Preface_specs.FUNCTOR with type 'a t = 'a Req_m.t)
    (Req_t : Model.T0)
    (Tape : Preface_specs.MONOID with type t = Req_t.t)
    (A : Model.T0)
    (B : Model.T0)
    (C : Model.T0) =
struct
  module W = Preface_make.Writer.Functor (M) (Tape)
  include Functor.Suite (R (Req_m) (Req_t)) (W) (A) (B) (C)
end

module Suite_invariant
    (Req_m : Model.COVARIANT_1)
    (M : Preface_specs.FUNCTOR with type 'a t = 'a Req_m.t)
    (Req_t : Model.T0)
    (Tape : Preface_specs.MONOID with type t = Req_t.t)
    (A : Model.T0)
    (B : Model.T0)
    (C : Model.T0) =
struct
  module F = Preface_make.Writer.Functor (M) (Tape)
  module W = Preface_make.Invariant.From_functor (F)
  include Invariant.Suite (R (Req_m) (Req_t)) (W) (A) (B) (C)
end

module Suite_applicative
    (Req_m : Model.COVARIANT_1)
    (M : Preface_specs.APPLICATIVE with type 'a t = 'a Req_m.t)
    (Req_t : Model.T0)
    (Tape : Preface_specs.MONOID with type t = Req_t.t)
    (A : Model.T0)
    (B : Model.T0)
    (C : Model.T0) =
struct
  module W = Preface_make.Writer.Applicative (M) (Tape)
  include Applicative.Suite (R (Req_m) (Req_t)) (W) (A) (B) (C)
end

module Suite_alternative
    (Req_m : Model.COVARIANT_1)
    (M : Preface_specs.ALTERNATIVE with type 'a t = 'a Req_m.t)
    (Req_t : Model.T0)
    (Tape : Preface_specs.MONOID with type t = Req_t.t)
    (A : Model.T0)
    (B : Model.T0)
    (C : Model.T0) =
struct
  module W = Preface_make.Writer.Alternative (M) (Tape)
  include Alternative.Suite (R (Req_m) (Req_t)) (W) (A) (B) (C)
end

module Suite_monad_plus
    (Req_m : Model.COVARIANT_1)
    (M : Preface_specs.MONAD_PLUS with type 'a t = 'a Req_m.t)
    (Req_t : Model.T0)
    (Tape : Preface_specs.MONOID with type t = Req_t.t)
    (A : Model.T0)
    (B : Model.T0)
    (C : Model.T0)
    (D : Model.T0) =
struct
  module W = Preface_make.Writer.Monad_plus (M) (Tape)
  include Monad_plus.Suite (R (Req_m) (Req_t)) (W) (A) (B) (C) (D)
end
OCaml

Innovation. Community. Security.