07.01.2014 Views

The Glorious Glasgow Haskell Compilation System User's Guide ...

The Glorious Glasgow Haskell Compilation System User's Guide ...

The Glorious Glasgow Haskell Compilation System User's Guide ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>The</strong> <strong>Glorious</strong> <strong>Glasgow</strong> <strong>Haskell</strong><br />

<strong>Compilation</strong> <strong>System</strong> User’s <strong>Guide</strong>,<br />

Version 6.10.4 5 / 224<br />

• If you want to use impredicative types then you now need to enable the ImpredicativeTypes language extension. See Section<br />

7.8.5 for more information.<br />

• FFI change: header files are now not used when compiling via C. <strong>The</strong> -#include flag, the includes field in .cabal<br />

files, and header files specified in a foreign import declaration all have no effect when compiling <strong>Haskell</strong> source code.<br />

This change has important ramifications if you are calling FFI functions that are defined by macros (or renamed by macros). If<br />

you need to call one of these functions, then write a C wrapper for the function and call the wrapper using the FFI instead. In<br />

this way, your code will work with GHC 6.10.1, and will also work with -fasm in older GHCs.<br />

This change was made for several reasons. Firstly, -fvia-C now behaves consistently with -fasm, which is important<br />

because we intend to stop compiling via C in the future. Also, we don’t need to worry about the interactions between header<br />

files, or CPP options necessary to expose certain functions from the system header files (this was becoming quite a headache).<br />

We don’t need to worry about needing header files when inlining FFI calls across module or package boundaries; calls can<br />

now be inlined freely. One downside is that you don’t get a warning from the C compiler when you call a function via the FFI<br />

at the wrong type.<br />

Another consequence of this change is that calling varargs functions (such as printf) via the FFI no longer works. It<br />

has never been officially supported (the FFI spec outlaws it), but in GHC 6.10.1 it may now really cause a crash on certain<br />

platforms. Again, to call one of these functions use appropriate fixed-argument C wrappers.<br />

• <strong>The</strong>re is a new languages extension PackageImports which allows imports to be qualified with the package they should come<br />

from, e.g.<br />

import "network" Network.Socket<br />

Note that this feature is not intended for general use, it was added for constructing backwards-compatibility packages such as<br />

the base-3.0.3.0 package. See Section 7.3.15 for more details.<br />

• In earlier versions of GHC, the recompilation checker didn’t notice changes in other packages meant that recompilation is<br />

needed. This is now handled properly, using MD5 checksums of the interface ABIs.<br />

• GHC now treats the Unicode "Letter, Other" class as lowercase letters. This is an arbitrary choice, but better than not allowing<br />

them in identifiers at all. This may be revisited by <strong>Haskell</strong>’.<br />

• In addition to the DEPRECATED pragma, you can now attach arbitrary warnings to declarations with the new WARNING<br />

pragma. See Section 7.13.4 for more details.<br />

• If GHC is failing due to -Werror, then it now emits a message telling you so.<br />

• GHC now warns about unrecognised pragmas, as they are often caused by a typo. <strong>The</strong> -fwarn-unrecognised-pragmas<br />

controls whether this warning is emitted. <strong>The</strong> warning is enabled by default.<br />

• <strong>The</strong>re is a new flag -fwarn-dodgy-foreign-imports which controls a new warning about FFI delcarations of the form<br />

foreign import "f" f :: FunPtr t<br />

on the grounds that it is probably meant to be<br />

foreign import "&f" f :: FunPtr t<br />

<strong>The</strong> warning is enabled by default.<br />

• External core (output only) is working again.<br />

• <strong>The</strong>re is a new flag -dsuppress-uniques that makes GHC’s intermediate core easier to read. This flag cannot be used<br />

when actually generating code.<br />

• <strong>The</strong>re is a new flag -dno-debug-output that suppresses all of the debug information when running a compiler built with<br />

the DEBUG option.<br />

• A bug in earlier versions of GHC meant that sections didn’t always need to be parenthesised, e.g. (+ 1, 2) was accepted.<br />

This has now been fixed.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!