Python Introduction to Haskell & GHC
Haskell is a purely functional, statically typed language where functions have no side effects, variables are immutable by default, and expressions are evaluated only when needed (lazy evaluation).
"Think of pure functions in Haskell like mathematical formulas: f(x) = x^2 + 1 always yields the exact same output for the same input, with zero side effects or hidden mutable state."
Deep Dive: How It Works
Purity & Immutability: Every function is pure; given the same inputs, it always produces the same output without modifying global state or hardware registers behind the scenes.
Lazy Evaluation: Expressions are not evaluated when created; instead, they are represented as suspended computations (thunks) and evaluated only when their values are demanded.
GHC & GHCi: The Glasgow Haskell Compiler (GHC) compiles Haskell to native machine code; GHCi provides an interactive REPL.
Core Rules to Remember



Common Beginner Traps & How to Fix Them
Attempting to reassign a variable like in imperative languages (e.g. x = x + 1).Why it happens: In Haskell, = defines a mathematical identity, not a stateful memory assignment.
How to fix: Define new values or use recursion with function arguments.
Live Interactive Example
Hit Run Code to see it liveYour Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Print a Greeting Message
Write `main = putStrLn "Hello, Haskell World!"`.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.