you don’t have to fix 10 times, you can move forward on top of what you’ve built. It may not be quite as catchy as ‘move fast and break things’ but it’s how we operate now.” Mark Zuckerberg http://is.gd/vx3tgj
“types” is boring yet fraught Little help with program construction, refactoring Type checkers eliminate whole classes of errors for free Principled abstractions. . . where are they?
without feature Y? How will I reason about your program to do X if you use Y? What use is a program without side effects? What use is a program with uncontrolled side effects?
without feature Y? How will I reason about your program to do X if you use Y? What use is a program without side effects? What use is a program with uncontrolled side effects? What about algorithms that are inherently stateful?
without feature Y? How will I reason about your program to do X if you use Y? What use is a program without side effects? What use is a program with uncontrolled side effects? What about algorithms that are inherently stateful? They don’t exist. (Church-Turing thesis)
without feature Y? How will I reason about your program to do X if you use Y? What use is a program without side effects? What use is a program with uncontrolled side effects? What about algorithms that are inherently stateful? They don’t exist. (Church-Turing thesis) It’s fine, I’ve got this.
without feature Y? How will I reason about your program to do X if you use Y? What use is a program without side effects? What use is a program with uncontrolled side effects? What about algorithms that are inherently stateful? They don’t exist. (Church-Turing thesis) It’s fine, I’ve got this. No you don’t (and neither do I).
without feature Y? How will I reason about your program to do X if you use Y? What use is a program without side effects? What use is a program with uncontrolled side effects? What about algorithms that are inherently stateful? They don’t exist. (Church-Turing thesis) It’s fine, I’ve got this. No you don’t (and neither do I). Apologise to your team mates and future-self right now.
langauges as if they were written in a total language. justified (mathematically) in Fast and loose reasoning is morally correct, Danielsson et al. 2006 costs nothing; you can write any program without using escape hatches and you gain composability referential integrity equational reasoning reuse
a piece of paper. Tell me its type, but be careful not to let me see the function’s definition. I will tell you a theorem that the function satisfies.” Theorems for Free! Wadler 1989 Polymorphic types are: partial (sometimes complete) specifications implementor cannot use any type-specific behaviour caller has guarantee function will work for any type machine-checkable documentation a free source of useful theorems (parametricity)
do? reverse a list? drop the first element? ignore its argument return an empty list? Theorem: every element in the output appears in the input Theorem: ∀ g. map g ◦ f = f ◦ map g
framework how to generate random values framework generates lots of data, tries to falsify properties the best test data is random test data QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. Claessen and Hughes 2000 Talk: https://youtu.be/TSDTDqoH_vM
proof assistants: Agda, Coq, Idris no proof, no program can prove correctness, equivalence, complexity, . . . program extraction to other languages Idris talk/demo: https://youtu.be/4i7KrG1Afbk
find an FP group in your city https://github.com/NICTA/course Software Foundations Course on mathematical underpinnings of reliable software http://www.cis.upenn.edu/~bcpierce/sf
friend Avoid traps and use fast and loose reasoning Parametric polymorphism gives you theorems for free Algebraic properties → more thorough tests with less effort Use the right tools
the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/. Slides https://github.com/frasertweedale/talks/ Twitter @hackuador Email [email protected]