Controlling the scope of instances in Haskell

Marco GontijoCarlos Camarão

The Haskell module system aims for simplicity and has a notable advantage of being easy to learn and use. However, type class instances in Haskell are always exported and imported between modules. This breaches uniformity and simplicity of the module system and introduces practical problems. Firstly, it is not possible to define two distinct instances of the same type class for the same type in a program. Secondly, instances created in different modules can conflict with each other, and can make it impossible to import two modules that contain instance definitions even if the instances are not used in the importing module. In this paper we present and discuss a solution to these problems, that simply allows importation and exportation of instances between modules. We also show how a formal specification of the module system must be adapted to handle instances and to include our proposal.

Caso o link acima esteja inválido, faça uma busca pelo texto completo na Web: Buscar na Web

Biblioteca Digital Brasileira de Computação - Contato:
     Mantida por: