Wrapping Up Idris

If you’re used to dynamically typed languages, Idris represents a tremendously steep technical challenge. If, on the other hand, you’re already comfortable with dependent types and category theory, you’ll likely appreciate the many advances that Edwin Brady has made to bring this language closer to the mainstream. Let’s break down the strengths and weaknesses.

Strengths

With Idris, types know more, so they can do more. In this chapter, we looked at four practical improvements due to dependent types:

  1. With more type information, compilers can catch more complex bugs, including logic errors, at compile time.

  2. When types can express structure, automatic code completion can go far beyond basic syntax—to a degree that’s potentially revolutionary.

  3. The same information about types allows better proofs about your code. In certain fields, like protocols and cryptography, mistakes are much harder to find and more expensive when they slip through. In Idris, you can prove certain properties about your code (rather than just spot-checking with unit tests).

  4. Idris allows a good virtual whiteboard to reason about program structure and types. This capability is useful to students and working programmers alike.

Building more information into types leads to smarter tools and compilers. It can lead to better programs, even ones we know are correct.

Weaknesses

There’s a downside to that extra information in dependent types: you have to take the time to express them. The learning curve is steep, even more so than for Haskell, and the code can be quite dense. Idris is not for everyone.

One other drawback to Idris, and one we’re hoping to remedy in part by introducing it here, is that there aren’t many examples of its use floating around. The tutorials will get you to Hello, world!, but then the trail ends abruptly at an edifice of types.

Final Thoughts

Very few languages change the way that you fundamentally approach programming. Idris certainly had that effect on us. It improved our habits and gave us a clear way to think through our types—and yet, it did so without imposing a lot of overhead and ceremony. This mental revolution will serve us well on all our projects, no matter what the type system looks like.

The tooling, particularly theorem proving and code completion, is much more powerful and advanced than we’ve seen in other languages—and we didn’t even need an expensive IDE to get the benefit.

Idris may not be a commercially popular language, but that will not lessen its contribution. Idris will increasingly make its mark in places where behavior is complex and mistakes are expensive. It may also be the language that finally brings programming rigor to the masses.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset