Haskell 2010 Language Report

325 pages
27 views

Please download to get full document.

View again

of 325
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Share
Description
Uploaded from Google Docs
Tags
Transcript
  Haskell 2010Language Report Simon Marlow(editor) Copyright notice. The authors and publisher intend this Report to belong to the entire Haskell community, and grant permissionto 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 mod-ified version is clearly presented as such, and that it does not claim to be a definition of the language Haskell2010.  Contents I The Haskell 2010 Language1 1 Introduction3 1.1 Program Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 The Haskell Kernel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.3 Values and Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4 Namespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2 Lexical Structure7 2.1 Notational Conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2 Lexical Program Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.3 Comments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.4 Identifiers and Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.5 Numeric Literals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.6 Character and String Literals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.7 Layout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3 Expressions15 3.1 Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.2 Variables, Constructors, Operators, and Literals. . . . . . . . . . . . . . . . . . . . . . . . 173.3 Curried Applications and Lambda Abstractions. . . . . . . . . . . . . . . . . . . . . . . . 183.4 Operator Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.5 Sections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19i  ii CONTENTS  3.6 Conditionals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.7 Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.8 Tuples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.9 Unit Expressions and Parenthesized Expressions. . . . . . . . . . . . . . . . . . . . . . . . 213.10 Arithmetic Sequences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.11 List Comprehensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.12 Let Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223.13 Case Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.14 Do Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253.15 Datatypes with Field Labels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253.15.1 Field Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.15.2 Construction Using Field Labels. . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.15.3 Updates Using Field Labels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273.16 Expression Type-Signatures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283.17 Pattern Matching. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283.17.1 Patterns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283.17.2 Informal Semantics of Pattern Matching. . . . . . . . . . . . . . . . . . . . . . . . 293.17.3 Formal Semantics of Pattern Matching. . . . . . . . . . . . . . . . . . . . . . . . . 31 4 Declarations and Bindings35 4.1 Overview of Types and Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364.1.1 Kinds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374.1.2 Syntax of Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374.1.3 Syntax of Class Assertions and Contexts. . . . . . . . . . . . . . . . . . . . . . . . 394.1.4 Semantics of Types and Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . 394.2 User-Defined Datatypes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404.2.1 Algebraic Datatype Declarations. . . . . . . . . . . . . . . . . . . . . . . . . . . . 404.2.2 Type Synonym Declarations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424.2.3 Datatype Renamings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks