Objects To Unify Type Classes And GADTs
Stc
Date: 2010-05-20
Time: 12:00
Room:
BBL 023
Speaker: Vali Georgescul
Title: Objects to unify type classes and GADTs
Abstract
Type classes and generalized algebraic datatypes (GADTs) are commonly considered to be orthogonal concepts. In GHC they don't interact particularly well and can sometimes cause confusion. A Haskell-like language where type classes and GADTs are unified into a single class construct is presented. Classes are first-class types, while objects (replacing type class instances and data constructors) are used to define the values of the classes. Pattern matching is still possible by using sealed classes. The resulting language is simple and intuitive and can be used to define, with similar convenience, the same programs that we would define in Haskell. Furthermore, unlike Haskell, dictionaries (or objects) can be explicitly (as well as implicitly) passed to functions and we can program in a simple object-oriented style directly.