package alg_structs

  1. Overview
  2. Docs

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

See wikipedia's definition functors for the mathematical expression of these properties.

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

  • parameter F

    An implementation of a Functor


module F : S


val identity : 'a F.t -> bool

identity x is true when x = x
val composition : ('a -> 'b) -> ('c -> 'a) -> 'c F.t -> bool

composition f g x is true when ~f:(f % g) x = ( ~f % ~f:g) x

where % is composition.


Innovation. Community. Security.