Hello World
main :: IO ()
main = putStrLn "Hello, world!"

Run the file:

runhaskell Main.hs

This prints one line from main, which is the usual entry point for a small Haskell program.

Values

Values are immutable. Type annotations are optional, but useful for clarity.

name :: String
name = "Dan"

count :: Int
count = 1

active :: Bool
active = True

These are immutable bindings. You describe what each value is, not how to update it later.

Functions
greet :: String -> String
greet name = "Hello, " ++ name ++ "!"

double :: Int -> Int
double x = x * 2

This shows two simple pure functions. They take input and return output without changing outside state.