And then you actually try to write it in a functional language, and end up with something like:
cake = map (cool . bake 30 175) . splitIntoPans $ mix [ butter, sugar, walnuts ]
cake = map (cool . bake 30 175) . splitIntoPans $ mix [ butter, sugar, walnuts ]
[butter, sugar, walnuts] |> mix() |> splitIntoPans(pans = 3) |> bake(time = 30, temp = 175) |> cool(time = 5)
[butter, sugar, walnuts]
mix()
splitIntoPans(pans = 3)
bake(time = 30, temp = 175)
cool(time = 5)
Hmm, wait a second..... [butter, sugar, walnuts]
^^^
Somewhere wanted type CakeIngredients but missing record field "Flour"
If imperative style programming came with type inference on the level of the Ocaml compiler sign me up. For now, though, I can spare a few cycles in exchange for correct programs.