SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
THE ORIGINS OF FREE
Adam Warski, SoftwareMill
10/2/2017, LambdaDays
@adamwarski, SoftwareMill, LambdaDays 2017
THE PLAN
➤ Why bother?
➤ Universal algebra
➤ Free algebras
➤ The meaning of life free
➤ Monads & free monads
➤ Free monads in Haskell, Cats and Scalaz
➤ It’s simpler than it sounds
@adamwarski, SoftwareMill, LambdaDays 2017
WHY BOTHER WITH FREE?
➤ Define a composable program
➤ Using high-level custom instructions
➤ Run it in context later, given instruction interpretation
def issueCreditCard(u: UserId): Free[BankOps, CreditLimit] = for {

user <- LookupUserData(u).liftFree

otherCredits <- FetchOtherCredits(user).liftFree

val limit = calculateLimit(user, otherCredits)

creditCard <- IssueNewCard(user, limit).liftFree 

_ <- SendEmail(user.email, cardIssuedEmail(user, limit)).liftFree

} yield limit
@adamwarski, SoftwareMill, LambdaDays 2017
WHY BOTHER WITH FREE?
def issueCreditCard(u: UserId): Free[BankOps, CreditLimit] = for {

user <- LookupUserData(u).liftFree

otherCredits <- FetchOtherCredits(user).liftFree

val limit = calculateLimit(user, otherCredits)

creditCard <- IssueNewCard(user, limit).liftFree 

_ <- SendEmail(user.email, cardIssuedEmail(user, limit)).liftFree

} yield limit
val productionInterpreter: BankOp ~> Future = {

override def apply[A](bo: BankOp[A]): Future[A] = bo match {

case LookupUserData(u) => oracleDB2dao.lookupUser(u)

case FetchOtherCredits(user) => 

legacySoapSystem.fetchCredits(user)

// …

}

}
@adamwarski, SoftwareMill, LambdaDays 2017
WHY BOTHER WITH FREE?
val testInterpreter: BankOp ~> Id = {

override def apply[A](bo: BankOp[A]): Id[A] = bo match {

case LookupUserData(u) => new User(…)

case FetchOtherCredits(user) => List(Credit(1000000.usd))

// …

}

}
def issueCreditCard(u: UserId): Free[BankOps, CreditLimit] = for {

user <- LookupUserData(u).liftFree

otherCredits <- FetchOtherCredits(user).liftFree

val limit = calculateLimit(user, otherCredits)

creditCard <- IssueNewCard(user, limit).liftFree 

_ <- SendEmail(user.email, cardIssuedEmail(user, limit)).liftFree

} yield limit
@adamwarski, SoftwareMill, LambdaDays 2017
WHY BOTHER WITH FREE?
val result: CreditLimit = issueCreditCard(UserId(42))

.foldMap(testInterpreter)
def issueCreditCard(u: UserId): Free[BankOps, CreditLimit] = for {

user <- LookupUserData(u).liftFree

otherCredits <- FetchOtherCredits(user).liftFree

val limit = calculateLimit(user, otherCredits)

creditCard <- IssueNewCard(user, limit).liftFree 

_ <- SendEmail(user.email, cardIssuedEmail(user, limit)).liftFree

} yield limit
@adamwarski, SoftwareMill, LambdaDays 2017
ABOUT ME
➤ Software Engineer, co-founder @
➤ Mainly Scala
➤ Open-source: Quicklens, MacWire, ElasticMQ, ScalaClippy, …
➤ Long time ago: student of Category Theory
@adamwarski, SoftwareMill, LambdaDays 2017
WHAT IS AN ALGEBRA?
“algebra is the study of mathematical symbols and the rules for manipulating these symbols"

Wikipedia, 2017
“the part of mathematics in which letters and other general symbols are used to represent numbers
and quantities in formulae and equations."

