I dunno, I had mixed feelings about using Dialyzer’s implementation of success typing. It was kind of annoying in practice to have it silently ignore ambiguously typed stuff. Not sire if that is more a problem with the tool ir success typing in general.
Conversation
The success typing paper is pretty cool, but the idea doesn’t seem to really fit with a type-driven workflow (ie. for design and refactoring support).
1
Fair enough. My actual view is somewhat more nuanced. I don’t believe that erased types are workable either, which I bet is a big part of the problem in Erlang. I also want reflection, contract enforcement, and other runtime services.
1
2
Erasure should be possible, but so should reification, so you can get zero-cost when compiled, or usable at runtime for parsing and value generation. The language has to be codesigned with its type system (and VM too!)
2
1
It seems like you can get a lot of mileage out of doing it "backwards" like io-ts does: build up a value and extract a type from it.
1
1
One thing that is popular in the Haskell/Rust/Dependent types world is using the type as a way to generate an implementation of things like serializers, deserializers, validators, etc. Not sure if that's possible with TS though.
1
Trouble with going from the value to a type is that things have the potential to get ambiguous - there are many types you can give to the same bit of data. I'll have to look at io-ts though to see how they handle things though.
1
Ohhh wait, this actually looks more like the 'generic programming' approach I was talking about in the tweet before last, but adapted to TypeScript. I could be wrong though.
1
Yeah I think you could do it easier in Flow, but it looks like a decent solution given the trade-offs present in Typescript. Will keep github.com/gcanti/io-ts bookmarked!
1
io-ts is a great existence proof of what you can do in TypeScript. Frequently, even people who use TS daily assume that you'd have to do code generation to achieve what it does.
1
2
Yeah, this is the kind of type directed code generation that I expect in languages like Haskell, Rust, Agda, etc. Good to see there are ways to do it in TS as well.


