Auto Completion of Identifiers
Haskell for Mac 1.3.2 (with some refinements in 1.3.3) introduced auto-completion of identifiers, such as variable, function, constructor, and type names.
When you briefly pause typing, Haskell for Mac will suggest completions based on both imported names and names that are already being used elsewhere in the currently edited module (or playground). When those suggestions come up, you have got a few options:
- You can navigate the list of suggested names by using the up and down arrows, to select the name you want.
- Alternatively, if you continue typing, the list of completions will narrow down to those names matching the longer prefix.
- Once you found what you where looking for, pressing either the return or tab key will insert the currently selected completion.
- Finally, if you are entering a new name that is not contained in the list of completions, auto-completion is aborted whenever you enter a space character, brackets, or other characters that are not contained in any completion.
Auto-completion keeps track of all imports and when typing a dot
. after a module name, you can browse all names it exports. Here is the result of entering
This, of course, also works when importing a module under an alias using an
as import statement. The tracking of imports by auto-completions is convenient, but it comes with a caveat: if the module has got a syntax error, or other fatal error, auto-completion cannot determine the currently imported set of identifiers. However, it always caches the identifier set determined after the last successful loading of the current module. (Note that type errors don't obstruct auto-completion nor playground execution.)
Haskell makes liberal use of user-defined symbols. Hence, auto-completion works for symbols much as for alphanumeric identifiers.