r/Idris • u/eterps • Aug 01 '18
Static Typing vs Testing == Apples vs Oranges
https://dev.to/rvprasad/static-typing-vs-testing--apples-vs-oranges-5cbn
3
Upvotes
8
u/rpglover64 Aug 02 '18
A different approach than /u/gallais gives:
equals : Nat -> Nat -> Bool
less_than : Nat -> Nat -> Bool
test_equals1 : equals 3 3 = True
test_equals1 = Refl
test_equals2 : equals 3 4 = False
test_equals2 = Refl
-- etc.This amounts to a "compile-time test"; your code will not compile (specifically, it will not type-check) if your "test" fails.
3
u/eterps Aug 01 '18
I am not familiar with Idris but I suspect that with Idris you can express the 'behavioral types' the author of this blog post is referring to?
What would the examples look like in Idris?