
Examples 51
Free Empty ~~ Identity 51
Free Identity ~~ (Nat,) ~~ Writer Nat 51
Free Maybe ~~ MaybeT (Writer Nat) 52
Free (Writer w) ~~ Writer [w] 52
Free (Const c) ~~ Either c 52
Free (Reader x) ~~ Reader (Stream x) 53
Chapter 13: Concurrency 54
Remarks 54
Examples 54
Spawning Threads with `forkIO` 54
Communicating between Threads with `MVar` 54
Atomic Blocks with Software Transactional Memory 55
atomically :: STM a -> IO a 56
readTVar :: TVar a -> STM a 56
writeTVar :: TVar a -> a -> STM () 56
Chapter 14: Containers - Data.Map 57
Examples 57
Constructing 57
Checking If Empty 57
Finding Values 57
Inserting Elements 58
Deleting Elements 58
Importing the Module 58
Monoid instance 58
Chapter 15: Creating Custom Data Types 60
Examples 60
Creating a simple data type 60
Creating variables of our custom type 60
Creating a data type with value constructor parameters 60
Creating variables of our custom type 61
Creating a data type with type parameters 61