Type Families with Class, Type Classes with Family

A. Serrano Mena, J. Hage, P. Bahr

    Research output: Contribution to conferencePaperOther research output

    Abstract

    Type classes and type families are key ingredients in Haskell programming. Type classes were introduced to deal with ad-hoc polymorphism, although with the introduction of functional dependencies, their use expanded to type-level programming. Type families also allow encoding type-level functions, now as rewrite rules. This paper looks at the interplay of type classes and type families, and how to deal with shortcomings in both of them. Furthermore, we show how to use families to simulate classes at the type level. However, type families alone are not enough for simulating a central feature of type classes: elaboration, that is, generating code from the derivation of a rewriting. We look at ways to solve this problem in current Haskell, and propose an extension to allow elaboration during the rewriting phase.
    Original languageEnglish
    Pages129-140
    DOIs
    Publication statusPublished - 30 Aug 2015
    EventHaskell Symposium 2015 - Vancouver, Canada
    Duration: 3 Sept 20154 Sept 2015

    Workshop

    WorkshopHaskell Symposium 2015
    Country/TerritoryCanada
    CityVancouver
    Period3/09/154/09/15

    Keywords

    • Type classes
    • Type families
    • Haskell
    • Elaboration
    • Functional dependencies
    • Directives

    Fingerprint

    Dive into the research topics of 'Type Families with Class, Type Classes with Family'. Together they form a unique fingerprint.

    Cite this