← All stories
● Covered by 1 source Β· 1 reportMedium impact

Introduction to Actegories and Monoidal Categories

Aggregated by BrevFeed dev Β· updated 1h ago
πŸ”– Save

This article introduces actegories, focusing on their role in optics and their definition through monoidal categories. It offers a Haskell implementation of monoidal categories, highlighting the notion of tensor products and constraints in type classes.

Key points

Understanding Actegories

Actegories are an important concept in programming, specifically in optics, which includes lenses, prisms, and traversals. To effectively work with actegories, one must first grasp the concept of monoidal categories.

Definition of Monoidal Categories

A monoidal category incorporates a tensor product, which is a functor ensuring associativity and unitality up to isomorphism. It includes an invertible associator and unit object, alongside two unitors that are also invertible and natural.

Modeling Monoidal Categories in Haskell

In Haskell, monoidal categories can be parameterized by the type of the tensor product. The article presents a way to define a 'MonoidalCategory' type class that incorporates these structures, specifying how to work with types in a monoidal context.

Addressing Circularity in Type Constraints

A challenge arises when encoding units as associated types due to potential circular dependencies. This can be resolved using the 'UndecidableSuperClasses' pragma, allowing the specification of types while maintaining the required constraints.

Examples of Monoidal Categories

An example presented is the 'Hask' category, using cartesian products as the tensor. This implementation serves as a baseline to further explore categories within Haskell, showing the application of theoretical concepts in practical programming.

✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors β€” check the original sources. How BrevFeed works β†’

Reporting from

This article introduces actegories, focusing on their role in optics and their definition through monoidal categories. It offers a Haskell implementation of monoidal categories, highlighting the notion of tensor products and constraints in type classes.