Soar with Haskell: The ultimate beginners' guide to mastering functional programming from the ground up 1st Edition Tom Schrijvers instant download
Soar with Haskell: The ultimate beginners' guide to mastering functional programming from the ground up 1st Edition Tom Schrijvers instant download
https://ebookmeta.com/product/learn-physics-with-functional-
programming-a-hands-on-guide-to-exploring-physics-with-
haskell-1st-edition-scott-n-walck/
https://ebookmeta.com/product/practical-haskell-a-real-world-
guide-to-functional-programming-3rd-edition-alejandro-serrano-
mena/
https://ebookmeta.com/product/effective-haskell-solving-real-
world-problems-with-strongly-typed-functional-programming-1st-
edition-rebecca-skinner/
https://ebookmeta.com/product/immunology-of-recurrent-pregnancy-
loss-and-implantation-failure-joanna-kwak-kim-editor/
The Campaigns of the British Army at Washington and New
Orleans in the Years 1814 1815 George Robert Gleig
https://ebookmeta.com/product/the-campaigns-of-the-british-army-
at-washington-and-new-orleans-in-the-years-1814-1815-george-
robert-gleig/
https://ebookmeta.com/product/croatia-11th-edition-peter-
dragicevich-anthony-ham-jessica-lee/
https://ebookmeta.com/product/anti-oedipus-capitalism-and-
schizophrenia-2nd-edition-gilles-deleuze-felix-guattari/
https://ebookmeta.com/product/practical-r-4-applying-r-to-data-
manipulation-processing-and-integration-1st-edition-jon-westfall/
https://ebookmeta.com/product/artificial-intelligence-machine-
learning-and-optimization-tools-for-smart-cities-designing-for-
sustainability-panos-m-pardalos-editor/
The Best Interests Assessor Practice Handbook 1st
Edition Rachel Hubbard Kevin Stone
https://ebookmeta.com/product/the-best-interests-assessor-
practice-handbook-1st-edition-rachel-hubbard-kevin-stone/
Soar with Haskell
Copyright © 2023 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing or its dealers and distributors, will be held liable for any damages
caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
Published by
Grosvenor House
11 St Paul’s Square
Birmingham
B3 1RB, UK
ISBN 978-1-80512-845-8
www.packtpub.com
To my wife, Annemie, for her enduring support.
– Tom Schrijvers
Contributors
Preface
Part 1: Basic Functional Programming
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
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
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
Parametric polymorphism
The identity function
The constant function
Parametric ADTs
Tuples
Type synonyms
Maybe
Either
The unit type
Summary
Questions
Answers
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
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
Higher-Order Functions
First-Class Functions
Anonymous functions
Anonymous function syntax
Anonymous function use
Multi-parameter anonymous functions
Pattern matching without equations
Currying and partial application
One parameter is enough
Partial application
Operator sections
Flipping function parameters
Eta reduction
Basic eta reduction
Eta reduction with partial application
Eta reduction of two-parameter functions
Irreducible cases
Function composition
Basic function composition
Pipelines
Functions as data structures
Evaluation with many variables
Association list
Functional environments
Summary
Questions
Answers
Type Classes
Ad hoc polymorphism
What is ad hoc polymorphism?
Type classes
Type class constraints are contagious
Type class instances
Type class instantiation
Default implementations and minimal complete
definitions
Instances for composite values
Equality of functions
Recursive instances
Deriving structural instances
Semantic equality instances
Exploring the Variety of Random
Documents with Different Content
JOURNÉES SANGLANTES
DES 5 ET 6 OCTOBRE 1789,
A PARIS ET A VERSAILLES.
SANGLANTES.