Google Search, 2017
y = ax + b
E = mc2
f(10◊x) = K(▸9)
def sum(l: List[L]) = l.fold(_ + _)
main = getCurrentTime >>= print
@adamwarski, SoftwareMill, LambdaDays 2017
UNIVERSAL ALGEBRA: SIGNATURE
➤ Goal: Model programs as algebras
➤ Let’s generalise!
➤ Studies algebraic structures, rather than concrete models
algebraic signature ⌃ = (S, ⌦)
set S
family ⌦ of sets indexed by S⇤
⇥ S
➤ Syntax:
➤ type names:
➤ operation names:
@adamwarski, SoftwareMill, LambdaDays 2017
UNIVERSAL ALGEBRA: SIGNATURE EXAMPLE
toString(succ(0) + succ(succ(0)))
S = {int, str}
⌦✏,int = {0}
⌦int,int = {succ}
⌦(int,int),int = {+}
⌦(str,str),str = {++}
⌦int,str = {toString}
@adamwarski, SoftwareMill, LambdaDays 2017
UNIVERSAL ALGEBRA: ALGEBRA
➤ A specific interpretation of the signature
➤ for each type, a set
➤ for each operation, a function between appropriate sets
⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString}
We can define a ⌃-algebra A:
|A|int = {0, 1, 2, ...} = N
|A|str = {”a”, ”aa”, ..., ”b”, ”ab”, ...}
succA = x.x + 1
+A = xy.x + y
. . .
@adamwarski, SoftwareMill, LambdaDays 2017
TERM ALGEBRA
➤ Can we build an algebra out of pure syntax?
➤ Expressions (terms) that can be built from the signature
➤ Rather boring, no interpretation at all
|T⌃|int = {0, succ(0), succ(succ(0)), ..., 0 + 0, 0 + succ(0), ...}
|T⌃|str = {toString(0), toString(succ(0)), ..., toString(0)++toString(0), ...}
succT⌃ (t) = succ(t), e.g. succT⌃ (succ(0)) = succ(succ(0))
+T⌃ (t1, t2) = t1 + t2
...
⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString}
We define the term algebra T⌃:
@adamwarski, SoftwareMill, LambdaDays 2017
TERM ALGEBRA
➤ Defined inductively
➤ base: all constants are terms
➤ step: any functions we can apply on previous terms
⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString}
{0}
{0, 0 + 0, succ(0), toString(0)}
{0, 0 + 0, succ(0), 0 + succ(0), succ(0) + 0, succ(0) + succ(0),
toString(0), toString(succ(0)), toString(0) + +toString(0)}
@adamwarski, SoftwareMill, LambdaDays 2017
HOMOMORPHISM
➤ Homomorphism is a function between algebras
➤ For each type, functions between type interpretations
➤ Such that operations are preserved
⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString}
When A and B are ⌃-algebras, f : A ! B is a homomorphism when:
fint : |A|int ! |B|int
fstr : |A|str ! |B|str
8x2|A|int
fint(succA(x)) = succB(fint(x))
8xy2|A|int
f(x +A y) = f(x) +B f(y)
8x2|A|int
fstr(toStringA(x)) = toStringB(fint(x))
@adamwarski, SoftwareMill, LambdaDays 2017
INITIAL ALGEBRA
⌃-algebra I is initial when for any other
⌃-algebra A there is exactly one
homomorphism between them.
Theorem 1 T⌃ is initial
@adamwarski, SoftwareMill, LambdaDays 2017
INITIAL ALGEBRA
Theorem 1 T⌃ is initial
⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString}
|A|int = {0, 1, 2, ...} = N
|A|str = {”a”, ”aa”, ..., ”b”, ”ab”, ...}
succA = x.x + 1
+A = xy.x + y
. . .
We can define a ⌃-algebra A:
f : T⌃ ! A
f(0T⌃ ) = 0A
f(succT⌃ (t)) = succA(f(t))
...
@adamwarski, SoftwareMill, LambdaDays 2017
INITIAL ALGEBRA
➤ Only one way to interpret a term
➤ no junk: term algebra contains only what’s absolutely necessary
➤ no confusion: no two values are combined if they don’t need to be
➤ There’s only one initial algebra (up to isomorphism)
⌃-algebra I is initial when for any other
⌃-algebra A there is exactly one
homomorphism between them.
Theorem 1 T⌃ is initial
@adamwarski, SoftwareMill, LambdaDays 2017
INITIAL ALGEBRA
➤ This algebra is definitely not initial:
⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString}
➤ Junk: strings “a”, “b”, …
➤ Confusion: 0+succ(0) is same as succ(0)+0
We can define a ⌃-algebra A:
|A|int = {0, 1, 2, ...} = N
|A|str = {”a”, ”aa”, ..., ”b”, ”ab”, ...}
@adamwarski, SoftwareMill, LambdaDays 2017
FREE ALGEBRA
For any set X, T⌃(X) is the term algebra with X added as ”constants”
(but called variables)
⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString}
Xint = {i, j, k}
Xstr = {s1, s2}
succ(i) + j + succ(succ(k))
s1 + +toString(0)
toString(succ(0) + k) + +s2
@adamwarski, SoftwareMill, LambdaDays 2017
FREE ALGEBRA
➤ An interpretation of the variables determines an interpretation of any term
Theorem 1 For any variable set X, T⌃(X) is free
For any set X, T⌃(X) is the term algebra with X added as ”constants”
(but called variables)
⌃-algebra I is free over X (X ⇢ I) when for any other
⌃-algebra A, any function f : X ! |A| extends uniquely
to a homomorphism f#
: I ! A between them.
@adamwarski, SoftwareMill, LambdaDays 2017
FREE ALGEBRA EXAMPLE
⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString}
Xint = {i, j, k}
Xstr = {s1, s2}
|A|int = N, |A|str = {”a”, ”aa”, ..., ”b”, ”ab”, ...}
succA = x.x + 1
+A = xy.x + y
. . .
f : X ! |A|
f(i) = 10, f(j) = 5, f(k) = 42
f(s1) = ”lambda”, f(s2) = ”days”
f#
: T⌃(X) ! A
f#
(toString(succ(j) + succ(0)) + +s1) = ”7lambda”
f#
(s2 + +toString(k) + +s2) = ”lambda42days”
@adamwarski, SoftwareMill, LambdaDays 2017
MEANING OF FREE
➤ Free to interpret in any way
➤ no constraints
➤ Free of additional structure
➤ only what’s absolutely necessary
➤ No junk, no confusion
@adamwarski, SoftwareMill, LambdaDays 2017
FREE RECAP
➤ Algebraic signature:
➤ All possible interpretations: algebras
➤ For any variable set
➤ The term algebra is free
➤ any interpretation of the variables
➤ determines an interpretation of any term
➤ A general construction
⌃ = (S, ⌦)
X
T⌃(X)
f : X ! |A|
f#
: T⌃(X) ! A
@adamwarski, SoftwareMill, LambdaDays 2017
MODELLING SEQUENTIAL PROGRAMS: MONADS
➤ A sequential program can:
➤ return a value (pure)
➤ compute what to do next basing on previous result (flatMap)
➤ People decided to call an object with such operations a Monad
➤ Hence, we’ll use Monads to represent programs as data
➤ + sanity laws
@adamwarski, SoftwareMill, LambdaDays 2017
FREE MONAD
➤ Signature ~ pure + flatMap
➤ Variables ~ operations (our DSL)
➤ Free Monad ~ terms built out of pure, flatMap, our DSL
➤ modulo monad laws!
➤ e.g. flatMap(pure(x), f) = f(x)
Interpretation of the DSL determines the interpretation of the whole program
@adamwarski, SoftwareMill, LambdaDays 2017
FREE MONAD
➤ Our “world” (category) are Scala/Haskell/… monads (not algebras)
➤ The “world” (category) of the variables are generic Scala/Haskell/… terms (not sets)
➤ Signature:
➤ types: M[_]
➤ operations:
➤ pure[A]: A => M[A]
➤ flatMap[A, B](ma: M[A], f: A => M[B]): M[B]
➤ Modulo monad laws
@adamwarski, SoftwareMill, LambdaDays 2017
FREE IN CATS/SCALAZ
trait Free[F[_], A]



object Free {

case class Pure[F[_], A](a: A) extends Free[F, A]

case class Suspend[F[_], A](a: F[A]) extends Free[F, A]

case class FlatMapped[F[_], B, C](

c: Free[F, C], f: C => Free[F, B] extends Free[F, B]

}
@adamwarski, SoftwareMill, LambdaDays 2017
FREE IN HASKELL
data Free f r = Free (f (Free f r)) | Pure r
trait Free[F[_], A]



object Free {

case class Pure[F[_], A](a: A) extends Free[F, A]

case class Join[F[_], A](f: F[Free[F, A]]) extends Free[S, A]

}
f/F[_] must be a functor!
@adamwarski, SoftwareMill, LambdaDays 2017
SUMMING UP
➤ Direct construction of free algebras
➤ Hand-wavy construction of free monad
➤ Free
➤ free to interpret in any way
➤ free of constraints
➤ no junk, no confusion
➤ Free in Haskell is the same free as in Scala
@adamwarski, SoftwareMill, LambdaDays 2017
FURTHER READING
➤ “Foundations of Algebraic Specification and Formal
Software Development” by Donald Sannella and
Andrzej Tarlecki
➤ The Internet
THANK YOU!

Contenu connexe

Tendances

Functional and Algebraic Domain Modeling
Functional and Algebraic Domain ModelingFunctional and Algebraic Domain Modeling
Functional and Algebraic Domain ModelingDebasish Ghosh
 
Functional Programming by Examples using Haskell
Functional Programming by Examples using HaskellFunctional Programming by Examples using Haskell
Functional Programming by Examples using Haskellgoncharenko
 
Types by Adform Research
Types by Adform ResearchTypes by Adform Research
Types by Adform ResearchVasil Remeniuk
 
Introduction to haskell
Introduction to haskellIntroduction to haskell
Introduction to haskellLuca Molteni
 
Why Haskell Matters
Why Haskell MattersWhy Haskell Matters
Why Haskell Mattersromanandreg
 
#5 formal methods – hoare logic
#5 formal methods – hoare logic#5 formal methods – hoare logic
#5 formal methods – hoare logicSharif Omar Salem
 
Haskell for data science
Haskell for data scienceHaskell for data science
Haskell for data scienceJohn Cant
 
CS101- Introduction to Computing- Lecture 38
CS101- Introduction to Computing- Lecture 38CS101- Introduction to Computing- Lecture 38
CS101- Introduction to Computing- Lecture 38Bilal Ahmed
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance HaskellJohan Tibell
 
Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Bryan O'Sullivan
 
Python Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular ExpressionsPython Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular ExpressionsRanel Padon
 
Real World Haskell: Lecture 2
Real World Haskell: Lecture 2Real World Haskell: Lecture 2
Real World Haskell: Lecture 2Bryan O'Sullivan
 
Basic and logical implementation of r language
Basic and logical implementation of r language Basic and logical implementation of r language
Basic and logical implementation of r language Md. Mahedi Mahfuj
 
Temporal logic and functional reactive programming
Temporal logic and functional reactive programmingTemporal logic and functional reactive programming
Temporal logic and functional reactive programmingSergei Winitzki
 
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT LATHA LAKSHMI
 
Python bible
Python biblePython bible
Python bibleadarsh j
 
Strings Functions in C Programming
Strings Functions in C ProgrammingStrings Functions in C Programming
Strings Functions in C ProgrammingDevoAjit Gupta
 
140106 isaim-okayama
140106 isaim-okayama140106 isaim-okayama
140106 isaim-okayamagumitaro2012
 

Tendances (20)

Functional and Algebraic Domain Modeling
Functional and Algebraic Domain ModelingFunctional and Algebraic Domain Modeling
Functional and Algebraic Domain Modeling
 
Functional Programming by Examples using Haskell
Functional Programming by Examples using HaskellFunctional Programming by Examples using Haskell
Functional Programming by Examples using Haskell
 
Types by Adform Research
Types by Adform ResearchTypes by Adform Research
Types by Adform Research
 
Introduction to haskell
Introduction to haskellIntroduction to haskell
Introduction to haskell
 
Why Haskell Matters
Why Haskell MattersWhy Haskell Matters
Why Haskell Matters
 
#5 formal methods – hoare logic
#5 formal methods – hoare logic#5 formal methods – hoare logic
#5 formal methods – hoare logic
 
Haskell for data science
Haskell for data scienceHaskell for data science
Haskell for data science
 
CS101- Introduction to Computing- Lecture 38
CS101- Introduction to Computing- Lecture 38CS101- Introduction to Computing- Lecture 38
CS101- Introduction to Computing- Lecture 38
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance Haskell
 
Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Real World Haskell: Lecture 4
Real World Haskell: Lecture 4
 
Array and string
Array and stringArray and string
Array and string
 
Python Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular ExpressionsPython Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular Expressions
 
Real World Haskell: Lecture 2
Real World Haskell: Lecture 2Real World Haskell: Lecture 2
Real World Haskell: Lecture 2
 
Basic and logical implementation of r language
Basic and logical implementation of r language Basic and logical implementation of r language
Basic and logical implementation of r language
 
Temporal logic and functional reactive programming
Temporal logic and functional reactive programmingTemporal logic and functional reactive programming
Temporal logic and functional reactive programming
 
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
 
Python bible
Python biblePython bible
Python bible
 
Strings Functions in C Programming
Strings Functions in C ProgrammingStrings Functions in C Programming
Strings Functions in C Programming
 
Data Structures - Lecture 3 [Arrays]
Data Structures - Lecture 3 [Arrays]Data Structures - Lecture 3 [Arrays]
Data Structures - Lecture 3 [Arrays]
 
140106 isaim-okayama
140106 isaim-okayama140106 isaim-okayama
140106 isaim-okayama
 

En vedette

Jednorożce to kobiety a nie firmy. O √kobiecym w STEM
Jednorożce to kobiety a nie firmy. O √kobiecym w STEMJednorożce to kobiety a nie firmy. O √kobiecym w STEM
Jednorożce to kobiety a nie firmy. O √kobiecym w STEMSoftwareMill
 
Streams for (Co)Free!
Streams for (Co)Free!Streams for (Co)Free!
Streams for (Co)Free!John De Goes
 
Post-Free: Life After Free Monads
Post-Free: Life After Free MonadsPost-Free: Life After Free Monads
Post-Free: Life After Free MonadsJohn De Goes
 
Small intro to Big Data - Old version
Small intro to Big Data - Old versionSmall intro to Big Data - Old version
Small intro to Big Data - Old versionSoftwareMill
 
Open source big data landscape and possible ITS applications
Open source big data landscape and possible ITS applicationsOpen source big data landscape and possible ITS applications
Open source big data landscape and possible ITS applicationsSoftwareMill
 
Projekt z punktu widzenia UX designera
Projekt z punktu widzenia UX designeraProjekt z punktu widzenia UX designera
Projekt z punktu widzenia UX designeraSoftwareMill
 
Make your programs Free
Make your programs FreeMake your programs Free
Make your programs FreePawel Szulc
 
Machine learning by example
Machine learning by exampleMachine learning by example
Machine learning by exampleSoftwareMill
 
Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?
Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?
Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?SoftwareMill
 
3 kroki do sukcesu płaskiej i zdalnej firmy | SoftwareMill
3 kroki do sukcesu płaskiej i zdalnej firmy | SoftwareMill3 kroki do sukcesu płaskiej i zdalnej firmy | SoftwareMill
3 kroki do sukcesu płaskiej i zdalnej firmy | SoftwareMillSoftwareMill
 
Scalatra - Scalar Mini
Scalatra  - Scalar MiniScalatra  - Scalar Mini
Scalatra - Scalar MiniSoftwareMill
 
An Introduction to Akka
An Introduction to AkkaAn Introduction to Akka
An Introduction to AkkaSoftwareMill
 
Reducing Boilerplate and Combining Effects: A Monad Transformer Example
Reducing Boilerplate and Combining Effects: A Monad Transformer ExampleReducing Boilerplate and Combining Effects: A Monad Transformer Example
Reducing Boilerplate and Combining Effects: A Monad Transformer ExampleConnie Chen
 
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...John De Goes
 
Getting Started with PureScript
Getting Started with PureScriptGetting Started with PureScript
Getting Started with PureScriptJohn De Goes
 
Http4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web StackHttp4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web StackGaryCoady
 
FP is coming... le 19/05/2016
FP is coming... le 19/05/2016FP is coming... le 19/05/2016
FP is coming... le 19/05/2016Loïc Knuchel
 
Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)François-Guillaume Ribreau
 
“Going bananas with recursion schemes for fixed point data types”
“Going bananas with recursion schemes for fixed point data types”“Going bananas with recursion schemes for fixed point data types”
“Going bananas with recursion schemes for fixed point data types”Pawel Szulc
 

En vedette (20)

Jednorożce to kobiety a nie firmy. O √kobiecym w STEM
Jednorożce to kobiety a nie firmy. O √kobiecym w STEMJednorożce to kobiety a nie firmy. O √kobiecym w STEM
Jednorożce to kobiety a nie firmy. O √kobiecym w STEM
 
Streams for (Co)Free!
Streams for (Co)Free!Streams for (Co)Free!
Streams for (Co)Free!
 
Post-Free: Life After Free Monads
Post-Free: Life After Free MonadsPost-Free: Life After Free Monads
Post-Free: Life After Free Monads
 
Small intro to Big Data - Old version
Small intro to Big Data - Old versionSmall intro to Big Data - Old version
Small intro to Big Data - Old version
 
Open source big data landscape and possible ITS applications
Open source big data landscape and possible ITS applicationsOpen source big data landscape and possible ITS applications
Open source big data landscape and possible ITS applications
 
Projekt z punktu widzenia UX designera
Projekt z punktu widzenia UX designeraProjekt z punktu widzenia UX designera
Projekt z punktu widzenia UX designera
 
Make your programs Free
Make your programs FreeMake your programs Free
Make your programs Free
 
Machine learning by example
Machine learning by exampleMachine learning by example
Machine learning by example
 
MTL Versus Free
MTL Versus FreeMTL Versus Free
MTL Versus Free
 
Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?
Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?
Emancypacja pracowników. Dlaczego spaliliśmy karty zakładowe?
 
3 kroki do sukcesu płaskiej i zdalnej firmy | SoftwareMill
3 kroki do sukcesu płaskiej i zdalnej firmy | SoftwareMill3 kroki do sukcesu płaskiej i zdalnej firmy | SoftwareMill
3 kroki do sukcesu płaskiej i zdalnej firmy | SoftwareMill
 
Scalatra - Scalar Mini
Scalatra  - Scalar MiniScalatra  - Scalar Mini
Scalatra - Scalar Mini
 
An Introduction to Akka
An Introduction to AkkaAn Introduction to Akka
An Introduction to Akka
 
Reducing Boilerplate and Combining Effects: A Monad Transformer Example
Reducing Boilerplate and Combining Effects: A Monad Transformer ExampleReducing Boilerplate and Combining Effects: A Monad Transformer Example
Reducing Boilerplate and Combining Effects: A Monad Transformer Example
 
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
 
Getting Started with PureScript
Getting Started with PureScriptGetting Started with PureScript
Getting Started with PureScript
 
Http4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web StackHttp4s, Doobie and Circe: The Functional Web Stack
Http4s, Doobie and Circe: The Functional Web Stack
 
FP is coming... le 19/05/2016
FP is coming... le 19/05/2016FP is coming... le 19/05/2016
FP is coming... le 19/05/2016
 
Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)Implementing pattern-matching in JavaScript (short version)
Implementing pattern-matching in JavaScript (short version)
 
“Going bananas with recursion schemes for fixed point data types”
“Going bananas with recursion schemes for fixed point data types”“Going bananas with recursion schemes for fixed point data types”
“Going bananas with recursion schemes for fixed point data types”
 

