Re:Six programming languages I’d like to see
by mejutoco on Wednesday July 13, 2022 @11:33AM
(#32084102)
Types in Idris sound like the contracts you mention.
I learnt about them in the book "Type-Driven Development with Idris".
[ Parent
| on HN ]
Re:Six programming languages I’d like to see
by mcguire on Wednesday July 13, 2022 @02:49PM
(#32087106)
There is a fairly close relationship between a dependently typed language, like Idris, and 'contracts' (really, pre- and post-conditions plus other propositions) in languages like Ada/SPARK, Dafny, and Frama-C.
The major differences are that most (all?) dependently typed languages are functional and require the programmer to prove the correctness of the contract in (an extension of) the language itself, while the others typically use special annotations in normal Ada/C/a generic ALGOLish language and dump the proof onto external tools like SMT solvers, all resulting in a more 'normal' programming experience.
Re:Six programming languages I’d like to see
by throwaway17_17 on Wednesday July 13, 2022 @03:42PM
(#32087821)
I think liquid types, ala Liquid Haskell are a preferable middle ground in this scenario. The SMT is built into the type checker and the refinements are limited to a linearly decidable proof fragment. Dominic Orchard has done some work generalizing the capabilities of these types of refinement by showing that the refinement fragment need to just be a semi-ring structure and the SMT can still resolve. This would cover a large portion of contracts and not impart the development process in large part.