In fact, I question most of the value of formal verifications for non critical software. Most of the problematic bugs that make it through in my experience are either a complex combination of multuple parts of the system interacting together in a way that doesn't end up behaving the way it was intended, or programmers implementing the wrong thing on edge cases.
Re: formal verification in general, most of the research has been moving towards making it easier to use and giving programmers some of the benefits of verification for free. I don't have any problem with the compiler telling me that my code is going to crash before the crash happens in production. That's unquestionably a valuable thing. Idris (and other languages) are trying to give you those sorts of benefits without reducing productivity or breaking your brain. It might not be there yet, but the progress is exciting.
Finally, both of the problems you identified (complex interactions and edge cases) are things that formal techniques are well suited to address... so I'm not sure how they support your case. Again, the only problem seems to be that the cost outweighs the benefits. But the cost is decreasing quickly.
To go beyond "protocols", UI form data to server response back to UI display in a web app is a source of major bugs. So many things are broken. Recently I had to add a spurious lap infant to book a flight due to JavaScript template being broken when rendering 0 children.
I'd love to QuickCheck the diapers out of this method.
The idea of a protocol in this sense encompasses pretty much any communication between things. This includes web service calls, user input via a UI, transactions between multiple systems, or even modules within the same program.
Sounds like you are describing Session Types!
(http://groups.inf.ed.ac.uk/abcd/) (http://summerschool2016.behavioural-types.eu/programme/Dardh...)
Edit (links):
OCaml: https://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.ht...
F#: https://msdn.microsoft.com/en-us/visualfsharpdocs/conceptual...
Haskell: https://hackage.haskell.org/package/base-4.9.1.0/docs/Text-P...
Prelude Text.Printf> printf "%d\n" "invalid"
*** Exception: printf: bad formatting char 'd'
The behaviour of F#'s printfn is hard-coded in the compiler and could not be written in F# iteself.https://ocaml.org/meetings/ocaml/2013/proposals/formats-as-g...
https://caml.inria.fr/mantis/view.php?id=6017
The compiler only does syntactic desugaring of format strings now.
Not so, in that Haskell package:
Prelude Text.Printf> printf "%d\n" 1
1
Prelude Text.Printf> printf "%d\n"
*** Exception: printf: argument list ended prematurely
Prelude Text.Printf> printf "%d\n" 0.5
*** Exception: printf: bad formatting char 'd'
Prelude Text.Printf> printf "%d\n" 1 2
1
*** Exception: printf: formatting string ended prematurely
It could certainly be done with TH/QQ. I'm not sure, offhand, if there is already a package to that effect.In Idris, the pattern used to implement this is available to anyone that knows the language. It feels a lot more natural than using a macro system or typeclasses -- it is just functions.
It had a browser based demo.
The Eve core is based on a distributed logic programming semantics (although SQL-like is a good accessible description). It was inspired by a datalog-based language called Dedalus (amongst other things).
1+2 * 3 == 9
Sick! I wish Haskell notices this.[1] https://www.manning.com/books/type-driven-development-with-i...
Also, if you have an arbitrary string that isn't a constant that can be analyzed statically — for example, a string read from a config file — how do you prove to the compiler that it's a valid format-code string?
it's just showing if you get through these 50 checks, by the time you get to printf the bytes will have been converted to what you need, or the program will have already errored out.
Anyway, is that really true? "%-1s" should probably give you an error, for example.
I linked it because its implementation is amazing comparatively and it is just one clean example of what is possible.
void Object.printf(String, Object)
and it evaluates types at runtime.Type systems are macro systems, it's just not obvious because type languages are very different from expression languages. The main "innovation" of Idris is hammering harder on this front. And in any case, the fact that most type languages are logic languages gives people with a formalist bent a warm feeling in their stomachs.
A few examples that I find very intriguing:
1. type safe printf: https://github.com/mukeshtiwari/Idris/blob/master/Printf.idr
2. compile-time evidence that a runtime check will be performed: https://github.com/idris-lang/Idris-dev/blob/master/libs/bas...
3. Most of all, compile-time checking of state machine properties http://docs.idris-lang.org/en/latest/st/introduction.html
Think about being able to specify protocols in the type system and ensuring that your client and server meet the specifications. The example in that link is about user authentication. Imagine having a proof that the program can only get into a "LoggedIn" state by going through the authentication protocol.