package preface

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

Source file semigroup.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module type LAWS = sig
  type t

  val semigroup_1 : unit -> (t, t -> t -> t) Law.t
end

module For (S : Preface_specs.SEMIGROUP) : LAWS with type t := S.t = struct
  open Law

  let semigroup_1 () =
    let lhs a b c = S.(Infix.(a <|> b) <|> c)
    and rhs a b c = S.(a <|> Infix.(b <|> c)) in

    law ("(a <|> b) <|> c" =~ lhs) ("a <|> (b <|> c)" =~ rhs)
  ;;
end
OCaml

Innovation. Community. Security.