Getting started

Haskell is a compiled, statically typed, purely functional language, and these twelve lessons put the compiler on the machine and a first program through it. They cover what the language is and where it runs, the install of GHC and cabal, the interactive shell, the first build and the exit status it returns, then functions and signatures, the numeric types, and the conditional that closes the part. Every later lesson assumes the toolchain of this one.

001 What Haskell is and where it runs purity, laziness and types before run time, the native binary, ghc and the first program Open 002 Install GHC and cabal the packages per system and the install pages, ghcup in words, PATH, ghc --version, ghc-pkg list, the version this course uses Open 003 GHCi: the interactive shell :load, :reload, :type, :info, :set, the transcript a reader can rerun Open 004 runghc, ghc and the exit status the interpreter against the compiler, the artefacts of a build, exitWith and $? Open 005 Your first program module Main (main) where, main :: IO (), putStr and putStrLn, the build and the run Open 006 Warnings, errors and -Wall unused imports and bindings, -Werror, a type error and its GHC code Open 007 Functions, application and layout definitions, application, parentheses, backticks, the offside rule Open 008 Types and type signatures every binding has a type, polymorphism, String is [Char], a wrong signature Open 009 Int, Integer, Double and defaulting machine integers, arbitrary precision, floats, div and mod against quot and rem, fromIntegral, type defaulting Open 010 Char, String and Bool character literals, escapes, Data.Char, ++, comparisons, && and ||, not Open 011 Tuples pair types, fst and snd, zip and unzip, a tuple as a result, the arity limit Open 012 if, guards and pattern guards if then else, guarded equations, otherwise, a pattern guard, the hlint rewrite Open

Lessons