Similaire à Origins of free

Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Languagevsssuresh
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues listsJames Wong
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
StacksqueueslistsFraboni Ec
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsYoung Alista
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsTony Nguyen
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues listsHarry Potter
 
Functional Programming Concepts for Imperative Programmers
Functional Programming Concepts for Imperative ProgrammersFunctional Programming Concepts for Imperative Programmers
Functional Programming Concepts for Imperative ProgrammersChris
 
Dynamic programming - fundamentals review
Dynamic programming - fundamentals reviewDynamic programming - fundamentals review
Dynamic programming - fundamentals reviewElifTech
 
DEFUN 2008 - Real World Haskell
DEFUN 2008 - Real World HaskellDEFUN 2008 - Real World Haskell
DEFUN 2008 - Real World HaskellBryan O'Sullivan
 
Introduction to idris
Introduction to idrisIntroduction to idris
Introduction to idrisConor Farrell
 
Introduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf TaiwanIntroduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf TaiwanJimin Hsieh
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory buildingClarkTony
 
It's Java Jim, But Not As We Know It!
It's Java Jim, But Not As We Know It!It's Java Jim, But Not As We Know It!
It's Java Jim, But Not As We Know It!Simon Ritter
 
presentation on important DAG,TRIE,Hashing.pptx
presentation on important DAG,TRIE,Hashing.pptxpresentation on important DAG,TRIE,Hashing.pptx
presentation on important DAG,TRIE,Hashing.pptxjainaaru59
 
LISP: назад в будущее, Микола Мозговий
LISP: назад в будущее, Микола МозговийLISP: назад в будущее, Микола Мозговий
LISP: назад в будущее, Микола МозговийSigma Software
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospectivechenge2k
 
Mikhail Khristophorov "Introduction to Regular Expressions"
Mikhail Khristophorov "Introduction to Regular Expressions"Mikhail Khristophorov "Introduction to Regular Expressions"
Mikhail Khristophorov "Introduction to Regular Expressions"LogeekNightUkraine
 
Introduction to LaTeX - Workshop Day 1
Introduction to LaTeX - Workshop Day 1Introduction to LaTeX - Workshop Day 1
Introduction to LaTeX - Workshop Day 1Suddhasheel GHOSH, PhD
 

Similaire à Origins of free (20)

Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Functional Programming Concepts for Imperative Programmers
Functional Programming Concepts for Imperative ProgrammersFunctional Programming Concepts for Imperative Programmers
Functional Programming Concepts for Imperative Programmers
 
Dynamic programming - fundamentals review
Dynamic programming - fundamentals reviewDynamic programming - fundamentals review
Dynamic programming - fundamentals review
 
DEFUN 2008 - Real World Haskell
DEFUN 2008 - Real World HaskellDEFUN 2008 - Real World Haskell
DEFUN 2008 - Real World Haskell
 
Introduction to idris
Introduction to idrisIntroduction to idris
Introduction to idris
 
Introduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf TaiwanIntroduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf Taiwan
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory building
 
It's Java Jim, But Not As We Know It!
It's Java Jim, But Not As We Know It!It's Java Jim, But Not As We Know It!
It's Java Jim, But Not As We Know It!
 
presentation on important DAG,TRIE,Hashing.pptx
presentation on important DAG,TRIE,Hashing.pptxpresentation on important DAG,TRIE,Hashing.pptx
presentation on important DAG,TRIE,Hashing.pptx
 
LISP: назад в будущее, Микола Мозговий
LISP: назад в будущее, Микола МозговийLISP: назад в будущее, Микола Мозговий
LISP: назад в будущее, Микола Мозговий
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospective
 
Mikhail Khristophorov "Introduction to Regular Expressions"
Mikhail Khristophorov "Introduction to Regular Expressions"Mikhail Khristophorov "Introduction to Regular Expressions"
Mikhail Khristophorov "Introduction to Regular Expressions"
 
Introduction to LaTeX - Workshop Day 1
Introduction to LaTeX - Workshop Day 1Introduction to LaTeX - Workshop Day 1
Introduction to LaTeX - Workshop Day 1
 
Erlang session1
Erlang session1Erlang session1
Erlang session1
 

Plus de SoftwareMill

Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesSoftwareMill
 
How To Survive a Live-Coding Session
How To Survive a Live-Coding SessionHow To Survive a Live-Coding Session
How To Survive a Live-Coding SessionSoftwareMill
 
Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...
Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...
Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...SoftwareMill
 
Have you ever wondered about code review?
Have you ever wondered about code review?Have you ever wondered about code review?
Have you ever wondered about code review?SoftwareMill
 
Reactive Integration with Akka Streams and Alpakka
Reactive Integration with Akka Streams and AlpakkaReactive Integration with Akka Streams and Alpakka
Reactive Integration with Akka Streams and AlpakkaSoftwareMill
 
W świecie botów czyli po co nam SI
W świecie botów czyli po co nam SIW świecie botów czyli po co nam SI
W świecie botów czyli po co nam SISoftwareMill
 
Small intro to Big Data
Small intro to Big DataSmall intro to Big Data
Small intro to Big DataSoftwareMill
 
Out-of-the-box Reactive Streams with Java 9
Out-of-the-box Reactive Streams with Java 9Out-of-the-box Reactive Streams with Java 9
Out-of-the-box Reactive Streams with Java 9SoftwareMill
 
Hiring, Bots and Beer. (Hiring in the IT industry)
Hiring, Bots and Beer. (Hiring in the IT industry) Hiring, Bots and Beer. (Hiring in the IT industry)
Hiring, Bots and Beer. (Hiring in the IT industry) SoftwareMill
 
Teal Is The New Black
Teal Is The New BlackTeal Is The New Black
Teal Is The New BlackSoftwareMill
 
Windowing data in big data streams
Windowing data in big data streamsWindowing data in big data streams
Windowing data in big data streamsSoftwareMill
 
