Haskell's overlooked object system
Oleg Kiselyov, Ralf Laemmel

TL;DR
This paper demonstrates that Haskell, with certain extensions, can fully support traditional object-oriented programming features including inheritance, encapsulation, and subtyping, challenging the view that Haskell's type system is incompatible with OO paradigms.
Contribution
It systematically shows that Haskell 98 with common extensions can implement comprehensive OO features, including advanced ones like multiple inheritance and safe downcasts.
Findings
Haskell supports all conventional OO features with extensions.
Haskell can handle subtyping, inheritance, and encapsulation.
The OOHaskell library enables OO programming in Haskell.
Abstract
Haskell provides type-class-bounded and parametric polymorphism as opposed to subtype polymorphism of object-oriented languages such as Java and OCaml. It is a contentious question whether Haskell 98 without extensions, or with common extensions, or with new extensions can fully support conventional object-oriented programming with encapsulation, mutable state, inheritance, overriding, statically checked implicit and explicit subtyping, and so on. We systematically substantiate that Haskell 98, with some common extensions, supports all the conventional OO features plus more advanced ones, including first-class lexically scoped classes, implicitly polymorphic classes, flexible multiple inheritance, safe downcasts and safe co-variant arguments. Haskell indeed can support width and depth, structural and nominal subtyping. We address the particular challenge to preserve Haskell's type…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Advanced Database Systems and Queries · Formal Methods in Verification
