SlideShare a Scribd company logo
1 of 209
Category Theory for
beginners
Melbourne Scala User Group Feb 2015
@KenScambler
A B
C
Abstract maths… for us?
Dizzyingly abstract branch of maths
“Abstract nonsense”?
Programming = maths
Programming = abstraction
Really useful to programming!
The plan
Basic Category Theory concepts
New vocabulary (helpful for further reading)
How it relates to programming
Category Theory as seen by maths versus FP
A bit of background
1940s Eilenberg, Mac Lane invent Category Theory
1958 Monads discovered by Godement
In programming:
1990 Moggi, Wadler apply monads to programming
2006 “Applicative Programming with Effects” McBride &
Paterson
2006 “Essence of the Iterator Pattern” Gibbons & Oliveira
I. Categories
Category
Objects
Category
Objects
Arrows or
morphisms
Category
Objects
Arrows
Domain f
dom(f)
Category
Objects
Arrows
Domain/Codomain f
cod(f)
dom(f)
Category
Objects
Arrows
Domain/Codomain
dom(g)
cod(g)
g
Category
Objects
Arrows
Domain/Codomain
Category
Objects
Arrows
Domain/Codomain
Composition
f
Category
Objects
Arrows
Domain/Codomain
Composition
f
g
Category
Objects
Arrows
Domain/Codomain
Composition
f
g
g ∘ f
Category
Objects
Arrows
Domain/Codomain
Composition
f
Category
Objects
Arrows
Domain/Codomain
Composition
f
h
Category
Objects
Arrows
Domain/Codomain
Composition
f
h
h ∘ f
Category
Objects
Arrows
Domain/Codomain
Composition
Identity
Category
Compose
∘ : (B  C)  (A  B)  (A 
C)
Identity
id : A  A
Category Laws
Associative Law
(f ∘ g) ∘ h = f ∘ (g ∘ h )
Identity Laws
f ∘ id = id ∘ f = f
Associative law
(f ∘ g) ∘ h = f ∘ (g ∘ h )
f
g
h
(g ∘ h)
(f ∘ g)
Associative law
(f ∘ g) ∘ h = f ∘ (g ∘ h )
f
g
h
(g ∘ h)
(f ∘ g)
Associative law
(f ∘ g) ∘ h = f ∘ (g ∘ h )
f
g
h
(g ∘ h)
(f ∘ g)
Associative law
(f ∘ g) ∘ h = f ∘ (g ∘ h )
f
g
h
(g ∘ h)
(f ∘ g)
Associative law
(f ∘ g) ∘ h = f ∘ (g ∘ h )
f
g
h
(g ∘ h)
(f ∘ g)
Associative law
(f ∘ g) ∘ h = f ∘ (g ∘ h )
f
g
h
(g ∘ h)
(f ∘ g)
Associative law
(f ∘ g) ∘ h = f ∘ (g ∘ h )
f
g
h
(g ∘ h)
(f ∘ g)
Identity laws
f ∘ id = id ∘ f = f
f
id id
Identity laws
f ∘ id = id ∘ f = f
f
id id
Identity laws
f ∘ id = id ∘ f = f
f
id id
Identity laws
f ∘ id = id ∘ f = f
f
id id
Examples
Infinite categories
Finite categories
Objects can represent anything
Arrows can represent anything
As long as we have composition and identity!
Sets & functions
Person
String Integer
bestFriend
length
name age
+1
Sets & functions
Infinite arrows from composition
+1∘ length ∘ name
bestFriend ∘ bestFriend
bestFriend ∘ bestFriend ∘ bestFriend
+1∘ age∘ bestFriend
Sets & functions
Objects
Arrows
Composition
Identity
Sets & functions
Objects = sets (or types)
Arrows = functions
Composition = function composition
Identity = identity function
Zero
One
Two
Three
Class hierarchy
IFruit
IBanana
AbstractBanana
BananaImpl MockBanana
Tool
Spanner
Class hierarchy
Objects
Arrows
Composition
Identity
Class hierarchy
Objects = classes
Arrows = “extends”
Composition = “extends” is transitive
Identity = trivial
Class hierarchy
Partially ordered sets (posets)
Objects = elements in the set
Arrows = ordering relation ≤
Composition = ≤ is transitive
Identity = trivial
World Wide Web
www.naaawcats.com
No dogs allowed!
www.robodogs.com
See here for more
robots
www.coolrobots.com
BUY NOW!!!!
World Wide Web
Objects = webpages
Arrows = hyperlinks
Composition = Links don’t compose
Identity
World Wide Web
Graphs
Objects = nodes
Arrows = edges
Composition = Edges don’t compose
Identity
“Free Category” from
graphs!
Objects = nodes
Arrows = paths (0 to many edges)
Composition = aligning paths end to
end
Identity = you’re already there
Categories in code
trait Category[Arrow[_,_]] {
def compose[A,B,C](
c: Arrow[B,C],
d: Arrow[A,B]): Arrow[A,C]
def id[A]: Arrow[A,A]
}
Category of Types & Functions
object FnCat
extends Category[Function1] {
def compose[A,B,C](
c: B => C,
d: A => B): A => C = {
a => c(d(a))
}
def id[A]: A => A = (a => a)
}
Category of Garden Hoses
sealed trait Hose[In, Out] {
def leaks: Int
def kinked: Boolean
def >>[A](in: Hose[A, In]):
Hose[A, Out]
def <<[A](out: Hose[Out, A]):
Hose[In, A]
}
Category of Garden Hoses
[live code example]
Categories embody the
principle of
strongly-typed
composability
II. Functors
Functors
Functors map between categories
Objects  objects
Arrows  arrows
Preserves composition & identity
Functor laws
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
Identity Law
F(idA) = idF(A)
C
F
DCategory Category
Functor
C
F
DCategory Category
Functor
CatCategory of categories
C
F
DCategory Category
Functor
CatCategory of categories
Objects = categories
Arrows = functors
Composition = functor composition
Identity = Identity functor
C
F
D
A
B
C
g ∘ f
f
g
C
F
D
A
B
C
g ∘ f
f
g
F(A)
C
F
D
A
B
C
g ∘ f
f
g
F(A)
F(B)
C
F
D
A
B
C
g ∘ f
f
g
F(A)
F(B)
F(C)
C
F
D
A
B
C
g ∘ f
f
g
F(A)
F(B)
F(C)
F(f)
C
F
D
A
B
C
g ∘ f
f
g
F(A)
F(B)
F(C)
F(f)
F(g
)
C
F
D
A
B
C
g ∘ f
f
g
F(A)
F(B)
F(C)
F(f)
F(g
)
F(g ∘ f)
g ∘ f
f
g
F(f)
F(g
)
F(g ∘ f)
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
g ∘ f
f
g
F(f)
F(g
)
F(g ∘ f)
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
g ∘ f
f
g
F(f)
F(g
)
F(g ∘ f)
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
g ∘ f
f
g
F(f)
F(g
)
F(g ∘ f)
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
g ∘ f
f
g
F(f)
F(g
)
F(g ∘ f)
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
g ∘ f
f
g
F(f)
F(g
)
F(g ∘ f)
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
g ∘ f
f
g
F(f)
F(g
)
F(g ∘ f)
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
g ∘ f
f
g
F(f)
F(g
)
F(g ∘ f)
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
g ∘ f
f
g
F(f)
F(g
)
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
F(g) ∘ F(f)
g ∘ f
f
g
F(f)
F(g
)
Composition Law
F(g ∘ f) = F(g) ∘ F(f)
F(g) ∘ F(f)
F(g ∘ f)
Identity law
F(idA)= idF(A)
A
Identity law
F(idA)= idF(A)
A
idA
Identity law
F(idA)= idF(A)
A
idA
F(idA)
Identity law
F(idA)= idF(A)
A
Identity law
F(idA)= idF(A)
A F(A)
Identity law
F(idA)= idF(A)
A F(A)
idF(A)
Identity law
F(idA)= idF(A)
A F(A)
idF(A)
A
idA
F(idA)
Terminology
homomorphism
Terminology
homomorphism
Same
Terminology
homomorphism
Same-shape-ism
Terminology
homomorphism
“structure preserving map”
Terminology
homomorphism
Functors are
“category homomorphisms”
Functors in code
trait Functor[F[_]] {
def map[A,B](fa: F[A],
f: A => B): F[B]
}
Functors in code
trait Functor[F[_]] {
def map[A,B](fa: F[A],
f: A => B): F[B]
}
Objects to objects
Functors in code
trait Functor[F[_]] {
def map[A,B](fa: F[A],
f: A => B): F[B]
}
Arrows to arrows
Functors in code
trait Functor[F[_]] {
def map[A,B]:
(A => B) => (F[A] => F[B])
}
Arrows to arrows
Functors laws in code
fa.map(f).map(g)
==
fa.map(g compose f)
Functors laws in code
fa.map(a => a) == fa
Terminology
endomorphism
Terminology
endomorphism
Within
Terminology
endomorphism
Within -shape-ism
Terminology
endomorphism
“a mapping from
something back to itself”
Terminology
endo
“a mapping from
something back to itself”
Endofunctors
In Scala, all our functors
are
actually endofunctors.
Type
F
Category Category
Endofunctor Type
Endofunctors
Luckily, we can represent
any functor in our type
system as some F[_]
Type F
Category Category
Endofunctor
Type
List Functor
sealed trait List[+A]
case class Cons(head: A, tail: List[A])
extends List[A]
case object Nil extends List[Nothing]
List Functor
sealed trait List[+A] {
def map[B](f: A => B): List[B] =
this match {
case Cons(h,t) => Cons(f(h), t map f)
case Nil => Nil
}
}
}
List Functor
potatoList
.map(mashEm)
.map(boilEm)
.map(stickEmInAStew)
List Functor
userList
.map(_.name)
.map(_.length)
.map(_ + 1)
.map(_.toString)
Other functors
trait Tree[A]
trait Future[A]
trait Process[A]
trait Command[A]
X => A
(X, A)
trait Option[A]
Functors
Fundamental concept in Category Theory
Super useful
Everywhere
Staple of functional programming
Write code that’s ignorant of unnecessary context
III. Monoids
Monoids
Some set we’ll call M
Compose
• : M × M  M
Identity
id : M
Monoid Laws
Associative Law
(f • g) • h = f • (g • h )
Identity Laws
f • id = id • f = f
Category Laws
Associative Law
(f ∘ g) ∘ h = f ∘ (g ∘ h )
Identity Laws
f ∘ id = id ∘ f = f
Monoids
Compose
• : M × M  M
Identity
id : M
Category
Compose
∘ : (B  C)  (A  B)  (A 
C)
Identity
id : A  A
Category with 1 object
Compose
∘ : (A  A)  (A  A)  (A 
A)
Identity
id : A  A
Category with 1 object
Compose
∘ : M  M M
Identity
id : M
Monoids are categories
Each arrow is an element
in the monoid
Only one object
Monoids are categories
Objects = placeholder singleton
Arrows = elements of the monoid
Composition = •
Identity = id
Only one object
Each arrow is an element
in the monoid
M
H
N
Monoid Monoid
Monoid homomorphism
(SM, •M, idM) (SN, •N, idN)
M
H
N
Monoid Monoid
Monoid homomorphism
(SM, •M, idM) (SN, •N, idN)
MonCategory of monoids
M
H
N
Monoid Monoid
Monoid homomorphism
(SM, •M, idM) (SN, •N, idN)
MonCategory of monoids
Objects = monoids
Arrows = monoid homomorphisms
Composition = function composition
Identity = Identity function
M H
N
SM SN
“structure-preserving map”
Set Set
function
h
Sets
Where h preserves composition &
identity
Example
String length is a monoid
homomorphism from
(String, +, "") to
(Int, +, 0)
Preserves identity
Preserves composition
"".length == 0
(str1 + str2).length =
str1.length + str2.length
Monoids in code
trait Monoid[M] {
def compose(a: M, b: M): M
def id: M
}
Monoids in code
def foldMonoid[M: Monoid](
ms: Seq[M]): M = {
ms.foldLeft(Monoid[M].id)
(Monoid[M].compose)
}
Int / 0 / +
import IntAddMonoid._
foldMonoid[Int](Seq(
1,2,3,4,5,6))
 21
