Discusses the algebraic properties of types, different kinds of functions and the information that is preserved or lost, and Category Theory concepts that underpin and unify them.
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
Your data structures are made of maths!
1. Category Theory for Beginners
Your data structures
are made of maths!
Melbourne Scala User Group Mar 2015
@KenScambler
2. Data structures
More and more “logical”
Less low-level memory/hardware connection
More and more support for immutability
We can use maths to reason about them!
Category Theory can reveal even deeper symmetries
85. Expanding a list…
L(a) = 1 + a L(a)
= 1 + a (1 + a L(a))
= 1 + a + a2 (1 + a L(a))
…
= 1 + a + a2 + a3 + a4 + a5…
86. Expanding a list…
L(a) = 1 + a L(a)
= 1 + a (1 + a L(a))
= 1 + a + a2 (1 + a L(a))
…
= 1 + a + a2 + a3 + a4 + a5…
Nil
or 1-length
or 2-length
or 3-length
or 4-length
etc
87. What does it mean for
two types to have the
same number?
119. Tightening the definitions
A × BA B
first seco
nd
×
×
trait ProductPlusPlus[A,B] {
def first: A
def second: B
def banana: Banana
def brother: BluesBrother
}
120. A × BA B
first seco
nd
×
×
Does that still count as A × B?
192. Isomorphism is more
interesting than
equality!
Isomorphic types can be
rewritten, optimised without
error.
Isomorphic mappings allow
us to preserve information
194. Again, Category Theory
shows us deeper, simpler
patterns, unifying concepts
that otherwise look different
?
?
×
+
195. Further reading
Awodey, “Category Theory”
Lawvere & Schanuel, “Conceptual Mathematics: an
introduction to categories”
Jeremy Kun, “Math ∩ Programming” at
http://jeremykun.com/
Chris Taylor, “The algebra of algebraic datatypes”
http://chris-taylor.github.io/blog/2013/02/10/the-algebra-of-
algebraic-data-types/
http://chris-taylor.github.io/blog/2013/02/11/the-algebra-of-
algebraic-data-types-part-ii/
http://chris-taylor.github.io/blog/2013/02/13/the-algebra-of-
algebraic-data-types-part-iii/
196. Further reading
Bartosz Milewski “Categories for Programmers”
http://bartoszmilewski.com/2014/10/28/category-theory-for-
programmers-the-preface/
http://bartoszmilewski.com/2015/03/13/function-types/