Error Lab
Every diagnostic below is the real output of ptc, not a mock-up. Pick a mistake, read how the compiler teaches the canonical form, then flip to the fix.
Higher-order, fully typed
map knows the element type of your list and compares it against the lambda you passed — the error shows both fn types side by side.
let xs = [1, 2]
let ys = xs.map(fn(x: Text) -> Text = x)The compiler answers
error: map on List[Int] needs a fn(Int) -> U, found fn(Text) -> Text (line 2, column 10)let xs = [1, 2]
let ys = xs.map(fn(x: Int) -> Text = "#{x}")
print(ys.join(" "))Fixed — and it runs
#1 #2