Int / 1 / *
import IntMultMonoid._
foldMonoid[Int](Seq(
1,2,3,4,5,6))
 720
String / "" / +
foldMonoid[String](Seq(
"alea",
"iacta",
"est"))
 ”aleaiactaest"
Endos / id / ∘
def mash: Potato => Potato
def addOne: Int => Int
def flipHorizontal: Shape => Shape
def bestFriend: Person => Person
A=>A / a=>a / compose
foldMonoid[Int => Int](Seq(
_ + 12,
_ * 2,
_ - 3))
 (n: Int) => ((n + 12) * 2) - 3
Are chairs monoids?
Chair
Composition =
You can’t turn two chairs into one
Identity =
Chair stack
Chair stack
Composition = stack them on top
Identity = no chairs
Chair Stack is
the
free monoid of
chairs
Protip: just take 0-to-many of
anything, and you get a
monoid for free
…almost
Real monoids don’t topple;
they keep scaling
Monoids embody the
principle of
weakly-typed
composability
IV. Products & sums
Algebraic Data Types
List[A]
- Cons(A, List[A])
- Nil
Option[A]
- Some(A)
- None
BusinessResult[A]
- OK(A)
- Error
Wiggles
- YellowWiggle
- BlueWiggle
- RedWiggle
- PurpleWiggle
Address(Street, Suburb,
Postcode, State)
Algebraic Data Types
Cons(A × List[A])
+ Nil
Some(A)
+ None
OK(A)
+ Error
YellowWiggle
+ BlueWiggle
+ RedWiggle
+ PurpleWiggle
Street × Suburb × Postcode × State
Algebraic Data Types
A × List[A] + 1
A + 1
A + 1
4
Street × Suburb × Postcode × State
Algebraic Data Types
A × List[A] + 1
A + 1
A + 1
4
Street × Suburb × Postcode × State
isomorphic
Terminology
isomorphism
Terminology
isomorphism
Equal
Terminology
isomorphism
Equal-shape-ism
Terminology
isomorphism
“Sorta kinda the same-ish”
but I want to sound really
smart
- Programmers
Terminology
isomorphism
“Sorta kinda the same-ish”
but I want to sound really
smart
- Programmers
Terminology
isomorphism
One-to-one mapping
between two objects so
you can go back-and-forth
without losing information
Isomorphism
object
object
arrows
Isomorphism
Same as
identity
Isomorphism
Same as
identity
These 4
Shapes
Wiggles
Set
functions
Set
These 4
Shapes
Wiggles
These 4
Shapes
Wiggles
There can be lots of
isos between two
objects!
If there’s at least one, we
can say they are
isomorphic
or A ≅ B
Products
A × BA B
first seco
nd
Given the product of A-and-B,
we can obtain both A and B
Sums
A + BA B
left right
Given an A, or a B, we have
the sum A-or-B
Opposite categories
C Cop
A
B
C
g ∘ f
f
g
A
B
C
fop ∘ gop
fop
gop
Isomorphic!
A
B
C
g ∘ f
f
g
A
B
C
f ∘ g
f
g
Just flip the arrows, and
reverse composition!
A
A×B
B
A product in C is a sum in Cop
A sum in C is a product in Cop
A+B
B
A
C Cop
Sums ≅ Products!
Terminology
dual
An object and its equivalent in the
opposite category are
to each other.
Terminology
Co-(thing)
Often we call something’s dual a
Terminology
Coproducts
Sums are also called
V. Composable
systems
Growing a system
Banana
Growing a system
Growing a system
Growing a system
Bunch
Growing a system
Bunch
Bunch
Growing a system
Bunch
Bunch
Bunch
Growing a system
Bunch
Bunch
Bunch
BunchManager
Growing a system
Bunch
Bunch
Bunch
BunchManager
AnyManagers
compose
compose
etc…
Using composable
abstractions means your
code can grow without
getting more complex
Categories and Monoids
capture the essence of
composition in software!
Look for Monoids and
Categories in your domain
where you can
You can even bludgeon non-
composable things into free
monoids and free categories
VI. Abstraction
Spanner
Spanner
AbstractSpanner
Spanner
AbstractSpanner
AbstractToolThing
Spanner
AbstractSpanner
AbstractToolThing
GenerallyUsefulThing
Spanner
AbstractSpanner
AbstractToolThing
GenerallyUsefulThing
AbstractGenerallyUsefulThingFactory
Spanner
AbstractSpanner
AbstractToolThing
GenerallyUsefulThing
AbstractGenerallyUsefulThingFactory
WhateverFactoryBuilder
That’s not what
abstraction
means.
Code shouldn’t know
things that aren’t
needed.
def getNames(users: List[User]):
List[Name] = {
users.map(_.name)
}
def getNames(users: List[User]):
List[Name] = {
println(users.length)
users.map(_.name)
}
Over time…
def getNames(users: List[User]):
List[Name] = {
println(users.length)
if (users.length == 1) {
s”${users.head.name} the one and only"
} else {
users.map(_.name)
}
}
“Oh, now we need
the roster of names!
A simple list won’t
do.”
def getRosterNames(users: Roster[User]):
Roster[Name] = {
users.map(_.name)
}
def getRosterNames(users: Roster[User]):
Roster[Name] = {
LogFactory.getLogger.info(s”When you
party with ${users.rosterTitle}, you must
party hard!")
users.map(_.name)
}
Over time…
def getRosterNames(users: Roster[User]):
Roster[Name] = {
LogFactory.getLogger.info(s"When you
party with ${users.rosterTitle}, you must
party hard!")
if (users.isFull) EmptyRoster("(everyone)
")
else users.map(_.name)
}
When code knows too much,
soon new things will appear
that actually require the other
stuff.
Coupling has
increased. The mixed
concerns will tangle
and snarl.
Code is rewritten each time for
trivially different requirements
def getNames[F: Functor](users: F[User]):
F[Name] = {
Functor[F].map(users)(_.name)
}
getNames(List(alice, bob, carol))
getNames(Roster(alice, bob, carol))
Not only is the abstract code
not weighed down with
useless junk, it can’t be!
Reusable out of the box!
Abstraction is
about hiding
unnecessary
information. This
a good thing.
We actually know more about what the code
does, because we have stronger
guarantees!
We’ve seen deep
underlying patterns
beneath superficially
different things
A×B A+B
Just about everything
ended up being in a
category, or being one.
There is no better
way to understand
the patterns
underlying software
than studying
Category Theory.
Further reading
Awodey, “Category Theory”
Lawvere & Schanuel, “Conceptual Mathematics: an
introduction to categories”
Jeremy Kun, “Math ∩ Programming” at
http://jeremykun.com/
Gabriel Gonzalez “Haskell for all”
http://www.haskellforall.com/2012/08/the-category-design-
pattern.html
http://www.haskellforall.com/2014/04/scalable-program-
architectures.html

More Related Content

What's hot

Functor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadOliver Daff
 
Computational Complexity: Complexity Classes
Computational Complexity: Complexity ClassesComputational Complexity: Complexity Classes
Computational Complexity: Complexity ClassesAntonis Antonopoulos
 
Math 101 (Function)
Math 101 (Function)Math 101 (Function)
Math 101 (Function)undsdhd
 
TOPOLOGY and TYPES OF TOPOLOGY PowerPoint
TOPOLOGY and TYPES OF TOPOLOGY PowerPointTOPOLOGY and TYPES OF TOPOLOGY PowerPoint
TOPOLOGY and TYPES OF TOPOLOGY PowerPointAqsaAhmed26
 
Running Free with the Monads
Running Free with the MonadsRunning Free with the Monads
Running Free with the Monadskenbot
 
Topology for Computing: Homology
Topology for Computing: HomologyTopology for Computing: Homology
Topology for Computing: HomologySangwoo Mo
 
Peeking inside the engine of ZIO SQL.pdf
Peeking inside the engine of ZIO SQL.pdfPeeking inside the engine of ZIO SQL.pdf
Peeking inside the engine of ZIO SQL.pdfJaroslavRegec1
 
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...Philip Schwarz
 
Purely Functional Data Structures in Scala
Purely Functional Data Structures in ScalaPurely Functional Data Structures in Scala
Purely Functional Data Structures in ScalaVladimir Kostyukov
 
Introduction to Recursion (Python)
Introduction to Recursion (Python)Introduction to Recursion (Python)
Introduction to Recursion (Python)Thai Pangsakulyanont
 
The Lambda Calculus and The JavaScript
The Lambda Calculus and The JavaScriptThe Lambda Calculus and The JavaScript
The Lambda Calculus and The JavaScriptNorman Richards
 
Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )swapnac12
 
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial OrderingCMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Orderingallyn joy calcaben
 
Group homomorphism
Group homomorphismGroup homomorphism
Group homomorphismNaliniSPatil
 
23 improper integrals send-x
23 improper integrals send-x23 improper integrals send-x
23 improper integrals send-xmath266
 

What's hot (20)

Functor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And Monad
 
Computational Complexity: Complexity Classes
Computational Complexity: Complexity ClassesComputational Complexity: Complexity Classes
Computational Complexity: Complexity Classes
 
Math 101 (Function)
Math 101 (Function)Math 101 (Function)
Math 101 (Function)
 
TOPOLOGY and TYPES OF TOPOLOGY PowerPoint
TOPOLOGY and TYPES OF TOPOLOGY PowerPointTOPOLOGY and TYPES OF TOPOLOGY PowerPoint
TOPOLOGY and TYPES OF TOPOLOGY PowerPoint
 
Running Free with the Monads
Running Free with the MonadsRunning Free with the Monads
Running Free with the Monads
 
Topology for Computing: Homology
Topology for Computing: HomologyTopology for Computing: Homology
Topology for Computing: Homology
 
Peeking inside the engine of ZIO SQL.pdf
Peeking inside the engine of ZIO SQL.pdfPeeking inside the engine of ZIO SQL.pdf
Peeking inside the engine of ZIO SQL.pdf
 
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
Quicksort - a whistle-stop tour of the algorithm in five languages and four p...
 
Purely Functional Data Structures in Scala
Purely Functional Data Structures in ScalaPurely Functional Data Structures in Scala
Purely Functional Data Structures in Scala
 
ZIO Queue
ZIO QueueZIO Queue
ZIO Queue
 
L3 cfg
L3 cfgL3 cfg
L3 cfg
 
Big omega
Big omegaBig omega
Big omega
 
Functions
FunctionsFunctions
Functions
 
08 subprograms
08 subprograms08 subprograms
08 subprograms
 
Introduction to Recursion (Python)
Introduction to Recursion (Python)Introduction to Recursion (Python)
Introduction to Recursion (Python)
 
The Lambda Calculus and The JavaScript
The Lambda Calculus and The JavaScriptThe Lambda Calculus and The JavaScript
The Lambda Calculus and The JavaScript
 
Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )
 
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial OrderingCMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
CMSC 56 | Lecture 16: Equivalence of Relations & Partial Ordering
 
Group homomorphism
Group homomorphismGroup homomorphism
Group homomorphism
 
23 improper integrals send-x
23 improper integrals send-x23 improper integrals send-x
23 improper integrals send-x
 

Viewers also liked

Closing the gap between Spend Analytics & Category Management_Weatherford
Closing the gap between Spend Analytics & Category Management_WeatherfordClosing the gap between Spend Analytics & Category Management_Weatherford
Closing the gap between Spend Analytics & Category Management_WeatherfordZycus
 
Product and category management in abms university
Product and category management in abms universityProduct and category management in abms university
Product and category management in abms universitytomii01
 
Jan Sass Hvyass, Director of Procurement at Beumer Group - Organising a globa...
Jan Sass Hvyass, Director of Procurement at Beumer Group - Organising a globa...Jan Sass Hvyass, Director of Procurement at Beumer Group - Organising a globa...
Jan Sass Hvyass, Director of Procurement at Beumer Group - Organising a globa...Global Business Events
 
Introduction to Category Management And Assortment Planning in the Retail Ind...
Introduction to Category Management And Assortment Planning in the Retail Ind...Introduction to Category Management And Assortment Planning in the Retail Ind...
Introduction to Category Management And Assortment Planning in the Retail Ind...KINDUZ Consulting
 

Viewers also liked (8)

Closing the gap between Spend Analytics & Category Management_Weatherford
Closing the gap between Spend Analytics & Category Management_WeatherfordClosing the gap between Spend Analytics & Category Management_Weatherford
Closing the gap between Spend Analytics & Category Management_Weatherford
 
Procurement development
Procurement developmentProcurement development
Procurement development
 
ABC del Category Management
ABC del Category ManagementABC del Category Management
ABC del Category Management
 
Product and category management in abms university
Product and category management in abms universityProduct and category management in abms university
Product and category management in abms university
 
Jan Sass Hvyass, Director of Procurement at Beumer Group - Organising a globa...
Jan Sass Hvyass, Director of Procurement at Beumer Group - Organising a globa...Jan Sass Hvyass, Director of Procurement at Beumer Group - Organising a globa...
Jan Sass Hvyass, Director of Procurement at Beumer Group - Organising a globa...
 
Category Management Tools
Category Management ToolsCategory Management Tools
Category Management Tools
 
Introduction to Category Management And Assortment Planning in the Retail Ind...
Introduction to Category Management And Assortment Planning in the Retail Ind...Introduction to Category Management And Assortment Planning in the Retail Ind...
Introduction to Category Management And Assortment Planning in the Retail Ind...
 
Category Management
Category Management Category Management
Category Management
 

Similar to Category theory for beginners

Scala categorytheory
Scala categorytheoryScala categorytheory
Scala categorytheoryMeetu Maltiar
 
Scala categorytheory
Scala categorytheoryScala categorytheory
Scala categorytheoryKnoldus Inc.
 
Power of functions in a typed world
Power of functions in a typed worldPower of functions in a typed world
Power of functions in a typed worldDebasish Ghosh
 
Algebraic Data Types and Origami Patterns
Algebraic Data Types and Origami PatternsAlgebraic Data Types and Origami Patterns
Algebraic Data Types and Origami PatternsVasil Remeniuk
 
The Essence of the Iterator Pattern
The Essence of the Iterator PatternThe Essence of the Iterator Pattern
The Essence of the Iterator PatternEric Torreborre
 
Oh, All the things you'll traverse
Oh, All the things you'll traverseOh, All the things you'll traverse
Oh, All the things you'll traverseLuka Jacobowitz
 
The Essence of the Iterator Pattern (pdf)
The Essence of the Iterator Pattern (pdf)The Essence of the Iterator Pattern (pdf)
The Essence of the Iterator Pattern (pdf)Eric Torreborre
 
Optics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the wholeOptics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the wholeIlan Godik
 
Functors, in theory and in practice
Functors, in theory and in practiceFunctors, in theory and in practice
Functors, in theory and in practiceMartin Menestret
 
Monoids, monoids, monoids
Monoids, monoids, monoidsMonoids, monoids, monoids
Monoids, monoids, monoidsLuka Jacobowitz
 
Monads and friends demystified
Monads and friends demystifiedMonads and friends demystified
Monads and friends demystifiedAlessandro Lacava
 
Categories for the Working C++ Programmer
Categories for the Working C++ ProgrammerCategories for the Working C++ Programmer
Categories for the Working C++ ProgrammerPlatonov Sergey
 
Monoids, Monoids, Monoids - ScalaLove 2020
Monoids, Monoids, Monoids - ScalaLove 2020Monoids, Monoids, Monoids - ScalaLove 2020
Monoids, Monoids, Monoids - ScalaLove 2020Luka Jacobowitz
 
Your data structures are made of maths!
Your data structures are made of maths!Your data structures are made of maths!
Your data structures are made of maths!kenbot
 
Mining Functional Patterns
Mining Functional PatternsMining Functional Patterns
Mining Functional PatternsDebasish Ghosh
 
Monad and Algebraic Design in Functional Programming
Monad and Algebraic Design in Functional ProgrammingMonad and Algebraic Design in Functional Programming
Monad and Algebraic Design in Functional ProgrammingNamuk Park
 
Functional programming with FSharp
Functional programming with FSharpFunctional programming with FSharp
Functional programming with FSharpDaniele Pozzobon
 

Similar to Category theory for beginners (20)

Scala categorytheory
Scala categorytheoryScala categorytheory
Scala categorytheory
 
Scala categorytheory
Scala categorytheoryScala categorytheory
Scala categorytheory
 
Power of functions in a typed world
Power of functions in a typed worldPower of functions in a typed world
Power of functions in a typed world
 
Algebraic Data Types and Origami Patterns
Algebraic Data Types and Origami PatternsAlgebraic Data Types and Origami Patterns
Algebraic Data Types and Origami Patterns
 
Monad Fact #4
Monad Fact #4Monad Fact #4
Monad Fact #4
 
Functor Laws
Functor LawsFunctor Laws
Functor Laws
 
The Essence of the Iterator Pattern
The Essence of the Iterator PatternThe Essence of the Iterator Pattern
The Essence of the Iterator Pattern
 
Oh, All the things you'll traverse
Oh, All the things you'll traverseOh, All the things you'll traverse
Oh, All the things you'll traverse
 
The Essence of the Iterator Pattern (pdf)
The Essence of the Iterator Pattern (pdf)The Essence of the Iterator Pattern (pdf)
The Essence of the Iterator Pattern (pdf)
 
Optics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the wholeOptics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the whole
 
Functors, in theory and in practice
Functors, in theory and in practiceFunctors, in theory and in practice
Functors, in theory and in practice
 
Monoids, monoids, monoids
Monoids, monoids, monoidsMonoids, monoids, monoids
Monoids, monoids, monoids
 
Monads and friends demystified
Monads and friends demystifiedMonads and friends demystified
Monads and friends demystified
 
Categories for the Working C++ Programmer
Categories for the Working C++ ProgrammerCategories for the Working C++ Programmer
Categories for the Working C++ Programmer
 
Scala best practices
Scala best practicesScala best practices
Scala best practices
 
Monoids, Monoids, Monoids - ScalaLove 2020
Monoids, Monoids, Monoids - ScalaLove 2020Monoids, Monoids, Monoids - ScalaLove 2020
Monoids, Monoids, Monoids - ScalaLove 2020
 
Your data structures are made of maths!
Your data structures are made of maths!Your data structures are made of maths!
Your data structures are made of maths!
 
Mining Functional Patterns
Mining Functional PatternsMining Functional Patterns
Mining Functional Patterns
 
Monad and Algebraic Design in Functional Programming
Monad and Algebraic Design in Functional ProgrammingMonad and Algebraic Design in Functional Programming
Monad and Algebraic Design in Functional Programming
 
Functional programming with FSharp
Functional programming with FSharpFunctional programming with FSharp
Functional programming with FSharp
 

More from kenbot

Grow your own tech leads
Grow your own tech leadsGrow your own tech leads
Grow your own tech leadskenbot
 
Responsible DI: Ditch the Frameworks
Responsible DI: Ditch the FrameworksResponsible DI: Ditch the Frameworks
Responsible DI: Ditch the Frameworkskenbot
 
FP adoption at REA
FP adoption at REAFP adoption at REA
FP adoption at REAkenbot
 
Lenses for the masses - introducing Goggles
Lenses for the masses - introducing GogglesLenses for the masses - introducing Goggles
Lenses for the masses - introducing Goggleskenbot
 
Good functional programming is good programming
Good functional programming is good programmingGood functional programming is good programming
Good functional programming is good programmingkenbot
 
Data made out of functions
Data made out of functionsData made out of functions
Data made out of functionskenbot
 
Imagine a world without mocks
Imagine a world without mocksImagine a world without mocks
Imagine a world without mockskenbot
 
2 Years of Real World FP at REA
2 Years of Real World FP at REA2 Years of Real World FP at REA
2 Years of Real World FP at REAkenbot
 
The disaster of mutable state
The disaster of mutable stateThe disaster of mutable state
The disaster of mutable statekenbot
 

More from kenbot (9)

Grow your own tech leads
Grow your own tech leadsGrow your own tech leads
Grow your own tech leads
 
Responsible DI: Ditch the Frameworks
Responsible DI: Ditch the FrameworksResponsible DI: Ditch the Frameworks
Responsible DI: Ditch the Frameworks
 
FP adoption at REA
FP adoption at REAFP adoption at REA
FP adoption at REA
 
Lenses for the masses - introducing Goggles
Lenses for the masses - introducing GogglesLenses for the masses - introducing Goggles
Lenses for the masses - introducing Goggles
 
Good functional programming is good programming
Good functional programming is good programmingGood functional programming is good programming
Good functional programming is good programming
 
Data made out of functions
Data made out of functionsData made out of functions
Data made out of functions
 
Imagine a world without mocks
Imagine a world without mocksImagine a world without mocks
Imagine a world without mocks
 
2 Years of Real World FP at REA
2 Years of Real World FP at REA2 Years of Real World FP at REA
2 Years of Real World FP at REA
 
The disaster of mutable state
The disaster of mutable stateThe disaster of mutable state
The disaster of mutable state
 

Recently uploaded

TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
Industrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptIndustrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptNarmatha D
 
BSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxBSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxNiranjanYadav41
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...Erbil Polytechnic University
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfRajuKanojiya4
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMMchpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMMNanaAgyeman13
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfChristianCDAM
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Risk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectRisk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectErbil Polytechnic University
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 

Recently uploaded (20)

TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
Industrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptIndustrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.ppt
 
BSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxBSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptx
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
National Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdfNational Level Hackathon Participation Certificate.pdf
National Level Hackathon Participation Certificate.pdf
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMMchpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
chpater16.pptxMMMMMMMMMMMMMMMMMMMMMMMMMMM
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdf
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Risk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectRisk Management in Engineering Construction Project
Risk Management in Engineering Construction Project
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 

Category theory for beginners