Laziness in Haskell — Part 3: Demand
To better understand some counterintuitive evaluation puzzles, we explore the notion of “demand” as it exists in Haskell and discuss how it influences GHC’s choice of evaluation strategy.
To better understand some counterintuitive evaluation puzzles, we explore the notion of “demand” as it exists in Haskell and discuss how it influences GHC’s choice of evaluation strategy.
soltech, Mari This video series is really great!
jaror, I think pseq does have that "thunk forcing" behavior:
import GHC.Conc (pseq) val :: Int val = let x = error "x" y = error "y" in y `pseq` (x + y) main = print val
I believe this is guaranteed to show the
y
error and not thex
error.
Add comment