Types and data

A type in Haskell is built from constructors, and the data declarations of this part are the sum, the product, the record and the recursive tree. The fourteen lessons cover data and newtype, Maybe and Either, and then type classes: a class, its instances, the deriving that writes them, and the three classes every later effect is built on, Functor, Applicative and Monad.

028 data and algebraic data types data, constructors, deriving Show, a value of your own type Open 029 Sum types and exhaustive matching several constructors, a match that must cover them, -Wincomplete-patterns Open 030 Product types a constructor with several fields, positional access, data against tuples Open 031 Records field names, construction, update syntax, accessors, Show Open 032 newtype and type synonyms type for a synonym, newtype for a distinct type, deriving through it Open 033 Recursive data: trees a binary search tree, insert, toList, the fold over it Open 034 Maybe and the missing value Just and Nothing, fromMaybe, mapMaybe, case on a lookup Open 035 Either and recoverable errors Left and Right, validation, partitionEithers, the error in the type Open 036 Type classes a class, its methods, an instance, a constraint in a signature, the dictionary idea Open 037 Instances, deriving and DerivingStrategies an instance by hand, deriving Eq Ord Show, DerivingStrategies, GeneralizedNewtypeDeriving Open 038 Enum and Bounded [minBound .. maxBound], succ, pred, toEnum, a custom Enum Open 039 Show, Read and Text.Read show, read, readMaybe, a parse that may fail, why read alone is unsafe Open 040 Functor and fmap fmap, <$>, the laws, Maybe, lists and IO as functors Open 041 Applicative pure, <*>, liftA2, a validation that collects errors Open

Lessons