SlideShare a Scribd company logo
© 2015 Pivotal Software, Inc. All rights reserved.© 2015 Pivotal Software, Inc. All rights reserved. 1
Category Theory for Mortal Programmers
Stephan February
@beardpappa
sfebruary@pivotal.io
http://hashbangbin.sh
© 2016 Pivotal Software, Inc. All rights reserved. 2
© 2015 Pivotal Software, Inc. All rights reserved. 3
What is Category Theory
• Abstraction
• Objects
• Arrows (morphisms)
© 2016 Pivotal Software, Inc. All rights reserved. 4
Relation to Programming
f : A => B
g : B => C
g o f ~ g( f(A)) : A => C
domain(f)
codomain(f)
© 2016 Pivotal Software, Inc. All rights reserved. 5
Relation to Programming
What makes something a Category ?
composition :
f: A => B and g : B => Cgiven
g o f : A => C∃
objects :
morphisms : f, g
A, B, C
identity : id1: A => A or id2 : B => B
id1
id2
© 2016 Pivotal Software, Inc. All rights reserved. 6
Category Laws
id1
id2
Associative Law
Identity Law
(h o g) o f = h o (g o f)
f o id1 = id1 o f = f
© 2015 Pivotal Software, Inc. All rights reserved. 7
Functors
Categories : Functional Design Patterns
Apply a function f: x: Int => x2 to the sequence [1,2,3,4,5]
[1,2,3,4,5].map{ x => x * x }
© 2015 Pivotal Software, Inc. All rights reserved. 8
Functor
© 2015 Pivotal Software, Inc. All rights reserved. 9
Functor Recap
(A => B) (T[A] => T[B])
General Shape
Our Category
© 2015 Pivotal Software, Inc. All rights reserved. 10
Monads (homework)
Categories : Functional Design Patterns
(A => T[B]) (T[A] => T[B])
flatMap
General Shape
References
Programming
Scala
2nd Edition
StackOverFlow: A Monad Is Just a Monoid in the Category of Endofunctors. Whats The Problem ?
YouTube: Category Theory Lulz - Ken Scambler
YouTube: Category Theory, The Beginner's Introduction
Blog: Functors, Monads, Applicatives can be so simple
An Introduction to
Category Theory


More Related Content

What's hot

Why functional programming and category theory strongly matters
Why functional programming and category theory strongly mattersWhy functional programming and category theory strongly matters
Why functional programming and category theory strongly matters
Piotr Paradziński
 
Monad Fact #2
Monad Fact #2Monad Fact #2
Monad Fact #2
Philip Schwarz
 
Approximation Data Structures for Streaming Applications
Approximation Data Structures for Streaming ApplicationsApproximation Data Structures for Streaming Applications
Approximation Data Structures for Streaming Applications
Debasish Ghosh
 
11. Objects and Classes
11. Objects and Classes11. Objects and Classes
11. Objects and Classes
Intro C# Book
 
20.5 Java polymorphism
20.5 Java polymorphism 20.5 Java polymorphism
20.5 Java polymorphism
Intro C# Book
 
What can scala puzzlers teach us
What can scala puzzlers teach usWhat can scala puzzlers teach us
What can scala puzzlers teach us
Daniel Sobral
 
14. Defining Classes
14. Defining Classes14. Defining Classes
14. Defining Classes
Intro C# Book
 
Practices For Becoming A Better Programmer
Practices For Becoming A Better ProgrammerPractices For Becoming A Better Programmer
Practices For Becoming A Better Programmer
Srikanth Shreenivas
 
Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)
Ahmad karawash
 
Basic c#
Basic c#Basic c#
Basic c#
kishore4268
 
Scala categorytheory
Scala categorytheoryScala categorytheory
Scala categorytheory
Knoldus Inc.
 
14 Defining Classes
14 Defining Classes14 Defining Classes
14 Defining Classes
Intro C# Book
 
object oriented programming OOP
object oriented programming OOPobject oriented programming OOP
object oriented programming OOP
Anil Pokhrel
 
types, types, types
types, types, typestypes, types, types
types, types, types
Fronx Wurmus
 

What's hot (18)

Why functional programming and category theory strongly matters
Why functional programming and category theory strongly mattersWhy functional programming and category theory strongly matters
Why functional programming and category theory strongly matters
 
Monad Fact #2
Monad Fact #2Monad Fact #2
Monad Fact #2
 
Approximation Data Structures for Streaming Applications
Approximation Data Structures for Streaming ApplicationsApproximation Data Structures for Streaming Applications
Approximation Data Structures for Streaming Applications
 
