# Compiler Directives There are a number of directives (instructions to the compiler, beginning with a `%` symbol) which are not part of the Idris 2 language, but nevertheless provide useful information to the compiler. Mostly these will be useful for library (especially Prelude) authors. They are ordered here approximately by "likelihood of being useful to most programmers". ## Language directives ### %name Syntax: `%name ` For interactive editing purposes, use `` as the preferred names for variables with type ``. ### %hide Syntax: `%hide ` Throughout the rest of the file, consider the `` to be private to its own namespace. ### %auto_lazy Syntax: `%auto_lazy ` Turn the automatic insertion of laziness annotations on or off. Default is `on` as long as `%lazy` names have been defined (see below). ### %runElab Syntax: `%runElab ` NOT YET IMPLEMENTED Run the elaborator reflection expression ``, which must be of type `Elab a`. Note that this is only minimally implemented at the moment. ### %pair Syntax: `%pair ` Use the given names in `auto` implicit search for projecting from pair types. ### %rewrite Syntax: `%rewrite ` Use the given name as the default rewriting function in the `rewrite` syntax. ### %integerLit Syntax: `%integerLit ` Apply the given function to all integer literals when elaborating. The default Prelude sets this to `fromInteger`. ### %stringLit Syntax: `%stringLit ` Apply the given function to all string literals when elaborating. The default Prelude does not set this. ### %charLit Syntax: `%charLit ` Apply the given function to all character literals when elaborating. The default Prelude does not set this. ### %allow_overloads Syntax: `%allow_overloads ` This is primarily for compatibility with the Idris 1 notion of name overloading which allows in particular `(>>=)` and `fromInteger` to be overloaded in an ad-hoc fashion as well as via the `Monad` and `Num` interfaces respectively. It effect is: If `` is one of the possibilities in an ambiguous application, and one of the other possibilities is immediately resolvable by return type, remove `` from the list of possibilities. If this sounds quite hacky, it's because it is. It's probably better not to use it other than for the specific cases where we need it for compatibility. It might be removed, if we can find a better way to resolve ambiguities with `(>>=)` and `fromInteger` in particular! ## Implementation/debugging directives ### %logging Syntax: `%logging ` Set the logging level. In general `1` tells you which top level declaration the elaborator is working on, up to `5` gives you more specific details of each stage of the elaboration, and up to `10` gives you full details of type checking including progress on unification problems