TIL that Haskell does not complain about incomplete pattern matches by default!
miniblog.
Related Posts
I've added syntax highlighting to the prompt of my programming language!
It's not strictly necessary, but it's nice to have. It caught a bug with lexing incomplete string literals too.
I'm designing a programming language and trying to decide the type of `let x = 1;`. Should it be Unit or Int?
Advantage of Int: really convenient when evaluating snippets in a REPL.
Advantage of Unit: It's much less confusing when type inference runs on an incomplete function.
Counter-intuitively, if you're writing a parser for a programming language, you need it to be a total function. As soon as you build IDE tooling, you need ASTs from invalid or incomplete input.
The parser should return (Ast, List<Error>) rather than Result<Ast, Error>.