A read–eval–print loop lets you enter Haskell expressions and commands incrementally, observe their results, and prototype code before building a complete executable. section 2.0 section 2.1.2
A typical workflow is:
- Create or enter a Stack project, then start its interactive session with `stack repl`. section 2.1.2
- Use GHCi to load definitions from the project, including functions written in `src/Lib.hs`. section 2.1.2
- Enter expressions, bindings, type annotations, and function definitions; each input is evaluated immediately. section 2.1.2
- Read values and types at the prompt, while recognizing that assignments themselves produce no result. section 2.1.2
Evaluating bindings and a function
At the `ghci>` prompt, define typed values and a function, then evaluate them: `a = 1 :: Int`, `b = 2 :: Int`, `c = a + b`, `c` produces `3`; defining `square x = x * x` and evaluating `square 2` produces `4`. Multi-line definitions can be entered between `:{` and `:}`.
stack repl
Use the supplied `stack repl` command as the entry point for an interactive project session. section 2.1.2