Kafka as a message queue
Kafka as a message queueKafka as a message queue
Kafka as a message queueSoftwareMill
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to CassandraSoftwareMill
 
Cassandra - how to fail?
Cassandra - how to fail?Cassandra - how to fail?
Cassandra - how to fail?SoftwareMill
 
How to manage in a flat organized, remote and transparent company
How to manage in a flat organized, remote and transparent companyHow to manage in a flat organized, remote and transparent company
How to manage in a flat organized, remote and transparent companySoftwareMill
 
Performance tests with gatling
Performance tests with gatlingPerformance tests with gatling
Performance tests with gatlingSoftwareMill
 
What is most important 
in cooperation with external software developers? Par...
What is most important 
in cooperation with external software developers? Par...What is most important 
in cooperation with external software developers? Par...
What is most important 
in cooperation with external software developers? Par...SoftwareMill
 
Proste REST API z użyciem play i slick
Proste REST API z użyciem play i slickProste REST API z użyciem play i slick
Proste REST API z użyciem play i slickSoftwareMill
 
From spaghetti with no `src/test` to green CI and well-sleeping developers
From spaghetti with no `src/test` to green CI and well-sleeping developersFrom spaghetti with no `src/test` to green CI and well-sleeping developers
From spaghetti with no `src/test` to green CI and well-sleeping developersSoftwareMill
 
How secure your web framework is?
How secure your web framework is?How secure your web framework is?
How secure your web framework is?SoftwareMill
 

Plus de SoftwareMill (20)

Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retries
 
How To Survive a Live-Coding Session
How To Survive a Live-Coding SessionHow To Survive a Live-Coding Session
How To Survive a Live-Coding Session
 
Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...
Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...
Goryle i ser szwajcarski. Czego medycyna ratunkowa może Cię nauczyć o tworzen...
 
Have you ever wondered about code review?
Have you ever wondered about code review?Have you ever wondered about code review?
Have you ever wondered about code review?
 
Reactive Integration with Akka Streams and Alpakka
Reactive Integration with Akka Streams and AlpakkaReactive Integration with Akka Streams and Alpakka
Reactive Integration with Akka Streams and Alpakka
 
W świecie botów czyli po co nam SI
W świecie botów czyli po co nam SIW świecie botów czyli po co nam SI
W świecie botów czyli po co nam SI
 
Small intro to Big Data
Small intro to Big DataSmall intro to Big Data
Small intro to Big Data
 
Out-of-the-box Reactive Streams with Java 9
Out-of-the-box Reactive Streams with Java 9Out-of-the-box Reactive Streams with Java 9
Out-of-the-box Reactive Streams with Java 9
 
Hiring, Bots and Beer. (Hiring in the IT industry)
Hiring, Bots and Beer. (Hiring in the IT industry) Hiring, Bots and Beer. (Hiring in the IT industry)
Hiring, Bots and Beer. (Hiring in the IT industry)
 
Teal Is The New Black
Teal Is The New BlackTeal Is The New Black
Teal Is The New Black
 
Windowing data in big data streams
Windowing data in big data streamsWindowing data in big data streams
Windowing data in big data streams
 
Kafka as a message queue
Kafka as a message queueKafka as a message queue
Kafka as a message queue
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
Cassandra - how to fail?
Cassandra - how to fail?Cassandra - how to fail?
Cassandra - how to fail?
 
How to manage in a flat organized, remote and transparent company
How to manage in a flat organized, remote and transparent companyHow to manage in a flat organized, remote and transparent company
How to manage in a flat organized, remote and transparent company
 
Performance tests with gatling
Performance tests with gatlingPerformance tests with gatling
Performance tests with gatling
 
What is most important 
in cooperation with external software developers? Par...
What is most important 
in cooperation with external software developers? Par...What is most important 
in cooperation with external software developers? Par...
What is most important 
in cooperation with external software developers? Par...
 
Proste REST API z użyciem play i slick
Proste REST API z użyciem play i slickProste REST API z użyciem play i slick
Proste REST API z użyciem play i slick
 
From spaghetti with no `src/test` to green CI and well-sleeping developers
From spaghetti with no `src/test` to green CI and well-sleeping developersFrom spaghetti with no `src/test` to green CI and well-sleeping developers
From spaghetti with no `src/test` to green CI and well-sleeping developers
 
How secure your web framework is?
How secure your web framework is?How secure your web framework is?
How secure your web framework is?
 

