Advanced Functional Programming

Advanced Functional Programming

Advanced Functional Programming Páli, Gábor János Horváth, Zoltán Created by XMLmind XSL-FO Converter. Advanced Functional Programming írta Páli, Gábor János és Horváth, Zoltán Publication date 2014 Szerzői jog © 2014 Páli Gábor János, Horváth Zoltán Created by XMLmind XSL-FO Converter. Tartalom Advanced Functional Programming ................................................................................................... 1 1. 1 Syllabus .............................................................................................................................. 1 1.1. Highlights of the Curriculum .................................................................................... 1 2. 2 Motivation .......................................................................................................................... 1 2.1. Why Functional Programming? ................................................................................ 2 2.2. Functional Languages Used Out There .................................................................... 2 3. 3 Literature ............................................................................................................................ 2 3.1. Recommended Reading ............................................................................................ 2 3.2. Recommended Reading ............................................................................................ 2 4. 4 Introduction ........................................................................................................................ 2 4.1. Purely Functional Languages ................................................................................... 3 4.2. Elements of a Functional-Language Type System ................................................... 3 4.3. Recap: Type Checking .............................................................................................. 3 4.4. Recap: Type Definitions, Annotations ...................................................................... 3 4.5. Recap: Parametric and "Ad Hoc" Polymorphism ..................................................... 4 4.6. Recap: Type Synonyms, newtype ............................................................................. 4 5. 5 Algebraic Data Types ......................................................................................................... 5 5.1. Constructors .............................................................................................................. 5 5.2. Constructors (cont'd) ................................................................................................. 5 5.3. Sum of Types ............................................................................................................ 5 5.4. Product of Types ....................................................................................................... 6 5.5. Product of Types: Records ........................................................................................ 6 5.6. Product of Types: Records ........................................................................................ 6 5.7. Parametric ADTs ...................................................................................................... 7 5.8. Recursive ADTs ....................................................................................................... 7 5.9. Recursive, Parametric ADTs .................................................................................... 7 5.10. Recursive, Parametric ADTs (cont'd) ..................................................................... 8 6. 6 Higher-Order Types ........................................................................................................... 8 6.1. Introducing Higher-Order Types and Kinds ............................................................. 8 6.2. Example .................................................................................................................... 9 7. 7 Type Classes ...................................................................................................................... 9 7.1. Overloading Functions ............................................................................................. 9 7.2. Type Classes ............................................................................................................. 9 7.3. Type Class Instances .............................................................................................. 10 7.4. Class Contexts ........................................................................................................ 10 7.5. Instances Defined Through Overloading ................................................................ 10 7.6. Overlapping Instances ............................................................................................ 11 7.7. Overlapping Instances: Example (Clean) ............................................................... 11 7.8. Ambiguous Overloading ......................................................................................... 11 7.9. Deriving Members of Classes ................................................................................. 12 7.10. Classes Defined Through Other Classes ............................................................... 12 7.11. Deriving Type Class Instances (Haskell) .............................................................. 12 8. 8 Existential Types .............................................................................................................. 13 8.1. Introduction ............................................................................................................ 13 8.2. Examples of Use (Haskell) ..................................................................................... 13 8.3. Examples of Use (Clean) ........................................................................................ 13 9. 9 Uniqueness Typing ........................................................................................................... 14 9.1. Defining Uniqueness .............................................................................................. 14 9.2. Basic Ideas .............................................................................................................. 14 9.3. Writing Files ........................................................................................................... 14 9.4. Attribute Variables ................................................................................................. 15 9.5. Attribute Propagation ............................................................................................. 15 9.6. Restrictions on Propagation .................................................................................... 15 9.7. Employing Coercion Statements ............................................................................ 16 9.8. Employing Coercion Statements (cont'd) ............................................................... 16 9.9. New Types with Uniqueness Attributes ................................................................. 16 iii Created by XMLmind XSL-FO Converter. Advanced Functional Programming 9.10. Standard Attribution for New Types .................................................................... 17 9.11. Combining Uniqueness Typing and Overloading ................................................. 17 9.12. Application: I/O in Clean ...................................................................................... 17 10. 10 Dynamics ..................................................................................................................... 17 10.1. What is Dynamics? ............................................................................................... 17 10.2. What is Dynamics? (cont'd) .................................................................................. 18 10.3. Packing Expressions into a Dynamic .................................................................... 18 10.4. Packing Arguments of Unknown Type ................................................................. 18 10.5. Defeating the Static Type System ......................................................................... 19 10.6. Unpacking a Dynamic Using Pattern Matching ................................................... 19 10.7. Dynamic Pattern Matching for Polymorphic Functions ....................................... 19 10.8. Dynamic Pattern Matching: Summary ................................................................. 20 10.9. Checking and Unifying Type Schemes ................................................................ 20 10.10. Checking and Unifying Type Schemes - Examples ............................................ 20 10.11. Checking and Unifying Unknown Types Using Overloaded Type Variables .... 21 10.12. Type-Safe Communication Using Dynamics ..................................................... 21 10.13. Type-Safe Communication Using Dynamics: Example ..................................... 21 10.14. Architecture of the Implementation .................................................................... 22 11. 11 Generic Programming .................................................................................................. 22 11.1. Motivation ............................................................................................................ 22 11.2. Universal Representation of Types ......................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    124 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us