|
|
|
|
|
by dmit
116 days ago
|
|
class Bean {
private boolean sprouted;
public void sprout() {
this.sprouted = true;
// ...
}
}
or data Bean = Dormant | Sprouted
sprout :: Bean -> Bean
sprout Dormant = Sprouted
sprout Sprouted = -- aw, beans, we could have modeled
-- this state as impossible to construct,
-- but you chose runtime checks, so
-- here we are.
As for pointing to the source line, I think JavaScript people solved that one for us with source maps. Just because we download and execute a single 4Mb line of minified code, doesn't mean we can't tell which line of the original source caused the error. :) |
|