Haskell 2010 (DRAFT)

Language Report

Simon Marlow
(editor)

Copyright notice.

The authors and publisher intend this Report to belong to the entire Haskell community, and grant permission to copy and distribute it for any purpose, provided that it is reproduced in its entirety, including this Notice. Modified versions of this Report may also be copied and distributed for any purpose, provided that the modified version is clearly presented as such, and that it does not claim to be a definition of the language Haskell 2010.

Contents
Preface
 Goals
 Haskell 2010: language and libraries
 Extensions to Haskell 98
 Haskell Resources
 Building the language
I  The Haskell 2010 Language
1 Introduction
 1.1 Program Structure
 1.2 The Haskell Kernel
 1.3 Values and Types
 1.4 Namespaces
2 Lexical Structure
 2.1 Notational Conventions
 2.2 Lexical Program Structure
 2.3 Comments
 2.4 Identifiers and Operators
 2.5 Numeric Literals
 2.6 Character and String Literals
 2.7 Layout
3 Expressions
 3.1 Errors
 3.2 Variables, Constructors, Operators, and Literals
 3.3 Curried Applications and Lambda Abstractions
 3.4 Operator Applications
 3.5 Sections
 3.6 Conditionals
 3.7 Lists
 3.8 Tuples
 3.9 Unit Expressions and Parenthesized Expressions
 3.10 Arithmetic Sequences
 3.11 List Comprehensions
 3.12 Let Expressions
 3.13 Case Expressions
 3.14 Do Expressions
 3.15 Datatypes with Field Labels
 3.16 Expression Type-Signatures
 3.17 Pattern Matching
4 Declarations and Bindings
 4.1 Overview of Types and Classes
 4.2 User-Defined Datatypes
 4.3 Type Classes and Overloading
 4.4 Nested Declarations
 4.5 Static Semantics of Function and Pattern Bindings
 4.6 Kind Inference
5 Modules
 5.1 Module Structure
 5.2 Export Lists
 5.3 Import Declarations
 5.4 Importing and Exporting Instance Declarations
 5.5 Name Clashes and Closure
 5.6 Standard Prelude
 5.7 Separate Compilation
 5.8 Abstract Datatypes
6 Predefined Types and Classes
 6.1 Standard Haskell Types
 6.2 Strict Evaluation
 6.3 Standard Haskell Classes
 6.4 Numbers
7 Basic Input/Output
 7.1 Standard I/O Functions
 7.2 Sequencing I/O Operations
 7.3 Exception Handling in the I/O Monad
8 Foreign Function Interface
 8.1 Foreign Languages
 8.2 Contexts
 8.3 Lexical Structure
 8.4 Foreign Declarations
 8.5 Specification of External Entities
 8.6 Marshalling
 8.7 The External C Interface
9 Standard Prelude
 9.1 Prelude PreludeList
 9.2 Prelude PreludeText
 9.3 Prelude PreludeIO
10 Syntax Reference
 10.1 Notational Conventions
 10.2 Lexical Syntax
 10.3 Layout
 10.4 Literate comments
 10.5 Context-Free Syntax
 10.6 Fixity Resolution
11 Specification of Derived Instances
 .1Derived instances of Eq and Ord
 .2Derived instances of Enum
 .3Derived instances of Bounded
 .4Derived instances of Read and Show
 .5An Example
12 Compiler Pragmas
 12.1 Inlining
 12.2 Specialization
 12.3 Language extensions
II  The Haskell 2010 Libraries
13 Control.Monad
 13.1 Functor and monad classes
 13.2 Functions
14 Data.Array
 14.1 Immutable non-strict arrays
 14.2 Array construction
 14.3 Accessing arrays
 14.4 Incremental array updates
 14.5 Derived arrays
 14.6 Specification
15 Data.Bits
16 Data.Char
 16.1 Characters and strings
 16.2 Character classification
 16.3 Case conversion
 16.4 Single digit characters
 16.5 Numeric representations
 16.6 String representations
17 Data.Complex
 17.1 Rectangular form
 17.2 Polar form
 17.3 Conjugate
 17.4 Specification
18 Data.Int
 18.1 Signed integer types
19 Data.Ix
 19.1 The Ix class
 19.2 Deriving Instances of Ix
20 Data.List
 20.1 Basic functions
 20.2 List transformations
 20.3 Reducing lists (folds)
 20.4 Building lists
 20.5 Sublists
 20.6 Searching lists
 20.7 Indexing lists
 20.8 Zipping and unzipping lists
 20.9 Special lists
 20.10 Generalized functions
21 Data.Maybe
 21.1 The Maybe type and operations
 21.2 Specification
22 Data.Ratio
 .1Specification
23 Data.Word
 23.1 Unsigned integral types
24 System.Environment
25 System.Exit
26 Foreign
27 Foreign.C
28 Foreign.C.Error
 28.1 Haskell representations of errno values
29 Foreign.C.String
 29.1 C strings
 29.2 C wide strings
30 Foreign.C.Types
 30.1 Representations of C types
31 Foreign.ForeignPtr
 31.1 Finalised data pointers
32 Foreign.Marshal
33 Foreign.Marshal.Alloc
 .1Memory allocation
34 Foreign.Marshal.Array
 34.1 Marshalling arrays
35 Foreign.Marshal.Error
36 Foreign.Marshal.Utils
 36.1 General marshalling utilities
37 Foreign.Ptr
 37.1 Data pointers
 37.2 Function pointers
38 Foreign.StablePtr
 38.1 Stable references to Haskell values
39 Foreign.Storable
40 System.IO
 40.1 The IO monad
 40.2 Files and handles
 40.3 Opening and closing files
 40.4 Operations on handles
 40.5 Text input and output
41 System.IO.Error
 41.1 I/O errors
 41.2 Types of I/O error
 References
Index