functional
Functional programming in C Why The purpose of this library is to exercise an approach to functional programming in C on top of the existing C and with the aim of eventually extending the future versions of the C standard library with the functionality found to work well How The approach is to take the existing types in the C standard library when appropriate and extend them via inheritance with the facilities useful in writing functional style programs Eventually the proposed functionality will be hopefully folded into the existing types and new types will be added What The library provides following utilities functors extensible system of encapsulation of monadic operations expressed with a pipe sum of types coproduct of types similar to but indexed by type rather than order composes with the product of types choice monad monad built on top of the coproduct of types dispatch by overloading rules pack product of types similar to composes with the coproduct of types composition monadic types containing arbitrary types products or coproducts can be combined with multidispatch dispatch any valid combination of product s and coproduct s to a function based on overloading rules graded monad integrate coproduct into and monads enables extensible error types and more Acknowledgments Gaper Aman for providing the inspiration in Fun ctional C and the M word Bartosz Milewski for taking the time to explain parametrised and graded monads and effect systems Ripple for allowing the main author the time to work on this library std std expected std optional std std std operator | std variant std tuple operator & optional expected expected