Haskell Fundamentals
This session has ended.
Haskell is a powerful Functional Programming language for building solid systems and ambitious projects.
This course has been designed to cover the fundamentals of the language and provide beginners with enough knowledge of its features to be successful in developing projects in Haskell. Learn the basic concepts, techniques, and tools of the language and change the way you think about programming.
Course content
Simple constructs
- Simple definitions
- Definitions using pattern matching and guards
- Local bindings with
let
andwhere
- Pattern matching over lists, recursion
- Higher-order functions: maps and folds
- Anonymous functions and partial application
Algebraic data types and type classes
- Record types, and record syntax
- Enumerations
- General shape of algebraic data types
- Differences from OOP modeling
- Polymorphic types: lists, trees
- First-order type classes:
Eq
,Ord
,Show
- Automatic derivation
Input/output
- Concept of purity and tagging with IO
do
blocks: pure vs. impure values- Basic console and file input/output
- Working with callbacks (example using
network-simple
) - Small introduction to streaming
Functional error handling
Maybe
andEither
as polymorphic types- Combinators to work on the happy path
- Dealing with errors in IO: exceptions
Higher-kinded type classes: Functor
and Monad
- Looking at commonalities in maps -> Functor
- Notion of type constructors and higher-kinded clases
- ‘Simulating’ stateful computations in Haskell
- Looking at commonalities in bind -> Monad
- Monadic utilities
Higher-kinded type classes: Applicative
and Traversable
- Applicative as generalizing map to n-ary functions
- Applicative style programming
- Generalizing
map
tomapM
totraverse
Laziness
- Execution model with thunks
- Cyclic and infinite structures
- Forcing execution to avoid leaks
- IO, exceptions and laziness
Async, STM, streaming, resources
- Spawning new computations with
async
- Concurrent execution, racing
- Concurrent access with Software Transactional Memory
- Managing single resources
- Managing pools of resources
Combining Effects
- Logging effects
- Monadic classes and stacks
- An algorithm with environment, state and logging
- Integrating with IO effect