# Scalaz Introduction

## Motivation

I’ve been using Scalaz for a while now and I remember not having any guides that provide a gentle introduction. It was a lot of scouring around, reading source code, and watching tech talks that gave me the understanding that I have now. This series of posts is intended at filling that gap by providing simple, step-by-step tutorials that will help you get productive quickly without compromising on the functional programming concepts.

## What is Scalaz?

The documentation for Scalaz (pronounced Scala-zee or Scala-zed) states:

Scalaz is a Scala library for functional programming.
It provides purely functional data structures to complement those from the Scala standard library. It defines a set of foundational type classes (e.g. Functor, Monad) and corresponding instances for a large number of data structures.

In a nutshell, Scalaz aims to do three things:

• Provide new datatypes that are not present in the core Scala library
• Provide new operations on existing types a.k.a. pimp the library
• Provide general-purpose functions so that you don't have to re-write them
• I’ll provide a quick example of each of these without going into any details.

## New Datatypes

Here we are creating a NonEmptyList which is a list that is guaranteed to have atleast one element i.e. it’s never empty.

## New Operations on Existing Types

The first way of extracting value from an Option comes from Scalaz and is much more expressive compared to using fold from Scala standard library.

## General-Purpose Functions

The |+| operator from Scalaz conveniently concatenated the two Lists together.