3 ms·
I'm not totally familiar with Shen's syntax, but it looks like something interesting is going on here. In particular, the judgement `pop` is being automatically
by tel 12y ago
I'm not totally familiar with Shen's syntax, but it looks like something interesting is going on here. In particular, the judgement `pop` is being automatically inferred and shown as impossible on the empty list. This is somewhat significantly more powerful than the similar Haskell technique. I'm not sure how Shen's type system works---perhaps some kind of subtyping is at play?
Note, that power is a tradeoff in type systems. Typically, greater power can be beneficial for encoding more sophisticated predicates into the type system... but it'll almost certainly have consequences. Normally, power leads to a loss of inference, a need to pass around more type information to prove your claimed types, and/or loss of totality.
Whether the power is worth it depends upon your domain.
- bravura 12y agoCan you elaborate upon in which domains that power is worth it? And when it is not?
- tel 12y agoAs a polarizing example—proof assistants use dependent typing. Their goal is to express interesting mathematical theorems as types and then finding typechecking programs constitutes as proof of those theorems. They absolutely want power and richness over inference---you probably wouldn't want to write a program with an inferable type anyway. It would be too boring.