# Learning Functional Programming with Cats

Like most blogs, mine is not too well structured so I thought it would be useful to tie the various posts together

If you want to learn FP and Cats I suggest reading the posts in this order:

- Type classes for beginners - Cats makes extensive use of type classes. A good understanding of this concept is therefore a prerequisite. Don't be scared! the concept is quite simple
- What is a Functor? - The familiar
`map()`

function is encapsulated as a Functor in Cats. - What is a Semigroup? - Used to combine data together. When used with a Functor we have a very basic map-reduce system
- What is a Monoid? - Not to be confused with a Monad, a Monoid is like a Semigroup but allows us to combine data types that may be empty (e.g. Lists)
- What is a Monad? - The familiar
`flatMap()`

function is encapsulated by a Monad. Monad's are more powerful than you may realise - Monad transformers - If you find yourself writing
`_.map(_.map(...))`

or nesting`flatMap()`

calls a Monad transformer may help ... - Monad error - An advanced Monad that wraps another Monad to provide error handling semantics
- Applicatives vs Monads - If you've ever called
`Future.sequence()`

you've used an Applicative but you may not realise it - Validated & ValidatedNel - Sometimes we want to accumulate errors instead of failing fast (like Either does). Cats offers us a useful utility for this called Validated