13slide graphics
13slide graphics13slide graphics
13slide graphics
 
11. Objects and Classes
11. Objects and Classes11. Objects and Classes
11. Objects and Classes
 
20.5 Java polymorphism
20.5 Java polymorphism 20.5 Java polymorphism
20.5 Java polymorphism
 
What can scala puzzlers teach us
What can scala puzzlers teach usWhat can scala puzzlers teach us
What can scala puzzlers teach us
 
14. Defining Classes
14. Defining Classes14. Defining Classes
14. Defining Classes
 
CSC Millionaire
CSC MillionaireCSC Millionaire
CSC Millionaire
 
05slide
05slide05slide
05slide
 
C++ Inheritance
C++ InheritanceC++ Inheritance
C++ Inheritance
 
Practices For Becoming A Better Programmer
Practices For Becoming A Better ProgrammerPractices For Becoming A Better Programmer
Practices For Becoming A Better Programmer
 
Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)Object-Oriented Programming (OOP)
Object-Oriented Programming (OOP)
 
Basic c#
Basic c#Basic c#
Basic c#
 
Scala categorytheory
Scala categorytheoryScala categorytheory
Scala categorytheory
 
14 Defining Classes
14 Defining Classes14 Defining Classes
14 Defining Classes
 
object oriented programming OOP
object oriented programming OOPobject oriented programming OOP
object oriented programming OOP
 
types, types, types
types, types, typestypes, types, types
types, types, types
 

Viewers also liked

[FT-11][ltchen] A Tale of Two Monads
[FT-11][ltchen] A Tale of Two Monads[FT-11][ltchen] A Tale of Two Monads
[FT-11][ltchen] A Tale of Two Monads
Functional Thursday
 
Category theory is general abolute nonsens
Category theory is general abolute nonsensCategory theory is general abolute nonsens
Category theory is general abolute nonsens
Pawel Szulc
 
사람들은 왜때문에 핀터레스트를 쓰는걸까? - 0912 UX 랩미팅 발제문
사람들은 왜때문에 핀터레스트를 쓰는걸까? - 0912 UX 랩미팅 발제문사람들은 왜때문에 핀터레스트를 쓰는걸까? - 0912 UX 랩미팅 발제문
사람들은 왜때문에 핀터레스트를 쓰는걸까? - 0912 UX 랩미팅 발제문
Changhoon Oh
 
Monads in practice
Monads in practiceMonads in practice
Monads in practice
Christophe Marchal
 
Unlocking the Magic of Monads with Java 8
Unlocking the Magic of Monads with Java 8Unlocking the Magic of Monads with Java 8
Unlocking the Magic of Monads with Java 8
JavaDayUA
 
Monadic Java
Monadic JavaMonadic Java
Monadic Java
Codemotion
 
Functional programming techniques in regular JavaScript
Functional programming techniques in regular JavaScriptFunctional programming techniques in regular JavaScript
Functional programming techniques in regular JavaScript
Pavel Klimiankou
 
Advanced Production Debugging
Advanced Production DebuggingAdvanced Production Debugging
Advanced Production Debugging
Takipi
 
Project Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To JavaProject Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To Java
C4Media
 
Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!
Monica Beckwith
 
In Search of Segmentation
In Search of SegmentationIn Search of Segmentation
In Search of Segmentation
Adrian Cockcroft
 
10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible
Lukas Eder
 
Microservices + Oracle: A Bright Future
Microservices + Oracle: A Bright FutureMicroservices + Oracle: A Bright Future
Microservices + Oracle: A Bright Future
Kelly Goetsch
 
Scala Days NYC 2016
Scala Days NYC 2016Scala Days NYC 2016
Scala Days NYC 2016
Martin Odersky
 
소셜콘텐츠 마케팅 & 퍼블리싱 기업 이은콘텐츠 회사소개서
소셜콘텐츠 마케팅 & 퍼블리싱 기업 이은콘텐츠 회사소개서소셜콘텐츠 마케팅 & 퍼블리싱 기업 이은콘텐츠 회사소개서
소셜콘텐츠 마케팅 & 퍼블리싱 기업 이은콘텐츠 회사소개서
이은콘텐츠
 

Viewers also liked (19)

[FT-11][ltchen] A Tale of Two Monads
[FT-11][ltchen] A Tale of Two Monads[FT-11][ltchen] A Tale of Two Monads
[FT-11][ltchen] A Tale of Two Monads
 
Groovy Monads
Groovy MonadsGroovy Monads
Groovy Monads
 
