Explicit Implicit Parameters

Stc
Date: 2005-06-02

Time: 11:45

Room: CGN room C004

Speaker: Atze Dijkstra

Title: Explicit implicit parameters

Abstract

In almost all languages arguments to functions are to be given explicitly. The Haskell class system however is an exception: functions can have class predicates as part of their type signature, and dictionaries are implicitly constructed and implicitly passed as hidden arguments, thus relieving the programmer from a lot of clerical work and removing clutter from the program text. Unfortunately Haskell maintains a very strict boundary between the implicit and the explicit world; if the implicit mechanisms fail to construct the hidden dictionaries there is no way the programmer can provide help, nor is he able to override the choices made by the implicit mechanisms.

In this paper we describe, in the context of Haskell, a mechanism that allows the programmer to explicitly pass implicit parameters. This extension blends well with existing resolution mechanisms, since it only overrides the default behavior of such mechanisms. We also describe its implementation. We include a description of the use of partial type signatures, liberating the programmer from having to choose between specifying a complete type signature or no type signature at all. Finally we show how the system can easily be extended to deal with higher-order predicates, thus enabling the elegant formulation of some form of generic programming.

See also

Ehc, Atze