Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Scala Design Patterns

You're reading from   Scala Design Patterns Write efficient, clean, and reusable code with Scala

Arrow left icon
Product type Paperback
Published in Feb 2016
Publisher
ISBN-13 9781785882500
Length 382 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ivan Nikolov Ivan Nikolov
Author Profile Icon Ivan Nikolov
Ivan Nikolov
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. The Design Patterns Out There and Setting Up Your Environment FREE CHAPTER 2. Traits and Mixin Compositions 3. Unification 4. Abstract and Self Types 5. Aspect-Oriented Programming and Components 6. Creational Design Patterns 7. Structural Design Patterns 8. Behavioral Design Patterns – Part 1 9. Behavioral Design Patterns – Part 2 10. Functional Design Patterns – The Deep Theory 11. Functional Design Patterns – Applying What We Learned 12. Real-Life Applications Index

The Scalaz library

Scala is a functional programming language and as such it supports design patterns based on concepts such as monoids, monads, and others. We already saw these in Chapter 10, Functional Design Patterns – The Deep Theory, and we know the rules they follow and the structure they have. We wrote everything ourselves, but a library already exists that does this for us—Scalaz (https://github.com/scalaz/scalaz). This library is used when we need purely functional data structures.

We have already encountered Scalaz in the previous chapter when we talked about lenses. In the following subsections, we will look at the library from the point of view of monoids, functors, and monads.

Monoids in Scalaz

One of the concepts we looked at in Chapter 10, Functional Design Patterns – The Deep Theory was monoids. We defined a trait and some rules for them and then showed examples of how to use them and what they are good for. In these examples, we defined monoids for integer...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime