package alg_structs

  1. Overview
  2. Docs

Module Applicative.LawSource

Law notes the laws that should be obeyed by any instantiation of Applicative in the form of predicates that should be true for any arguments of the appropriate type.

You can use Alg_qcheck.Applicative to generate property based tests of these laws for new modules satisfying this interface.

Parameters

module A : S

Signature

Sourceval identity : 'a A.t -> bool

identity x: return Fun.id <*> x = x

Sourceval composition : ('b -> 'c) A.t -> ('a -> 'b) A.t -> 'a A.t -> bool

composition u v w: (return (%) <*> u <*> v <*> w) = (u <*> (v <*> w))

Sourceval homomorphism : ('a -> 'b) -> 'a -> bool

homomorphism f x: return f <*> return x = return (f x)

Sourceval interchange : ('a -> 'b) A.t -> 'a -> bool

interchange u y: (u <*> return y) = (return (fun f -> f y) <*> u)

OCaml

Innovation. Community. Security.