Invalid states should be unrepresentable


@sir But then instead of writing your program you write complicated types. Not great.

@sir @emersion this has been one thing that has interested/killed me about doing domain-specific work in F# recently - it's super easy to design types that allow for this kind of pragmatic state restriction but utilizing the interfaces you create (if they're strict enough) becomes an absolute nightmare for some reason.

@emersion @sir
simple code operating on complex data
is better than
complex code operating on simpler data

@emersion @sir That's just describing what states are valid, precisely and completely enough for the machine to be able to ensure that.
Either that, or boiling water, writing tons of overlapping tests for the imaginable cases, just to discover later on, and in the least favorable scenario, that the program indeed fails on a less easily imaginable ones.

@emersion @sir Speaking of the complexity, of course, dependent types in practice are a PITA. But I'd prefer to spend the time fighting the type-checker than writing the extensive tests.
The former is creative, the latter is not.

Sign in to participate in the conversation
