Import Hooks

The Binding Generator C->Haskell : Implementation of Haskell Binding Modules : Import Hooks
Previous: Implementation of Haskell Binding Modules
Next: Context Hooks

## 2.1. Import Hooks

> `{#import [qualified] modid#}`

Is translated into the same syntactic form in Haskell, which implies that it may be followed by an explicit import list. Moreover, it implies that the module modid is also generated by C->Haskell and instructs the tool to read the file modid`.chi`.

If an explicit output file name is given (`--output` option), this name determines the basename for the `.chi` file of the currently translated module.

Currently, only pointer hooks generate information that is stored in a `.chi` file and needs to be incorporated into any client module that makes use of these pointer types. It is, however, regarded as good style to use import hooks for any module generated by C->Haskell.

Restriction: C->Haskell does not use qualified names. This can be a problem, for example, if two pointer hooks are defined to have the same unqualified Haskell name in two different modules, which are then imported by a third module. To partially work around this problem, it is guaranteed that the declaration of the textually later import hook dominates.

The Binding Generator C->Haskell : Implementation of Haskell Binding Modules : Import Hooks
Previous: Implementation of Haskell Binding Modules
Next: Context Hooks