Structural polymorphism in Generic Haskell

308 views · Published 7 September 2016 · 58:43 · Indexed 26 October 2026

Channel: Microsoft Research · 2016 · Science & Technology

Watch on YouTube

Using `Generic Haskell`, an extension of the functional programming language Haskell, one can define `structurally polymorphic functions`: functions that take a type argument and are defined by induction on the structure of datatypes.   Using this mechanism, functions such as equality, comparison, parsing and pretty printing, but also several forms of traversals and queries on data structures can be expressed.   Such functions are defined once, in a type-safe way, and can then be used on all Haskell datatypes.    The talk will introduce structural polymorphism in contrast to parametric and ad-hoc polymorphism, both of which are already supported in standard Haskell. The core features of Generic Haskell will be highlighted using several examples of type-indexed functions.

More from this channel