Challenge 3: An Incomplete Pattern, Caught by -Wincomplete-patterns — Possible Solution ==================================================================== Broken attempt — Main.hs: data Shape = Circle Double | Rectangle Double Double area :: Shape -> Double area (Circle r) = pi * r * r -- Rectangle case deliberately omitted Terminal: $ ghc -Wincomplete-patterns Main.hs Representative warning: Main.hs:3:1: warning: [-Wincomplete-patterns] Pattern match(es) are non-exhaustive In an equation for 'area': Patterns not matched: Rectangle _ _ Fixed — Main.hs: data Shape = Circle Double | Rectangle Double Double area :: Shape -> Double area (Circle r) = pi * r * r area (Rectangle w h) = w * h Recompiling with -Wincomplete-patterns now produces no warning at all. Explanation: GHC's exhaustiveness checker inspects every constructor Shape actually has (Circle and Rectangle) and compares that against the patterns area actually covers. Since only Circle is handled, GHC identifies the exact missing pattern -- Rectangle _ _ -- and reports it by name, rather than a vague "might be incomplete" message. Adding the missing equation resolves the warning entirely, since every constructor now has a matching pattern. WHY THIS WORKS AS AN ANSWER ------------------------------ This reproduces the chapter's own missing-Rectangle-case example exactly, compiles it with the recommended -Wincomplete-patterns flag to get the real warning text, and then fixes it by adding the missing equation, confirming the warning disappears.