Skip to content

This course is designed to teach non-engineers (e.g., self-taught/bootcamp coders) Haskell from zero to productive in an interactive, easy-to-follow way.

License

Notifications You must be signed in to change notification settings

input-output-hk/haskell-course

Β 
Β 

Repository files navigation

Haskell Course

VersiΓ³n en πŸ‡ͺπŸ‡Έ traducida por la comunidad

The easiest way to learn Haskell - R.M.

This course is designed to teach non-engineers (e.g., self-taught/bootcamp coders) Haskell from zero to productive in an interactive, easy-to-follow way. The course doesn't contain content specific to Marlowe or Plutus, but it will cover all the Haskell you'll needed to work with them.

For a more detailed explanation, keep reading or watch the introduction video: YouTube

How much should I study if I only wish to use Marlowe/Plutus?

In the outline below, there are clear stopping points (for both Marlowe and Plutus) where we deem you to know enough Haskell to effectively use the technology.

How to read/watch the lessons

To go through the interactive lessons, go to your chosen lesson's outline inside "What we'll cover" and click on the button that looks like the one below. If the page loads with a "500: Internal Server Error" just refresh it, and it should be fine. At the top, you will see a console that displays the progress of preparing your interactive lesson. During this time, you can scroll down and look at the lesson, that is displayed non-interactively.

Binder

And to see the video lessons, click on the button that looks like this:

YouTube

To do the homework

  1. Clone this repository.
  2. Create a GitPod account.
  3. Click this button to create a remote dev environment: Visual Studio Code
  4. Select the Homework/HomeworkXX folder with the homework you want to complete.
  5. Follow the instructions inside the Homework.hs or Main.hs file.
  6. Check the solutions in the solutions branch!

Repository structure

Haskell-Course
    |   |
    |   |---- Homework
    |          |
    |          |---- Homework01 (Homework for lesson 01)
    |          |---- Homework02 (Homework for lesson 02)
    |          ...
    |
    |-------- lessons (Lessons in Jupyter notebook format. Access through Binder.)
               |
               |---- 1-Introduction-to-haskell
               |---- 2-Functions-Data-Types-and-Signatures

Everything else can be safely ignored

To hang out and discuss with other students

FAQ

FAQ

Proposed changes for next iteration/version

Changes

What we'll cover

This is a tentative outline. Changes can (and will) be made as we advance with the course and gather feedback from students.

If there are no buttons on a lesson, it means that it's not published yet.


BEGINNER SECTION - GETTING STARTED WITH HASKELL - πŸ₯šβŸΆπŸ£

In this section, we get familiar with basic concepts and Haskell syntax.


1. Intro and tools Binder YouTube

  • Intro to the course and lectures
    • What we’ll cover
    • Repository structure
  • Intro to Haskell
    • How to open and use JupyterLab
    • Purely functional programming language
    • Basic syntax
    • Haskell Type system
    • Laziness
    • GHC (and GHCi)
  • GitPod
    • How to open and use GitPod
    • Example of how to complete a homework assignment.

2. Data types, Signatures, and Polymorphism Binder YouTube

  • Pragmatic intro to types
  • Type signature
    • Function’s signatures
    • Variables in Haskell
      • Parameters in functions
      • Names/Definitions
  • Infix and prefix functions
  • Data Types in depth
    • Int, Integer
    • Float, Double
    • Rational
    • Bool
    • Char
    • Lists
    • Strings
    • Tuples + Tuples VS Lists
  • Polymorphic values and type variables

3. Conditions and helper constructions Binder YouTube

  • If-then-else
  • Guards
  • let expressions
  • where
  • Should I use let or where?
  • Things to keep in mind

4. Pattern matching and Case Binder YouTube

  • What is pattern matching
  • Pattern matching on
    • Function implementations
    • Lists
    • Tuples
  • Case

5. Improving and combining functions Binder YouTube

  • Higher-order functions
    • The filter function
    • The any function
  • Lambda functions
  • Precedence and associativity
  • Curried functions
    • Partial application
  • Composing and applying functions
    • The $ operator
    • The . operator
  • Point-free style

6. Recursion Binder YouTube

  • Why Recursion?
  • Thinking Recursively
    • sum and product
  • Steps to create your own recursive function
  • Examples of recursion
    • and, length, reverse, drop, take, map, filter
  • Extracting the foldr pattern
  • The foldl function
  • The foldl' function
  • When to use foldr, foldl, and foldl'

7. Intro to Type Classes Binder YouTube

  • The awesomeness of type classes
  • What are type classes
  • Common type classes
    • Eq, Ord
    • Num, Integral, Floating
    • Read, Show
  • The most general valid type
  • Multiple constraints

8. Creating Non-Parameterized Types Binder YouTube

  • Type synonyms
    • How to define type synonyms
    • Why use type synonyms
  • Defining new types
    • Creating new types with data
    • Using new types
    • Value parameters
  • Record syntax

9. Creating Parameterized and Recursive Types Binder YouTube

  • Type Parameters
    • Prameteryzing type synonyms
    • Prameteryzing data types
  • Recursive data types
    • Tweet me a river
    • A Sequence of Nodes
    • A Tree of Nodes
  • Kinds
  • The newType keyword

