Programming with monoidal profunctors and semiarrows
Alexandre Garcia de Oliveira · 2023
This work investigates monoidal profunctors and their extensions, such as effectful monoidal profunctors and semiarrows, as tools for reasoning and structuring pure functional programs from a categorical perspective and within a Haskell implementation.We approach them as monoids within a specific monoidal category of profunctors and as semiarrows in a semiarrow category.We examine the properties of this monoidal category and construct and implement the free monoidal profunctor.Furthermore, we detail the properties and laws of a semiarrow, deriving examples of its usage and highlighting its potential for effectively managing delays in synchronous programs.Moore machines serve as an illustrative example.Additional applications include optics and a monoidal profunctor structure-preserving connection between Moore machines, left scans, and left folds.