Category theory is general abolute nonsens
Category theory is general abolute nonsensCategory theory is general abolute nonsens
Category theory is general abolute nonsens
 
사람들은 왜때문에 핀터레스트를 쓰는걸까? - 0912 UX 랩미팅 발제문
사람들은 왜때문에 핀터레스트를 쓰는걸까? - 0912 UX 랩미팅 발제문사람들은 왜때문에 핀터레스트를 쓰는걸까? - 0912 UX 랩미팅 발제문
사람들은 왜때문에 핀터레스트를 쓰는걸까? - 0912 UX 랩미팅 발제문
 
Monads in practice
Monads in practiceMonads in practice
Monads in practice
 
Unlocking the Magic of Monads with Java 8
Unlocking the Magic of Monads with Java 8Unlocking the Magic of Monads with Java 8
Unlocking the Magic of Monads with Java 8
 
Monadic Java
Monadic JavaMonadic Java
Monadic Java
 
Monads
MonadsMonads
Monads
 
Functional programming techniques in regular JavaScript
Functional programming techniques in regular JavaScriptFunctional programming techniques in regular JavaScript
Functional programming techniques in regular JavaScript
 
Monadic Java
Monadic JavaMonadic Java
Monadic Java
 
Advanced Production Debugging
Advanced Production DebuggingAdvanced Production Debugging
Advanced Production Debugging
 
Project Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To JavaProject Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To Java
 
Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!Java 9: The (G1) GC Awakens!
Java 9: The (G1) GC Awakens!
 
Pinterest SlideShare
Pinterest SlideSharePinterest SlideShare
Pinterest SlideShare
 
In Search of Segmentation
In Search of SegmentationIn Search of Segmentation
In Search of Segmentation
 
10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible
 
Microservices + Oracle: A Bright Future
Microservices + Oracle: A Bright FutureMicroservices + Oracle: A Bright Future
Microservices + Oracle: A Bright Future
 
Scala Days NYC 2016
Scala Days NYC 2016Scala Days NYC 2016
Scala Days NYC 2016
 
소셜콘텐츠 마케팅 & 퍼블리싱 기업 이은콘텐츠 회사소개서
소셜콘텐츠 마케팅 & 퍼블리싱 기업 이은콘텐츠 회사소개서소셜콘텐츠 마케팅 & 퍼블리싱 기업 이은콘텐츠 회사소개서
소셜콘텐츠 마케팅 & 퍼블리싱 기업 이은콘텐츠 회사소개서
 

Similar to Category Theory for Mortal Programmers

C+++
C+++C+++
Programming in Python on Steroid
Programming in Python on SteroidProgramming in Python on Steroid
Programming in Python on Steroid
Haim Michael
 
2 cs xii_python_functions _ scopes
2 cs xii_python_functions _ scopes2 cs xii_python_functions _ scopes
2 cs xii_python_functions _ scopes
SanjayKumarMahto1
 
ObliVM
ObliVMObliVM
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMSDYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
Praveen Penumathsa
 
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMSDYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
Praveen Penumathsa
 
The Birth of FormalBears - A new META for BEAR.Sunday applications
The Birth of FormalBears - A new META for BEAR.Sunday applicationsThe Birth of FormalBears - A new META for BEAR.Sunday applications
The Birth of FormalBears - A new META for BEAR.Sunday applications
Atsuhiro Kubo
 
Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours? Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours?
Rogue Wave Software
 
Python Jump Start
Python Jump StartPython Jump Start
Python Jump Start
Haim Michael
 
Tracxn - DevOps Startup Landscape
Tracxn - DevOps Startup LandscapeTracxn - DevOps Startup Landscape
Tracxn - DevOps Startup Landscape
Tracxn
 
PFHub: Phase Field Community Hub
PFHub: Phase Field Community HubPFHub: Phase Field Community Hub
PFHub: Phase Field Community Hub
Daniel Wheeler
 
Raising the Bar
Raising the BarRaising the Bar
Raising the Bar
Alexandru Bolboaca
 
Python Jump Start
Python Jump StartPython Jump Start
Python Jump Start
Haim Michael
 
Dsdt meetup may1
Dsdt meetup may1Dsdt meetup may1
Dsdt meetup may1
JDA Labs MTL
 
DSDT Meetup May 2018
DSDT Meetup May 2018DSDT Meetup May 2018
DSDT Meetup May 2018
DSDT_MTL
 
Open source software for startups
Open source software for startupsOpen source software for startups
Open source software for startupsvictorneo
 
What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)
wesley chun
 
Blueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBlueprints: Introduction to Python programming
Blueprints: Introduction to Python programming
Bhalaji Nagarajan
 

Similar to Category Theory for Mortal Programmers (20)

C+++
C+++C+++
C+++
 
Programming in Python on Steroid
Programming in Python on SteroidProgramming in Python on Steroid
Programming in Python on Steroid
 
2 cs xii_python_functions _ scopes
2 cs xii_python_functions _ scopes2 cs xii_python_functions _ scopes
2 cs xii_python_functions _ scopes
 
ObliVM
ObliVMObliVM
ObliVM
 
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMSDYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
 
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMSDYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
DYNAMIC SLICING OF ASPECT-ORIENTED PROGRAMS
 
The Birth of FormalBears - A new META for BEAR.Sunday applications
The Birth of FormalBears - A new META for BEAR.Sunday applicationsThe Birth of FormalBears - A new META for BEAR.Sunday applications
The Birth of FormalBears - A new META for BEAR.Sunday applications
 
Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours? Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours?
 
Python Jump Start
Python Jump StartPython Jump Start
Python Jump Start
 
Tracxn - DevOps Startup Landscape
Tracxn - DevOps Startup LandscapeTracxn - DevOps Startup Landscape
Tracxn - DevOps Startup Landscape
 
PFHub: Phase Field Community Hub
PFHub: Phase Field Community HubPFHub: Phase Field Community Hub
PFHub: Phase Field Community Hub
 
Scope of variables
Scope of variablesScope of variables
Scope of variables
 
Raising the Bar
Raising the BarRaising the Bar
Raising the Bar
 
Python Jump Start
Python Jump StartPython Jump Start
Python Jump Start
 
Dsdt meetup may1
Dsdt meetup may1Dsdt meetup may1
Dsdt meetup may1
 
DSDT Meetup May 2018
DSDT Meetup May 2018DSDT Meetup May 2018
DSDT Meetup May 2018
 
Yogesh_job_resume
Yogesh_job_resumeYogesh_job_resume
Yogesh_job_resume
 
Open source software for startups
Open source software for startupsOpen source software for startups
Open source software for startups
 
What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)
 
Blueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBlueprints: Introduction to Python programming
Blueprints: Introduction to Python programming
 

Recently uploaded

Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 

Recently uploaded (20)

Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 

Category Theory for Mortal Programmers

  • 1. © 2015 Pivotal Software, Inc. All rights reserved.© 2015 Pivotal Software, Inc. All rights reserved. 1 Category Theory for Mortal Programmers Stephan February @beardpappa sfebruary@pivotal.io http://hashbangbin.sh
  • 2. © 2016 Pivotal Software, Inc. All rights reserved. 2
  • 3. © 2015 Pivotal Software, Inc. All rights reserved. 3 What is Category Theory • Abstraction • Objects • Arrows (morphisms)
  • 4. © 2016 Pivotal Software, Inc. All rights reserved. 4 Relation to Programming f : A => B g : B => C g o f ~ g( f(A)) : A => C domain(f) codomain(f)
  • 5. © 2016 Pivotal Software, Inc. All rights reserved. 5 Relation to Programming What makes something a Category ? composition : f: A => B and g : B => Cgiven g o f : A => C∃ objects : morphisms : f, g A, B, C identity : id1: A => A or id2 : B => B id1 id2
  • 6. © 2016 Pivotal Software, Inc. All rights reserved. 6 Category Laws id1 id2 Associative Law Identity Law (h o g) o f = h o (g o f) f o id1 = id1 o f = f
  • 7. © 2015 Pivotal Software, Inc. All rights reserved. 7 Functors Categories : Functional Design Patterns Apply a function f: x: Int => x2 to the sequence [1,2,3,4,5] [1,2,3,4,5].map{ x => x * x }
  • 8. © 2015 Pivotal Software, Inc. All rights reserved. 8 Functor
  • 9. © 2015 Pivotal Software, Inc. All rights reserved. 9 Functor Recap (A => B) (T[A] => T[B]) General Shape Our Category
  • 10. © 2015 Pivotal Software, Inc. All rights reserved. 10 Monads (homework) Categories : Functional Design Patterns (A => T[B]) (T[A] => T[B]) flatMap General Shape
  • 11. References Programming Scala 2nd Edition StackOverFlow: A Monad Is Just a Monoid in the Category of Endofunctors. Whats The Problem ? YouTube: Category Theory Lulz - Ken Scambler YouTube: Category Theory, The Beginner's Introduction Blog: Functors, Monads, Applicatives can be so simple An Introduction to Category Theory