Module Preface_specs.Freer_selective

A Freer selective allows you to build a rigid Preface_specs.Selective from a given arbitrary type.

Such Preface_specs.selective is equipped with and additional function for promoting values from the underlying type into the Freer selective and a Natural transformations for transforming the value of the Freer selective to an other Preface_specs.Selective or to a Preface_specs.Monoid.

Note about complexity

Although free constructs are elegant, they introduce an execution cost due to the recursive nature of defining the type of a Freer Selective, map and select (so it also applies to derived combinators) have O(n) complexity. There are cheaper encodings but they are not, for the moment, available in Preface.

Structure anatomy

module type TO_SELECTIVE = sig ... end

The natural transformation for Freer Selective to Selective.

module type TO_MONOID = sig ... end

The natural transformation for Freer Selective to Monoid.

module type CORE = sig ... end

The Freer selective API without the Preface_specs.Selective API.

Complete API

module type API = sig ... end

The complete interface of a Freer selective.

Additional references