10. Creating Type Classes and Instances Binder YouTube

  • Overloading
  • Steps to create Type Classes and Instances
  • The Eq type class
    • Defining the Type Class
    • Defining multiple instances
    • Improving our Eq type class with mutual recursion (and Minimal Complete Definitions)
    • Defining an instance for a parameterized type.
  • The WeAccept Type Class
  • The Container Type Class
  • Exploring Ord type class (Subclassing)
  • Deriving
    • Deriving can go wrong

11. Basic IO Binder YouTube

  • Pure functions
  • Introduction to IO actions
  • IO actions under the hood
  • IO actions in practice
    • The () type
  • Interacting with the user
    • getChar, getLine, and putStrLn
  • Actions are first-class values
  • Composing IO actions (>> and >>= operators)
  • The do block
    • Using let, nesting do-blocks, escaping IO and return
  • The main action
  • Concepts and syntax recap

BEGINNER SECTION - GAINING INDEPENDENCE - 🐣⟢πŸ₯

In this section, we learn about Haskell tooling and the necessary concepts to start working on our own projects.


12. Installing Haskell Locally Binder YouTube

  • Installing Haskell
    • Installing GHCup
    • Installing GHC, Cabal, Stack, and HLS with GHCup
    • Installing VSCode Extensions
  • Creating our first program
    • Writing the simplest Haskell program
    • Compiling and running our program

13. Modules Binder YouTube

  • Importing Modules
    • Controlling environments
    • Controlling namespaces
  • Creating our own Modules
  • The Prelude and Standard Libraries

14. Cabal and language extensions Binder YouTube

  • Cabal
    • Introduction to Cabal
    • Creating a new Haskell project
    • Going over the Cabal file using an external library
    • Building and running our executable
  • Language extensions and Pragmas
    • Introduction
    • NumericUnderscores
    • TypeApplications

15. Handling Errors Binder YouTube

  • There're always Exceptions to the rule
  • Speed-running Exceptions with a dumb self-driving πŸ€– car πŸš—
    • I'm the Exception cause I have class 😎
    • throw all the Exceptions you want. I'll catch them all!
  • Maybe give me a value? πŸ™
    • Benefits of optional values
  • Ok, you Either give me a value or a reason why you didn't!
  • From Exceptions to optional values
  • Tradeoffs
    • So, what should I use?

16. Learning on your own and final section project Binder YouTube

  • Small tips and tricks 🀹
    • REPL
    • Hackage
    • Hoogle
    • undefined
    • Type Holes πŸ•³οΈ
  • Section's Final Project πŸ₯³

BEGINNER SECTION - BASIC ABSTRACTIONS & EFFECTS - πŸ₯βŸΆπŸ“

In this section, we learn about a few of the most useful and talked about Abstractions in Haskell and how we deal with effects in general (not only IO).


17. Semigroup and Monoid Binder YouTube

  • What does it mean to abstract a pattern?
  • Why abstracting patterns (in general)?
  • Teaser: Why abstracting Semigroup and Monoid?
  • The Semigroup type class
  • The Monoid type class
  • What can I do with Semigroup and Monoid?

18. Functor Binder YouTube

  • Abstracting the map function
  • The Functor type class
  • Defining Functor instances
  • Seemingly unintuitive Functor instances
    • The Either a functor πŸ€”
    • The (,) a functor 🀨
    • The (->) r functor 🀯
  • Defining the <$> operator and lifting πŸ‹οΈ a function
  • Functor nesting dolls πŸͺ†
  • Extra functions and Functor as defined in base

19. Applicative and Effects Binder YouTube

  • Why Applicative functors?
    • Our journey until now
    • The limits of Functor
  • Function application at the Functor level πŸ₯‡
  • Being pure πŸ˜‡
  • The Applicative type class
  • The Applicative laws
  • πŸŽ† Programming with effects πŸŽ†
  • Extra functions and Applicative as defined in base

20. Project using Functor and Applicative

  • TODO

x. Monad

  • TODO

x. Reader, Writer, and State Monads

  • TODO

Maybe speed-running other type classes? πŸ€”

  • TODO

x. Final project

  • TODO

πŸ₯³ CONGRATULATIONS! πŸ₯³ You can call yourself a (beginner) Haskell developer!

Thank you for going on this journey with me! Please feel free to give us feedback through issues, email, or Twitter. And share this course if you find it valuable. πŸ˜„πŸ™Œ


Where can you go from now?

It depends on your preferences. You could:

  • If you're interested in Cardano, explore Marlowe, Plutus, Atlas, CardanoAPI, and other Cardano-related tools and libraries.
  • Start your own project and learn what you need on the way (e.g., a server, a compiler, a full-stack app using IHP)
  • Read Haskell books and sources that go into more advanced subjects. See recommended resources here.
  • Learn about specific subjects, for example (organized roughly by difficulty):
    1. Explore the base library and understand all types and type classes.
    2. Learn about Testing (unit vs property testing and QuickCheck).
    3. Explore how to deal with Concurrency and Parallelism.
    4. Learn about Parsers (Parser combinators, Alternative type class, MonadPlus, Parsec library).
    5. Learn how Haskell deals with data structures under the Hood.
    6. Monad Transformers and Free monads.
    7. Generic programming.
    8. Meta programming with Template Haskell.
    9. Type-level programming.

About

This course is designed to teach non-engineers (e.g., self-taught/bootcamp coders) Haskell from zero to productive in an interactive, easy-to-follow way.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 96.6%
  • Haskell 3.3%
  • Other 0.1%