Chapter 2. The Prelude and the standard (std) package

The prelude is documented in the Haskell 98 report and the standard libraries in the Haskell 98 libraries report. Low-level deviations of GHC from Haskell '98 are noted in Section 7.19 in The Glasgow Haskell Compiler User's Guide, Version 5.02; deviations from the standard libraries are noted below.

2.1. Bugs, differences and caveats in GHC's standard library implementation

2.1.1. General

File I/O on Windows

On Windows, reading a file in text mode (which is the default) will translate CRLF to LF, and writing will translate LF to CRLF. This is usually what you want with text files. With binary files this is undesirable; also, as usual under Microsoft operating systems, text mode treats control-Z as EOF.

2.1.2. System

system on Windows

is implemented using Windows's native system call, which ignores the SHELL environment variable, and always passes the command to the Windows command interpreter (cmd.exe or, hence Unixy shell tricks will not work.


The report says that this function should return the name of the program “as invoked”, which might suggest to Unix types that it should return the equivalent of argv[0]. However, this is hard-to-impossible on some non-Unix OSes, so instead, for maximum portability, we just return the leafname of the program as invoked. Even then there are some differences between platforms: on Windows, for example, a program invoked as foo is probably really foo.exe, and that is what progName will return.