My Account Log in

3 options

Mastering functional programming : functional techniques for sequential and parallel programming / Anatolii Kmetiuk.

EBSCOhost Academic eBook Collection (North America) Available online

View online

Ebook Central College Complete Available online

View online

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Kmetiuk, Anatolii, author.
Language:
English
Subjects (All):
Functional programming (Computer science).
Physical Description:
1 online resource (372 pages) : illustrations
Edition:
1st edition
Other Title:
Functional techniques for sequential and parallel programming with Scala
Place of Publication:
Birmingham ; Mumbai : Packt, 2018.
System Details:
text file
Summary:
Learn how functional programming can help you in deploying web servers and working with databases in a declarative and pure way Key Features Learn functional programming from scratch Program applications with side effects in a pure way Gain expertise in working with array tools for functional programming Book Description In large projects, it can get difficult keeping track of all the interdependencies of the code base and how its state changes at runtime. Functional Programming helps us solve these problems. It is a paradigm specifically designed to deal with the complexity of software development. This book will show you how the right abstractions can reduce complexity and make your code easy to read and understand. Mastering Functional Programming begins by touching upon the basics such as what lambdas are and how to write declarative code with the help of functions. It then moves on to more advanced concepts such as pure functions and type classes, the problems they aim to solve, and how to use them in real-world scenarios. You will also explore some of the more advanced patterns in the world of functional programming, such as monad transformers and Tagless Final. In the concluding chapters, you will be introduced to the actor model, implement it in modern functional languages, and explore the subject of parallel programming. By the end of the book, you will have mastered the concepts entailing functional programming along with object-oriented programming (OOP) to build robust applications. What you will learn Write reliable and scalable software based on solid foundations Explore the cutting edge of computer science research Effectively solve complex architectural problems in a robust way Avoid unwanted outcomes such as errors or delays and focus on business logic Write parallel programs in a functional style using the actor model Use functional data structures and collections in your day-to-day work Who this book is for If you are from an imperative and OOP background, this book will guide you through the world of functional programming, irrespective of which programming language you use. Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Contents:
Cover
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Table of Contents
Preface
Chapter 1: The Declarative Programming Style
Technical requirements
Principles of declarative programming
Example - go-to versus loops
Example - nested loop
Don't Repeat Yourself (DRY)
Declarative versus imperative collections
Filtering
Declarative programming in other languages
Summary
Questions
Chapter 2: Functions and Lambdas
Functions as behavior
Functions in functional programming
Higher-order functions
Understanding lambda functions
The concept of functions in different programming languages
Chapter 3: Functional Data Structures
Collections framework
Imperative collections
Functional collections
Algebraic approach
Effect types
Try
Option
Data structures in different programming languages
Further reading
Chapter 4: The Problem of Side Effects
Side effects
Mutable states
Pure functions
Referential transparency
Generally encountered side effects
Error
Absence of result
Delay and asynchronous computations
Logging
Input-output operations
But how do we get rid of the side effects?
The pure functional paradigm in different languages
Chapter 5: Effect Types - Abstracting Away Side Effects
Turning effects into data
The sequential combination of effects with Monads
Introducing the map function
Introducing the flatMap function
Chapter 6: Effect Types in Practice
Future
Motivation and the imperative example
Abstraction and the functional example
Composing Futures
flatMap generalized
Either
Reader
Functional solution
Questions.
Chapter 7: The Idea of the Type Classes
Rich Wrapper pattern
Motivation
Implicit conversions
Rich Wrapper
The Type Class pattern
Interpretation of the Type Class pattern
Injectable interfaces
Toolboxes
Type classes in different languages
Chapter 8: Basic Type Classes and Their Usage
A motivation for organizing type classes into systems and libraries
The Cats library for purely functional programming
The structure of the library
Core
Type class hierarchy
Abstract methods
Concrete methods
Laws
Syntax
Instances
Data
Infrastructure synergy
Type classes
Monad
Writer effect type
The tailRecM method
Functor
Applicative
Applicative type class
Implementation of the type class
Monoid
Implementation for Either
MonoidK
Traverse
Chapter 9: Libraries for Pure Functional Programming
Cats effect
ProductR
IO - the concurrence data type
Inversion of control
Asynchrony with IO
Blocking example
Concurrency infrastructure
Running tasks in bunches
Heavy load with blocking
Synchronous tasks
Constructing asynchronous tasks
Asynchronous API
Asynchronous example
Fibers
The computation
IO combination without Fibers
IO combination with Fibers
Canceling Fibers
Bracket
Server-side programming
The architecture of a server-side application
Communication protocol
The software architecture of a server
Example specification
Orchestration and infrastructure
Docker
Docker-compose
Dockerfiles
Backend architecture
Model
Database layer
Querying the server
Chapter 10: Patterns of Advanced Functional Programming
Monad Transformers.
The specialization of effect types
An application with multiple side effects
Asynchrony
The side effect of errors
Monad Transformers
Generalizing the pattern
Tagless Final
Programming to capabilities
Implementations
Execution semantics abstraction
Computation as a value
Free Monad
Type-level programming
A naive implementation of the heterogeneous list
Type-level solution to the heterogeneous list problem
Reclusive implicit resolution
Debugging type-level computations
Libraries for type-level programming
Chapter 11: Introduction to the Actor Model
Overview of parallelism solutions
Traditional model synchronization on monitors
Synchronization
Problems with the traditional model - race conditions and deadlocks
The actor model as a replacement for the traditional model
Deadlock example revisited
Chapter 12: The Actor Model in Practice
Akka overview
Principles of Akka
Encapsulation
Messaging
No leaking of mutable state
Fault-tolerance and supervision
Messaging guarantees
Defining, creating, and messaging actors
Callbacks
Supervision
Context and references
Managing the actor hierarchy
Managing the life cycle
Creating actors
Actor parameters
Working with actor systems
Task specification
Implementation
Chapter 13: Use Case - A Parallel Web Crawler
Problem statement
The graph structure of the web
Collecting information from the graph
Parallel nature of the task
Sequential solution
A parallel solution with Akka
Strategy
Caveats
Visited links
Fault tolerance
Counting the responded actors
Real-world side effects
Appendix A: Introduction to Scala.
Motivation for using Scala
Scala infrastructure
Scala interpreter
SBT build tool
Variables and functions
Control structures
If and While
For
Pattern matching
Partial functions
Inheritance model
Classes
Traits
Singleton objects
Assessments
Other Books You May Enjoy
Index.
Notes:
Includes index.
Description based on print version record.
ISBN:
9781788626033
1788626036
OCLC:
1055555710

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account