Object as a Morphism

Composable Structure Parameterized by Effects

Fumiaki Kinoshita, Kazuhiko Yamamoto, 2015

To deal with states in a unified type, sum types or existential quantification are widely used in Haskell. However, they are intractable because they are not extensible in either data or operations. For this reason, Haskell has been considered inappropriate for domains involving complex states. On the other hand, object oriented programming languages provide objects with subtyping. The convenience of polymorphism in a unified type made them successful in those domains. This paper presents an encoding of objects within the system of Haskell with several common language extensions. These objects form a category; the composition of objects subsumes a considerable number of object oriented notions, including inheritance, overriding and Adapter and Template Method patterns. Distinctively, our method can be used to express the death of objects safely.

Download the paper(PDF)

(This paper has been rejected from Haskell Symposium 2015)

Fumiaki Kinoshita, @fumieval