{-#Pragmas Pragmas are special compiler directives that change its behavior in certain ways. In general, each compiler is free to define its own pragmas however jhc does try to implement the same ones as other compilers when it makes sense. pragmas appear in source code as {-# PRAGMANAME ... #-} # Function Properties These must appear in the same file as the definition of a function. To apply one to a instance or class method, you must place it in the where clause of the instance or class declaration. Pragma ------ ---------------------------------------------------- _NOINLINE_ Do not inline the given function during core transformations. The function _may_ be inlined during grin transformations. _INLINE_ Inline this function whenever possible _SUPERINLINE_ Always inline no matter what, even if it means making a local copy of the functions body. _VCONSTRUCTOR_ Treat the function as a virtual constructor. CPR analysis and the worker/wrapper transforms will treat the function application as if it were a constructor. This implies 'NOINLINE'. # Class Pragmas Pragma ------ --------------------------------------------------- _NOETA_ By default, jhc eta-expands all class methods to help enable optimizations. This disables this behavior. # Rules/Specializations Pragma ------ --------------------------------------------------- _RULES_ rewrite rules. These have the same syntax and behave similarly to GHC's rewrite rules, except 'phase' information is not allowed. _CATALYST_ A special type of rewrite rule that only fires if it enables the use of another RULE, so a CATALYST may allow optimizations that require passing through a non-optimal intermediate stage. _SPECIALIZE_ create a version of a function that is specialized for a given type _SUPERSPECIALIZE_ has the same effect as SPECIALIZE, but also places a run-time check in the generic version of the function to determine whether to call the specialized version. # Type Pragmas Pragma ------ --------------------------------------------------- _EXTTYPE_ Specify the external type that a data or newtype should use for foreign function interfaces. The type must be a newtype or unary data constructor of a type that is already foreignable. This pragma must appear in the same file as the type declaration. Example {-# EXTTYPE CUShort "unsigned short" #-} # Header Pragmas These pragmas are only valid in the 'head' of a file, meaning they must come before the initial 'module' definition and in the first 4096 bytes of the file and must be preceded by and contain only characters in the ASCII character set. OPTIONS_JHC : Specify extra options to use when processing this file. The options available are equivalent to the command line options, though, not all may have meaning when applied to a single file. LANGUAGE : Specify various language options