Dernier

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Dernier (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Origins of free

  • 1. THE ORIGINS OF FREE Adam Warski, SoftwareMill 10/2/2017, LambdaDays
  • 2. @adamwarski, SoftwareMill, LambdaDays 2017 THE PLAN ➤ Why bother? ➤ Universal algebra ➤ Free algebras ➤ The meaning of life free ➤ Monads & free monads ➤ Free monads in Haskell, Cats and Scalaz ➤ It’s simpler than it sounds
  • 3. @adamwarski, SoftwareMill, LambdaDays 2017 WHY BOTHER WITH FREE? ➤ Define a composable program ➤ Using high-level custom instructions ➤ Run it in context later, given instruction interpretation def issueCreditCard(u: UserId): Free[BankOps, CreditLimit] = for {
 user <- LookupUserData(u).liftFree
 otherCredits <- FetchOtherCredits(user).liftFree
 val limit = calculateLimit(user, otherCredits)
 creditCard <- IssueNewCard(user, limit).liftFree 
 _ <- SendEmail(user.email, cardIssuedEmail(user, limit)).liftFree
 } yield limit
  • 4. @adamwarski, SoftwareMill, LambdaDays 2017 WHY BOTHER WITH FREE? def issueCreditCard(u: UserId): Free[BankOps, CreditLimit] = for {
 user <- LookupUserData(u).liftFree
 otherCredits <- FetchOtherCredits(user).liftFree
 val limit = calculateLimit(user, otherCredits)
 creditCard <- IssueNewCard(user, limit).liftFree 
 _ <- SendEmail(user.email, cardIssuedEmail(user, limit)).liftFree
 } yield limit val productionInterpreter: BankOp ~> Future = {
 override def apply[A](bo: BankOp[A]): Future[A] = bo match {
 case LookupUserData(u) => oracleDB2dao.lookupUser(u)
 case FetchOtherCredits(user) => 
 legacySoapSystem.fetchCredits(user)
 // …
 }
 }
  • 5. @adamwarski, SoftwareMill, LambdaDays 2017 WHY BOTHER WITH FREE? val testInterpreter: BankOp ~> Id = {
 override def apply[A](bo: BankOp[A]): Id[A] = bo match {
 case LookupUserData(u) => new User(…)
 case FetchOtherCredits(user) => List(Credit(1000000.usd))
 // …
 }
 } def issueCreditCard(u: UserId): Free[BankOps, CreditLimit] = for {
 user <- LookupUserData(u).liftFree
 otherCredits <- FetchOtherCredits(user).liftFree
 val limit = calculateLimit(user, otherCredits)
 creditCard <- IssueNewCard(user, limit).liftFree 
 _ <- SendEmail(user.email, cardIssuedEmail(user, limit)).liftFree
 } yield limit
  • 6. @adamwarski, SoftwareMill, LambdaDays 2017 WHY BOTHER WITH FREE? val result: CreditLimit = issueCreditCard(UserId(42))
 .foldMap(testInterpreter) def issueCreditCard(u: UserId): Free[BankOps, CreditLimit] = for {
 user <- LookupUserData(u).liftFree
 otherCredits <- FetchOtherCredits(user).liftFree
 val limit = calculateLimit(user, otherCredits)
 creditCard <- IssueNewCard(user, limit).liftFree 
 _ <- SendEmail(user.email, cardIssuedEmail(user, limit)).liftFree
 } yield limit
  • 7. @adamwarski, SoftwareMill, LambdaDays 2017 ABOUT ME ➤ Software Engineer, co-founder @ ➤ Mainly Scala ➤ Open-source: Quicklens, MacWire, ElasticMQ, ScalaClippy, … ➤ Long time ago: student of Category Theory
  • 8. @adamwarski, SoftwareMill, LambdaDays 2017 WHAT IS AN ALGEBRA? “algebra is the study of mathematical symbols and the rules for manipulating these symbols"
 Wikipedia, 2017 “the part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formulae and equations."
 Google Search, 2017 y = ax + b E = mc2 f(10◊x) = K(▸9) def sum(l: List[L]) = l.fold(_ + _) main = getCurrentTime >>= print
  • 9. @adamwarski, SoftwareMill, LambdaDays 2017 UNIVERSAL ALGEBRA: SIGNATURE ➤ Goal: Model programs as algebras ➤ Let’s generalise! ➤ Studies algebraic structures, rather than concrete models algebraic signature ⌃ = (S, ⌦) set S family ⌦ of sets indexed by S⇤ ⇥ S ➤ Syntax: ➤ type names: ➤ operation names:
  • 10. @adamwarski, SoftwareMill, LambdaDays 2017 UNIVERSAL ALGEBRA: SIGNATURE EXAMPLE toString(succ(0) + succ(succ(0))) S = {int, str} ⌦✏,int = {0} ⌦int,int = {succ} ⌦(int,int),int = {+} ⌦(str,str),str = {++} ⌦int,str = {toString}
  • 11. @adamwarski, SoftwareMill, LambdaDays 2017 UNIVERSAL ALGEBRA: ALGEBRA ➤ A specific interpretation of the signature ➤ for each type, a set ➤ for each operation, a function between appropriate sets ⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString} We can define a ⌃-algebra A: |A|int = {0, 1, 2, ...} = N |A|str = {”a”, ”aa”, ..., ”b”, ”ab”, ...} succA = x.x + 1 +A = xy.x + y . . .
  • 12. @adamwarski, SoftwareMill, LambdaDays 2017 TERM ALGEBRA ➤ Can we build an algebra out of pure syntax? ➤ Expressions (terms) that can be built from the signature ➤ Rather boring, no interpretation at all |T⌃|int = {0, succ(0), succ(succ(0)), ..., 0 + 0, 0 + succ(0), ...} |T⌃|str = {toString(0), toString(succ(0)), ..., toString(0)++toString(0), ...} succT⌃ (t) = succ(t), e.g. succT⌃ (succ(0)) = succ(succ(0)) +T⌃ (t1, t2) = t1 + t2 ... ⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString} We define the term algebra T⌃:
  • 13. @adamwarski, SoftwareMill, LambdaDays 2017 TERM ALGEBRA ➤ Defined inductively ➤ base: all constants are terms ➤ step: any functions we can apply on previous terms ⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString} {0} {0, 0 + 0, succ(0), toString(0)} {0, 0 + 0, succ(0), 0 + succ(0), succ(0) + 0, succ(0) + succ(0), toString(0), toString(succ(0)), toString(0) + +toString(0)}
  • 14. @adamwarski, SoftwareMill, LambdaDays 2017 HOMOMORPHISM ➤ Homomorphism is a function between algebras ➤ For each type, functions between type interpretations ➤ Such that operations are preserved ⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString} When A and B are ⌃-algebras, f : A ! B is a homomorphism when: fint : |A|int ! |B|int fstr : |A|str ! |B|str 8x2|A|int fint(succA(x)) = succB(fint(x)) 8xy2|A|int f(x +A y) = f(x) +B f(y) 8x2|A|int fstr(toStringA(x)) = toStringB(fint(x))
  • 15. @adamwarski, SoftwareMill, LambdaDays 2017 INITIAL ALGEBRA ⌃-algebra I is initial when for any other ⌃-algebra A there is exactly one homomorphism between them. Theorem 1 T⌃ is initial
  • 16. @adamwarski, SoftwareMill, LambdaDays 2017 INITIAL ALGEBRA Theorem 1 T⌃ is initial ⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString} |A|int = {0, 1, 2, ...} = N |A|str = {”a”, ”aa”, ..., ”b”, ”ab”, ...} succA = x.x + 1 +A = xy.x + y . . . We can define a ⌃-algebra A: f : T⌃ ! A f(0T⌃ ) = 0A f(succT⌃ (t)) = succA(f(t)) ...
  • 17. @adamwarski, SoftwareMill, LambdaDays 2017 INITIAL ALGEBRA ➤ Only one way to interpret a term ➤ no junk: term algebra contains only what’s absolutely necessary ➤ no confusion: no two values are combined if they don’t need to be ➤ There’s only one initial algebra (up to isomorphism) ⌃-algebra I is initial when for any other ⌃-algebra A there is exactly one homomorphism between them. Theorem 1 T⌃ is initial
  • 18. @adamwarski, SoftwareMill, LambdaDays 2017 INITIAL ALGEBRA ➤ This algebra is definitely not initial: ⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString} ➤ Junk: strings “a”, “b”, … ➤ Confusion: 0+succ(0) is same as succ(0)+0 We can define a ⌃-algebra A: |A|int = {0, 1, 2, ...} = N |A|str = {”a”, ”aa”, ..., ”b”, ”ab”, ...}
  • 19. @adamwarski, SoftwareMill, LambdaDays 2017 FREE ALGEBRA For any set X, T⌃(X) is the term algebra with X added as ”constants” (but called variables) ⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString} Xint = {i, j, k} Xstr = {s1, s2} succ(i) + j + succ(succ(k)) s1 + +toString(0) toString(succ(0) + k) + +s2
  • 20. @adamwarski, SoftwareMill, LambdaDays 2017 FREE ALGEBRA ➤ An interpretation of the variables determines an interpretation of any term Theorem 1 For any variable set X, T⌃(X) is free For any set X, T⌃(X) is the term algebra with X added as ”constants” (but called variables) ⌃-algebra I is free over X (X ⇢ I) when for any other ⌃-algebra A, any function f : X ! |A| extends uniquely to a homomorphism f# : I ! A between them.
  • 21. @adamwarski, SoftwareMill, LambdaDays 2017 FREE ALGEBRA EXAMPLE ⌃ = (S, ⌦), S = {int, str} and ⌦ = {0, succ, +, ++, toString} Xint = {i, j, k} Xstr = {s1, s2} |A|int = N, |A|str = {”a”, ”aa”, ..., ”b”, ”ab”, ...} succA = x.x + 1 +A = xy.x + y . . . f : X ! |A| f(i) = 10, f(j) = 5, f(k) = 42 f(s1) = ”lambda”, f(s2) = ”days” f# : T⌃(X) ! A f# (toString(succ(j) + succ(0)) + +s1) = ”7lambda” f# (s2 + +toString(k) + +s2) = ”lambda42days”
  • 22. @adamwarski, SoftwareMill, LambdaDays 2017 MEANING OF FREE ➤ Free to interpret in any way ➤ no constraints ➤ Free of additional structure ➤ only what’s absolutely necessary ➤ No junk, no confusion
  • 23. @adamwarski, SoftwareMill, LambdaDays 2017 FREE RECAP ➤ Algebraic signature: ➤ All possible interpretations: algebras ➤ For any variable set ➤ The term algebra is free ➤ any interpretation of the variables ➤ determines an interpretation of any term ➤ A general construction ⌃ = (S, ⌦) X T⌃(X) f : X ! |A| f# : T⌃(X) ! A
  • 24. @adamwarski, SoftwareMill, LambdaDays 2017 MODELLING SEQUENTIAL PROGRAMS: MONADS ➤ A sequential program can: ➤ return a value (pure) ➤ compute what to do next basing on previous result (flatMap) ➤ People decided to call an object with such operations a Monad ➤ Hence, we’ll use Monads to represent programs as data ➤ + sanity laws
  • 25. @adamwarski, SoftwareMill, LambdaDays 2017 FREE MONAD ➤ Signature ~ pure + flatMap ➤ Variables ~ operations (our DSL) ➤ Free Monad ~ terms built out of pure, flatMap, our DSL ➤ modulo monad laws! ➤ e.g. flatMap(pure(x), f) = f(x) Interpretation of the DSL determines the interpretation of the whole program
  • 26. @adamwarski, SoftwareMill, LambdaDays 2017 FREE MONAD ➤ Our “world” (category) are Scala/Haskell/… monads (not algebras) ➤ The “world” (category) of the variables are generic Scala/Haskell/… terms (not sets) ➤ Signature: ➤ types: M[_] ➤ operations: ➤ pure[A]: A => M[A] ➤ flatMap[A, B](ma: M[A], f: A => M[B]): M[B] ➤ Modulo monad laws
  • 27. @adamwarski, SoftwareMill, LambdaDays 2017 FREE IN CATS/SCALAZ trait Free[F[_], A]
 
 object Free {
 case class Pure[F[_], A](a: A) extends Free[F, A]
 case class Suspend[F[_], A](a: F[A]) extends Free[F, A]
 case class FlatMapped[F[_], B, C](
 c: Free[F, C], f: C => Free[F, B] extends Free[F, B]
 }
  • 28. @adamwarski, SoftwareMill, LambdaDays 2017 FREE IN HASKELL data Free f r = Free (f (Free f r)) | Pure r trait Free[F[_], A]
 
 object Free {
 case class Pure[F[_], A](a: A) extends Free[F, A]
 case class Join[F[_], A](f: F[Free[F, A]]) extends Free[S, A]
 } f/F[_] must be a functor!
  • 29. @adamwarski, SoftwareMill, LambdaDays 2017 SUMMING UP ➤ Direct construction of free algebras ➤ Hand-wavy construction of free monad ➤ Free ➤ free to interpret in any way ➤ free of constraints ➤ no junk, no confusion ➤ Free in Haskell is the same free as in Scala
  • 30. @adamwarski, SoftwareMill, LambdaDays 2017 FURTHER READING ➤ “Foundations of Algebraic Specification and Formal Software Development” by Donald Sannella and Andrzej Tarlecki ➤ The Internet