3 ms·
Somewhat tangential: but I love the LiquidHaskell demos, mostly because they show what would be possible if our tools would just be a tiny bit smarter. Example
by fho 5y ago
Somewhat tangential: but I love the LiquidHaskell demos, mostly because they show what would be possible if our tools would just be a tiny bit smarter.
Example:
1. Goto here: http://goto.ucsd.edu:8090/index.html#?demo=Order.hs
2. Run Check, it should turn green
3. Break the code, e.g. turn around the >= sign in line 147
4. Run Check again, it will turn red and highlight line 147 and 148
What happened here?
We told the compiler that elements in an ordered list will be in increasing order (l.119). Now the compiler is able to check that constraint and by turning around the comparison we violated the it.
Ie by telling the compiler a tiny bit about our goals (have ordered lists) it is now able to check that our algorithm is correct.