Click here to load reader

Contents Chap. 1 Chap. 2 Chap. 3 Chap. 4 Chap. 5 Chap. 6 Chap. 7 Chap. 8 Chap. 9 Chap. 10 Chap. 11 Chap. 12 Chap. 13 Chap. 14 Chap. 15 Chap. 16 Chap. 17 Chap. 18

  • View
    123

  • Download
    1

Embed Size (px)

Text of Contents Chap. 1 Chap. 2 Chap. 3 Chap. 4 Chap. 5 Chap. 6 Chap. 7 Chap. 8 Chap. 9 Chap. 10 Chap. 11...

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Fortgeschrittene funktionale

    Programmierung LVA 185.A05, VU 2.0, ECTS 3.0

    SS 2018

    (Stand: 22.06.2018)

    Jens Knoop

    Technische Universität Wien Information Systems Engineering

    Compilers and Languages uages comp lang

    uter

    1/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents

    2/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents (1)

    Part I: Motivation

    I Chap. 1: Why Functional Programming Matters

    1.1 Setting the Stage 1.2 Glueing Functions Together 1.3 Glueing Programs Together 1.4 Summary 1.5 References, Further Reading

    Part II: Programming Principles

    I Chap. 2: Programming with Streams

    2.1 Streams 2.2 Stream Diagrams 2.3 Memoization 2.4 Boosting Performance 2.5 References, Further Reading

    3/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents (2)

    I Chap. 3: Programming with Higher-Order Functions: Algorithm Patterns

    3.1 Divide-and-Conquer 3.2 Backtracking Search 3.3 Priority-first Search 3.4 Greedy Search 3.5 Dynamic Programming 3.6 References, Further Reading

    I Chap. 4: Equational Reasoning

    4.1 Motivation 4.2 Functional Pearls 4.3 The Smallest Free Number 4.4 Not the Maximum Segment Sum 4.5 A Simple Sudoku Solver 4.6 References, Further Reading

    4/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents (3)

    Part III: Quality Assurance

    I Chap. 5: Testing

    5.1 Motivation 5.2 Defining Properties 5.3 Testing against Abstract Models 5.4 Testing against Algebraic Specifications 5.5 Controlling Test Data Generation 5.6 Monitoring, Reporting, and Coverage 5.7 Implementation of QuickCheck 5.8 Summary 5.9 References, Further Reading

    5/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents (4) I Chap. 6: Verification

    6.1 Inductive Proof Principles on Natural Numbers 6.1.1 Natural Induction 6.1.2 Strong Induction

    6.2 Inductive Proof Principles on Structured Data 6.2.1 Induction and Recursion 6.2.2 Structural Induction

    6.3 Inductive Proofs on Algebraic Data Types 6.3.1 Inductive Proofs on Haskell Trees 6.3.2 Inductive Proofs on Haskell Lists 6.3.3 Inductive Proofs on Partial Haskell Lists 6.3.4 Inductive Proofs on Haskell Stream Approximants

    6.4 Approximation 6.5 Coinduction 6.6 Fixed Point Induction 6.7 Other Approaches, VerificationTools

    6.7.1 Correctness by Construction 6.7.2 Selected other Approaches and Tools

    6.8 References, Further Reading 6/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents (5) Part IV: Advanced Language Concepts I Chap. 7: Functional Arrays

    7.1 Motivation 7.2 Functional Arrays

    7.2.1 Static Arrays 7.2.2 Dynamic Arrays

    7.3 Summary 7.4 References, Further Reading

    I Chap. 8: Abstract Data Types 8.1 Motivation 8.2 Stacks 8.3 Queues 8.4 Priority Queues 8.5 Tables 8.6 Displaying ADT Values in Haskell 8.7 Summary 8.8 References, Further Reading

    7/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents (6)

    I Chap. 9: Monoids

    9.1 Motivation 9.2 The Type Class Monoid 9.3 Monoid Examples

    9.3.1 Lists as Monoid 9.3.2 Numerical Types as Monoids 9.3.3 Bool as Monoid 9.3.4 Ordering as Monoid

    9.4 Summary and Looking ahead 9.5 References, Further Reading

    I Chap. 10: Functors

    10.1 Motivation 10.2 The Type Constructor Class Functor

    8/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents (7) I Chap. 10: Functors (cont’d)

    10.3 Predefined Functors 10.3.1 The Identity Functor 10.3.2 The Maybe Functor 10.3.3 The List Functor 10.3.4 The Input/Output Functor 10.3.5 The Either Functor 10.3.6 The Map Functor

    10.4 The Type Constructor Class Applicative 10.5 Predefined Applicatives

    10.5.1 The Identity Applicative 10.5.2 The Maybe Applicative 10.5.3 The List Applicative 10.5.4 The Input/Output Applicative 10.5.5 The Either Applicative 10.5.6 The Map Applicative 10.5.7 The Ziplist Applicative

    10.5 Kinds of Types and Type Constructors 10.6 References, Further Reading

    9/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents (8)

    I Chap. 11: Monads 11.1 Motivation

    11.1.1 Functional Composition Reconsidered 11.1.2 Example: Debug Information 11.1.3 Example: Random Numbers 11.1.4 Findings, Looking ahead 11.1.5 Excursus on Functional Composition

    11.2 The Type Constructor Class Monad 11.3 Syntactic Sugar: The do-Notation 11.4 Predefined Monads

    11.4.1 The Identity Monad 11.4.2 The List Monad 11.4.3 The Maybe Monad 11.4.4 The Either Monad 11.4.5 The Map Monad 11.4.6 The State Monad 11.4.7 The Input/Output Monad

    10/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents (9)

    I Chap. 11: Monads (cont’d) 11.5 Monadic Programming

    11.5.1 Folding Trees 11.5.2 Numbering Tree Labels 11.5.3 Renaming Tree Labels

    11.6 MonadPlus 11.6.1 The Type Constructor Class MonadPlus 11.6.2 The Maybe MonadPlus 11.6.3 The List MonadPlus

    11.7 Summary 11.8 References, Further Reading

    I Chap. 12: Arrows

    12.1 Motivation 12.2 The Type Constructor Class Arrow 12.3 A Fresh Look at the Haskell Class Hierarchy 12.4 References, Further Reading

    11/1882

  • Contents

    Chap. 1

    Chap. 2

    Chap. 3

    Chap. 4

    Chap. 5

    Chap. 6

    Chap. 7

    Chap. 8

    Chap. 9

    Chap. 10

    Chap. 11

    Chap. 12

    Chap. 13

    Chap. 14

    Chap. 15

    Chap. 16

    Chap. 17

    Chap. 18

    References

    Appendix

    A

    Table of Contents (10) Part V: Applications I Chap. 13: Parsing

    13.1 Motivation 13.2 Combinator Parsing

    13.2.1 Primitive Parsers 13.2.2 Parser Combinators 13.2.3 Universal Combinator Parser Basis 13.2.4 Structure of Combinator Parsers 13.2.5 Writing Combinator Parsers: Examples

    13.3 Monadic Parsing 13.3.1 Parsers as Monads 13.3.2 Parsers by Type Class Instantiations 13.3.3 Universal Monadic Parser Basis 13.3.4