package preface

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

Source file category.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
module type LAWS = sig
  type ('a, 'b) t

  val category_1 : unit -> (('a, 'b) t, ('a, 'b) t) Law.t
  val category_2 : unit -> (('a, 'b) t, ('a, 'b) t) Law.t
end

module For (C : Preface_specs.CATEGORY) :
  LAWS with type ('a, 'b) t := ('a, 'b) C.t = struct
  open Law
  include Semigroupoid.For (C)

  let category_1 () =
    let lhs f = C.(f % id)
    and rhs f = f in
    law ("f % id" =~ lhs) ("f" =~ rhs)
  ;;

  let category_2 () =
    let lhs f = C.(id % f)
    and rhs f = f in
    law ("id % f" =~ lhs) ("f" =~ rhs)
  ;;
end
OCaml

Innovation. Community. Security.