Patterns for computational effects arising from a monad or a comonad - Archive ouverte HAL Accéder directement au contenu
Rapport Année : 2013

Patterns for computational effects arising from a monad or a comonad

Résumé

We propose patterns for proving properties of programs involving computational effects, in the framework of decorated logics. Although this framework does not mention monads nor comonads, it can be instantiated for a combination of monads and comonads. We propose two dual patterns. The first one provides inference rules which can be interpreted in the Kleisli category of a monad and the coKleisli category of the associated comonad. For instance, in this pattern, the raising of exceptions corresponds to the exception monad (with endofunctor $A+E$) on some category and their handling corresponds to a comonad (with the same endofunctor $A+E$) on the Kleisli category of the monad. In a dual way, the second pattern provides inference rules which can be interpreted in the coKleisli category of a comonad and the Kleisli category of the associated monad. For instance, in this pattern, the lookup operation on states corresponds to the comonad with endofunctor $A\times S$ and the update operation corresponds to a monad on the coKleisli category of the comonad. Each pattern consists in a language with an inference system. This system can be used for proving properties of programs which involve an effect that can be associated to a monad (respectively a comonad). The pattern provides generic rules for dealing with any monad (respectively comonad), and it can be extended with specific rules for each effect.
Fichier principal
Vignette du fichier
patternsmonads.pdf (225.23 Ko) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)

Dates et versions

hal-00868831 , version 1 (02-10-2013)
hal-00868831 , version 2 (14-10-2013)

Identifiants

Citer

Jean-Guillaume Dumas, Dominique Duval, Jean-Claude Reynaud. Patterns for computational effects arising from a monad or a comonad. 2013. ⟨hal-00868831v1⟩
277 Consultations
131 Téléchargements

Altmetric

Partager

Gmail Facebook X LinkedIn More