Awesome
Haskell ITMO course at CTD
Here you can find plan and presentations on the Haskell course authored by Dmitry Kovanikov and Arseniy Seroka with subsequent contributions by George Agapov, Ilya Peresadin, Roman Melnikov and Artem Yurchenko.
This course is always under development and always improving constantly because there's no limit for the best Haskell course.
You can always contact us via fp.ctd.itmo [at] serokell.io
Course plan
All slides: https://slides.com/fp-ctd
- Lecture 0: Why FP and Haskell
- Lecture 1: Stack build tool
- Lecture 2: Basic Syntax
- Lecture 3: Datas, Classes, Instances
- Lecture 4: Basic typeclasses: Monoid. Functor. Applicative
- Lecture 5: Monads
- Slides: Parser combinators and Property-based-testing
- Lecture 6: RealWorld
- Lecture 7: Monad Transformers
- Lecture 8: Speeding up Haskell
- Lecture 9: Parallel and Concurrent Haskell
- Lecture 10: Template Haskell and Lens
- Lecture 11: Brand new DSL world
- Lecture 12: Some fun with kinds
- Lecture 13: Comonads
- Uncovered topics
Templates for homework: https://github.com/ChShersh/fp-homework-templates
<a name="lecture-0">Lecture 0: Why FP and Haskell</a> ↑
- Official resources
- Useful unofficial resources
- About Haskell & some wikis
- Try Haskell in web
- Editors (and IDE's for Haskell)
- Suggested tutorials and other useful online courses
- In Russian
- OHaskell: Для совсем новичков, очень доступно, но очень мало
- anton-k-github: Покрываются более продвинутые вещи + теория
- Stepic: Haskell (part 1): Лучший онлайн курс на русском; прекрасен для самостоятельно изучения
- Stepic: Haskell (part 2): Продолжение лучшего курса
- Dmitry Kovanikov: Обе части курса на Stepic покрывают лишь две трети данного курса на КТ
- Books
- Haskell Programming From First Principles: Best book currently
- LearnYouAHaskell: Free but won't help you much
- Intermediate Haskell: Advanced topics (not yet published)
- Intensive & self-learning courses
- bitemyapp: learnhaskell:
- Dmitry Kovanikov: personally I would recommend «Yorgey's cis194 course»
- Write Yourself a Scheme in 48 Hours
- bitemyapp: learnhaskell:
- In Russian
- Reallife and relatively popular examples of Haskell applications
- Standalone
- pandoc: Converter between different markup formats
- xmonad: Tiling window manager
- hledger: Accounting program
- ShellCheck: Finds bugs in your shell scripts
- Google's CodeWorld: Educational computer programming environment using Haskell
- Cryptocurrencies
- Cardano SL: Cardano Settlement Layer
- RSCoin: Implementation of the RSCoin protocol
- Haskoin: Haskell implementation of the Bitcoin protocol
- A List of companies that use Haskell: ~100 companies (on 26 Aug 2017)
- What Haskell technologies should I probably be using on a daily basis (e.g. Xmonad)?
- Standalone
- FP and Haskell paradigms (also extremely important language features)
- Static types
- Immutability by default
- Purity by default
- Non-null by default
- Sum types
- Lazy evaluation
Introductory presentation: here
<a name="lecture-1">Lecture 1. Stack. How to build/run/test</a> ↑
- GHC, GHCi
- Haskell project structure
- Stack. Features
- How stack works. Snapshots
.cabal
and.yaml
files- Basic comands
Presentation: https://slides.com/fp-ctd/lecture-1#/
<a name="lecture-2">Lecture 2: Basic Syntax</a> ↑
- Introduction to Haskell
- Basic GHCi examples
- Function & operators definition
- Lists and functions on lists
- Haskell syntax
- let (variable declaration)
- where clause
- if expression
- Guards
- case expression
- Higher order functions
- Lambdas (anonymous functions)
- Polymoprhism
- Parametric
- Ad-hoc
- LANGUAGE pragmas
- Currying (aka partial application)
- Pattern matching
- List comprehension
- Function application: (
$
) - Function composition: (
.
) - Lazy evaluation (erathosphene sieve, fibonacci numbers, repmin)
Presentation: http://slides.com/fp-ctd/lecture-2#/
<a name="lecture-3">Lecture 3: Datas, Classes, Instances</a> ↑
- type: type aliases
- ADT's (algebraic data types):
- product types
- sum types
- data and examples
- Record syntax
- newtype
- Type classes: class
- instance
- deriving
- -XGeneralizedNewtypeDeriving
- Modules cheatsheet
- Church-encoding ADT
Presentation: http://slides.com/fp-ctd/lecture-3#/
<a name="lecture-4">Lecture 4: Basic typeclasses: Monoid. Functor. Applicative</a> ↑
- Math in programming
foldr
andfoldl
Foldable
type classFunctor
Applicative
liftAN
& Applicative style programmingAlternative
- List comprehension syntax sugar
Traversable
type class (and instances forMaybe
,List
)- Automatic deriving
- Phantom types
- Type extensions:
Presentation: http://slides.com/fp-ctd/lecture-4#/
<a name="lecture-5">Lecture 5: Monads</a> ↑
- Typed holes
- What is Monad?
Monad
type class- Monad laws
State
monadReader
monadMaybe
as example, philosophy about null-safetyEither
monad instance- Monad laws
Presentation: http://slides.com/fp-ctd/lecture-5-2019#/
<a name="lecture-5-continue">Slides: Parser combinators and Property-based-testing</a> ↑
- Idea of parsing and parser combinators
Parser
type- Basic parsers
- Instances:
Functor
,Applicative
,Monad
,Alternative
- Usage examples
- Testing
Presentation (part 1): https://slides.com/fp-ctd/lecture-5-part1#/
Presentation (part 2): https://slides.com/fp-ctd/lecture-5-part2#/
<a name="lecture-6">Lecture 6: RealWorld</a> ↑
- Building IO system from scratch
- Introduce
IO
monad - do notation
- Syntax sugar
- -XApplicativeDo
- -XRebindableSyntax
- Lazy I/O
- FFI
- Mutable data:
IORef
andIOArray
- Exceptions (
catch
,throwIO
, custom exceptions,bracket
, etc.) unsafePerformIO
- Efficient String representations:
Text
,ByteString
Presentation: http://slides.com/fp-ctd/lecture-6#/
<a name="lecture-7">Lecture 7: Monad Transformers</a> ↑
- Monads as Effects
- Composing monads
MonadIO
MonadTrans
type classMaybeT
transformerReaderT
transformer- Comparison of transformers and old types
MonadThrow
type classMonadError
type classmtl
style of transformation [//]: # (Didn't find MaybeIO and CoroutineT)
Presentation: http://slides.com/fp-ctd/lecture-7#/
<a name="lecture-8">Lecture 8: Speeding up Haskell</a> ↑
- List concatenation pitfalls and Difference List
seq
,deepseq
,NFData
- -XBangPatterns
foldr
vs.foldl
vs.foldl'
- Irrefutable patterns
- Strict Haskell
- Space leaks
- Deforestation
- Stream Fusion
- Couple words about Rewrite Rules
ST
monad (STRef
,STArray
)
Presentation: http://slides.com/fp-ctd/lecture-10#/
<a name="lecture-9">Lecture 9: Parallel and Concurrent Haskell</a> ↑
- Concurrency with Haskell lightweight threads.
forkIO
andMVar
. - Synchronization between threads
- Exceptions revisited
Async
- STM (Software Transaction Memory).
STM
,TVar
. - Parallelism with Sparks. Eval monad
- Inspecting your concurrency (ThreadScope)
Presentation: https://slides.com/fp-ctd/lecture-09#/
<a name="lecture-10">Lecture 10: Template Haskell and Lens</a> ↑
- Lens
-XCPP
- Template Haskell
Presentation: https://slides.com/fp-ctd/lecture-10-17#/
<a name="lecture-11">Lecture 11: Brand new DSL world</a> ↑
- GADTs
- Existential type
- Rank N types
- DSL
Presentation: https://slides.com/fp-ctd/lecture-11#/
<a name="lecture-12">Lecture 12: Some fun with kinds </a> ↑
- Kinds
- -XTypeOperators
- -XDataKinds. Data promotion
- Heterogeneous lists
- Type symbols
- Data and type families
- Free monads
Presentation: https://slides.com/fp-ctd/lecture-12#/
<a name="lecture-13">Lecture 13: Comonads</a> ↑
Comonad
type class & motivationIdentity
comonad
- Zippers
- List zipper
- Game of Life
- Type algebra
- Types as functions (sum, product, type variables)
- Type isomorphisms
- Zippers as deriviation: List zipper, Tree zipper
- Comonads as OOP patterns
codo
-notation
(aka method)
Presentation: http://slides.com/fp-ctd/lecture-13#/
<!--- ## <a name="lecture-16">Lecture 16: Idris</a> [↑](#course-plan) + [Idris tutorial](http://docs.idris-lang.org/en/latest/tutorial/) + [Idris course](http://www.idris-lang.org/dependently-typed-functional-programming-with-idris-course-videos-and-slides/) + Paradigms * Totality * Strict evalution * Theorem proving * DSL * Extensible effects + Syntax difference with _Haskell_ * : for type and :: for _cons_ * Function overloading * Named typeclasses * !-idiom * [| |]-idiom * Records + Dependent types * `Vect` data type * `drop` for `Vect` * `isEmpty : Vect n a -> Bool` * `isSingleton : Bool -> Type` * Open and closed doors * _Total_ version of `head` function * `_|_`-eliminator * _Dependent pair_ and _filter_ for vectors * [Type safe `printf` implementation](https://www.youtube.com/watch?v=fVBck2Zngjo) + Simple examples of `Eff` * Tagging tree with labels (and counting leaves) -->Uncovered topics ↑
Unfortunately there're some topics which are great but there is no time for them in this course :(
Generics
- Pragmas: {-# UNPACK #-}, {-# INLINE #-}, {-# SPECIALIZE -#}, {-# RULES #-} etc.
- GHC compilation process, GHC internals & Core language
LiquidHaskell
- -XArrows and
Arrow
PureScript
Agda
- Even more advanced monads: Indexed, Effect & Super- monads
- Zygohistomorphic prepromorphisms