Soar with Haskell The Ultimate Beginners' Guide to Mastering Functional Programming from the Ground Up

The book begins by helping you get to grips with basic functions and algebraic datatypes, and gradually adds abstraction mechanisms and other powerful language features. Next, you'll explore recursion, formulate higher-order functions as reusable templates, and get the job done with laziness. A...

Full description

Bibliographic Details
Main Author: Schrijvers, Tom
Format: eBook
Language:English
Published: Birmingham Packt Publishing, Limited 2023
Edition:1st edition
Subjects:
Online Access:
Collection: O'Reilly - Collection details see MPG.ReNa
Table of Contents:
  • scParametric polymorphism
  • The identity function
  • The constant function
  • Parametric ADTs
  • Tuples
  • Type synonyms
  • Maybe
  • Either
  • The unit type
  • Summary
  • Questions
  • Answers
  • Chapter 3: Recursion
  • Standard libraries
  • Lists
  • List syntax
  • List syntax desugared
  • Predefined list functions
  • List comprehensions
  • Strings revisited
  • Custom list processing
  • Recursive datatypes
  • Arithmetic expressions
  • Parametric recursive datatypes
  • Structural recursion
  • Structural recursion on lists
  • Structural recursion on other algebraic datatypes
  • Cover
  • Title page
  • Copyright and credits
  • Dedication
  • Contributors
  • Table of contents
  • Preface
  • Part 1: Basic Functional Programming
  • Chapter 1: Functions
  • Technical requirements
  • What is FP?
  • Programming with functions
  • Brief history of FP
  • Haskell
  • Other contemporary FP languages
  • Prominent application areas
  • Writing basic functions
  • Our first function
  • A two-parameter function
  • Custom operators
  • Programming with primitive types
  • Int and Integer
  • Float and Double
  • Booleans
  • Char and String
  • Converting between primitive types
  • Variants on structural recursion
  • Primitive recursion
  • Recursion on integers
  • Additional parameters
  • Varying parameters and the worker/wrapper structure
  • Accumulation
  • Recursion on nested datatypes
  • Mutual recursion
  • Simultaneous recursion on multiple structures
  • Combining variations
  • Non-structural recursion
  • Non-termination
  • Unbounded search
  • Summary
  • Questions
  • Answers
  • Chapter 4: Higher-Order Functions
  • Abstracting over functions
  • Dropping a prefix
  • Sorting in ascending and descending order
  • An abstraction for structural recursion
  • Folding lists
  • Putting the type checker to work
  • Checking function calls
  • Checking function definitions
  • Disambiguating overloaded functions
  • Inferring types
  • Combining functions
  • Calling functions from within functions
  • Naming intermediate results
  • Local function definitions
  • Summary
  • Questions
  • Further reading
  • Answers
  • Chapter 2: Algebraic Datatypes
  • Enumerations
  • A game of rock-paper-scissors
  • Don't-care patterns
  • Booleans revisited
  • Records
  • People
  • Named fields
  • Nested records
  • Full-blown algebraic datatypes
  • Shapes
  • Cards
  • Showing cards
  • Folds for other algebraic datatypes
  • Variations on structural recursion
  • Common HOFs
  • Taking instead of dropping
  • Mapping
  • Filtering
  • Any and all
  • Folding from the left
  • Scanning left and right
  • Writing compact code with HOF
  • Standard deviation
  • Odds and evens
  • All you can buy
  • Summary
  • Questions
  • Answers
  • Part 2: Haskell-Specific Features
  • Chapter 5: First-Class Functions
  • Anonymous functions
  • Anonymous function syntax
  • Anonymous function use
  • Multi-parameter anonymous functions
  • Pattern matching without equations
  • Currying and partial application