Monads and effects
The Monad class opens this part of the Haskell course, and every lesson after it is about an effect: input and output, a file, a handle and the exception. The fourteen lessons cover do notation and the laws, Foldable and Traversable, the monoids, and the three transformers a program uses most: State, Reader and Writer. The part ends on a transformer stack and on the time of a measured run.
042
Monad and bind
>>=, return, the laws, Maybe and lists as monads
Open
043
do notation
do desugared, <-, let, a pattern in do, when
Open
044
IO and purity
IO as a type, getLine, putStrLn, fmap over IO, why main is IO
Open
045
Files
readFile, writeFile, appendFile, withFile, openFile and the handle modes
Open
046
Standard input and output
getContents, interact, hGetLine, hPutStr, buffering, isEOF
Open
047
Exceptions
Control.Exception, try, catch, evaluate, bracket, error against throwIO
Open
048
Foldable
foldMap, foldr over a tree, toList, sum on any Foldable
Open
049
Traversable
traverse, sequenceA, mapM, a validation through a list
Open
050
Semigroup and Monoid
<>, mempty, mconcat, Sum, Product, Any, All, a report monoid
Open
051
State
Control.Monad.State, get, put, modify, runState, a counter
Open
052
Reader and Writer
ask, asks, local, tell, runReader, runWriter
Open
053
Monad transformers
StateT over IO, lift, runStateT, a stack of two monads
Open
054
Why the monad laws matter
left and right identity, associativity, a broken instance and what it breaks
Open
055
Time and dates
getCurrentTime, diffUTCTime, UTCTime, formatTime, a measured duration
Open