A sighting of sequence function in Practical FP in Scala

Philip Schwarz
Philip SchwarzSoftware development is what I am passionate about
sequence
a sighting of
in
@philip_schwarz
slides by http://fpilluminated.com/
by
with some minor renaming, to ease comprehension
for anyone lacking context – see repo for original
^⇧P Type Info
^⇧P Type Info
@typeclass trait Traverse[F[_]] extends Functor[F] with Foldable[F] with …
…
Thread all the G effects through the F structure to invert the structure from F[G[A]] to G[F[A]].
def sequence[G[_]: Applicative, A](fga: F[G[A]]): G[F[A]] =
traverse(fga)(ga => ga)
List[F[Unit]] => F[List[Unit]]
case class CartRoutes[F[_]: JsonDecoder: Monad]
Applicative
Monad
Functor
Traverse
Foldable
1 de 4

Recomendados

Scala Left Fold Parallelisation - Three Approaches por
Scala Left Fold Parallelisation- Three ApproachesScala Left Fold Parallelisation- Three Approaches
Scala Left Fold Parallelisation - Three ApproachesPhilip Schwarz
43 vistas44 diapositivas
Tagless Final Encoding - Algebras and Interpreters and also Programs por
Tagless Final Encoding - Algebras and Interpreters and also ProgramsTagless Final Encoding - Algebras and Interpreters and also Programs
Tagless Final Encoding - Algebras and Interpreters and also ProgramsPhilip Schwarz
46 vistas16 diapositivas
Fusing Transformations of Strict Scala Collections with Views por
Fusing Transformations of Strict Scala Collections with ViewsFusing Transformations of Strict Scala Collections with Views
Fusing Transformations of Strict Scala Collections with ViewsPhilip Schwarz
20 vistas28 diapositivas
N-Queens Combinatorial Puzzle meets Cats por
N-Queens Combinatorial Puzzle meets CatsN-Queens Combinatorial Puzzle meets Cats
N-Queens Combinatorial Puzzle meets CatsPhilip Schwarz
33 vistas386 diapositivas
Kleisli composition, flatMap, join, map, unit - implementation and interrelat... por
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...Philip Schwarz
16 vistas16 diapositivas
The aggregate function - from sequential and parallel folds to parallel aggre... por
The aggregate function - from sequential and parallel folds to parallel aggre...The aggregate function - from sequential and parallel folds to parallel aggre...
The aggregate function - from sequential and parallel folds to parallel aggre...Philip Schwarz
264 vistas31 diapositivas

Más contenido relacionado

Más de Philip Schwarz

Algebraic Data Types for Data Oriented Programming - From Haskell and Scala t... por
Algebraic Data Types forData Oriented Programming - From Haskell and Scala t...Algebraic Data Types forData Oriented Programming - From Haskell and Scala t...
Algebraic Data Types for Data Oriented Programming - From Haskell and Scala t...Philip Schwarz
1.2K vistas46 diapositivas
Jordan Peterson - The pursuit of meaning and related ethical axioms por
Jordan Peterson - The pursuit of meaning and related ethical axiomsJordan Peterson - The pursuit of meaning and related ethical axioms
Jordan Peterson - The pursuit of meaning and related ethical axiomsPhilip Schwarz
142 vistas12 diapositivas
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c... por
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...Philip Schwarz
100 vistas1 diapositiva
Defining filter using (a) recursion (b) folding with S, B and I combinators (... por
Defining filter using (a) recursion (b) folding with S, B and I combinators (...Defining filter using (a) recursion (b) folding with S, B and I combinators (...
Defining filter using (a) recursion (b) folding with S, B and I combinators (...Philip Schwarz
78 vistas1 diapositiva
The Sieve of Eratosthenes - Part 1 - with minor corrections por
The Sieve of Eratosthenes - Part 1 - with minor correctionsThe Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor correctionsPhilip Schwarz
110 vistas50 diapositivas
The Sieve of Eratosthenes - Part 1 por
The Sieve of Eratosthenes - Part 1The Sieve of Eratosthenes - Part 1
The Sieve of Eratosthenes - Part 1Philip Schwarz
1K vistas50 diapositivas

Más de Philip Schwarz(20)

Algebraic Data Types for Data Oriented Programming - From Haskell and Scala t... por Philip Schwarz
Algebraic Data Types forData Oriented Programming - From Haskell and Scala t...Algebraic Data Types forData Oriented Programming - From Haskell and Scala t...
Algebraic Data Types for Data Oriented Programming - From Haskell and Scala t...
Philip Schwarz1.2K vistas
Jordan Peterson - The pursuit of meaning and related ethical axioms por Philip Schwarz
Jordan Peterson - The pursuit of meaning and related ethical axiomsJordan Peterson - The pursuit of meaning and related ethical axioms
Jordan Peterson - The pursuit of meaning and related ethical axioms
Philip Schwarz142 vistas
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c... por Philip Schwarz
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...
Defining filter using (a) recursion (b) folding (c) folding with S, B and I c...
Philip Schwarz100 vistas
Defining filter using (a) recursion (b) folding with S, B and I combinators (... por Philip Schwarz
Defining filter using (a) recursion (b) folding with S, B and I combinators (...Defining filter using (a) recursion (b) folding with S, B and I combinators (...
Defining filter using (a) recursion (b) folding with S, B and I combinators (...
Philip Schwarz78 vistas
The Sieve of Eratosthenes - Part 1 - with minor corrections por Philip Schwarz
The Sieve of Eratosthenes - Part 1 - with minor correctionsThe Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor corrections
Philip Schwarz110 vistas
The Sieve of Eratosthenes - Part 1 por Philip Schwarz
The Sieve of Eratosthenes - Part 1The Sieve of Eratosthenes - Part 1
The Sieve of Eratosthenes - Part 1
Philip Schwarz1K vistas
The Uniform Access Principle por Philip Schwarz
The Uniform Access PrincipleThe Uniform Access Principle
The Uniform Access Principle
Philip Schwarz543 vistas
Computer Graphics in Java and Scala - Part 1b por Philip Schwarz
Computer Graphics in Java and Scala - Part 1bComputer Graphics in Java and Scala - Part 1b
Computer Graphics in Java and Scala - Part 1b
Philip Schwarz261 vistas
The Expression Problem - Part 2 por Philip Schwarz
The Expression Problem - Part 2The Expression Problem - Part 2
The Expression Problem - Part 2
Philip Schwarz650 vistas
Computer Graphics in Java and Scala - Part 1 por Philip Schwarz
Computer Graphics in Java and Scala - Part 1Computer Graphics in Java and Scala - Part 1
Computer Graphics in Java and Scala - Part 1
Philip Schwarz403 vistas
The Expression Problem - Part 1 por Philip Schwarz
The Expression Problem - Part 1The Expression Problem - Part 1
The Expression Problem - Part 1
Philip Schwarz1.2K vistas
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac... por Philip Schwarz
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...
Side by Side - Scala and Java Adaptations of Martin Fowler’s Javascript Refac...
Philip Schwarz268 vistas
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ... por Philip Schwarz
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Philip Schwarz313 vistas
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ... por Philip Schwarz
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Philip Schwarz631 vistas
‘go-to’ general-purpose sequential collections - from Java To Scala por Philip Schwarz
‘go-to’ general-purpose sequential collections -from Java To Scala‘go-to’ general-purpose sequential collections -from Java To Scala
‘go-to’ general-purpose sequential collections - from Java To Scala
Philip Schwarz767 vistas
The Functional Programming Triad of Map, Filter and Fold por Philip Schwarz
The Functional Programming Triad of Map, Filter and FoldThe Functional Programming Triad of Map, Filter and Fold
The Functional Programming Triad of Map, Filter and Fold
Philip Schwarz3.5K vistas
Functional Core and Imperative Shell - Game of Life Example - Haskell and Scala por Philip Schwarz
Functional Core and Imperative Shell - Game of Life Example - Haskell and ScalaFunctional Core and Imperative Shell - Game of Life Example - Haskell and Scala
Functional Core and Imperative Shell - Game of Life Example - Haskell and Scala
Philip Schwarz826 vistas
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and... por Philip Schwarz
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
Philip Schwarz495 vistas
Quicksort - a whistle-stop tour of the algorithm in five languages and four p... por Philip Schwarz
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 Schwarz1.2K vistas
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and... por Philip Schwarz
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
N-Queens Combinatorial Problem - Polyglot FP for fun and profit - Haskell and...
Philip Schwarz842 vistas

Último

predicting-m3-devopsconMunich-2023-v2.pptx por
predicting-m3-devopsconMunich-2023-v2.pptxpredicting-m3-devopsconMunich-2023-v2.pptx
predicting-m3-devopsconMunich-2023-v2.pptxTier1 app
14 vistas33 diapositivas
Introduction to Gradle por
Introduction to GradleIntroduction to Gradle
Introduction to GradleJohn Valentino
7 vistas7 diapositivas
Techstack Ltd at Slush 2023, Ukrainian delegation por
Techstack Ltd at Slush 2023, Ukrainian delegationTechstack Ltd at Slush 2023, Ukrainian delegation
Techstack Ltd at Slush 2023, Ukrainian delegationViktoriiaOpanasenko
7 vistas4 diapositivas
ADDO_2022_CICID_Tom_Halpin.pdf por
ADDO_2022_CICID_Tom_Halpin.pdfADDO_2022_CICID_Tom_Halpin.pdf
ADDO_2022_CICID_Tom_Halpin.pdfTomHalpin9
6 vistas33 diapositivas
Page Object Model por
Page Object ModelPage Object Model
Page Object Modelartembondar5
7 vistas5 diapositivas
Ports-and-Adapters Architecture for Embedded HMI por
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMIBurkhard Stubert
35 vistas19 diapositivas

Último(20)

predicting-m3-devopsconMunich-2023-v2.pptx por Tier1 app
predicting-m3-devopsconMunich-2023-v2.pptxpredicting-m3-devopsconMunich-2023-v2.pptx
predicting-m3-devopsconMunich-2023-v2.pptx
Tier1 app14 vistas
ADDO_2022_CICID_Tom_Halpin.pdf por TomHalpin9
ADDO_2022_CICID_Tom_Halpin.pdfADDO_2022_CICID_Tom_Halpin.pdf
ADDO_2022_CICID_Tom_Halpin.pdf
TomHalpin96 vistas
Ports-and-Adapters Architecture for Embedded HMI por Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert35 vistas
Quality Engineer: A Day in the Life por John Valentino
Quality Engineer: A Day in the LifeQuality Engineer: A Day in the Life
Quality Engineer: A Day in the Life
John Valentino10 vistas
Understanding HTML terminology por artembondar5
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminology
artembondar58 vistas
Advanced API Mocking Techniques Using Wiremock por Dimpy Adhikary
Advanced API Mocking Techniques Using WiremockAdvanced API Mocking Techniques Using Wiremock
Advanced API Mocking Techniques Using Wiremock
Dimpy Adhikary5 vistas
Mobile App Development Company por Richestsoft
Mobile App Development CompanyMobile App Development Company
Mobile App Development Company
Richestsoft 5 vistas
How to build dyanmic dashboards and ensure they always work por Wiiisdom
How to build dyanmic dashboards and ensure they always workHow to build dyanmic dashboards and ensure they always work
How to build dyanmic dashboards and ensure they always work
Wiiisdom16 vistas
Supercharging your Python Development Environment with VS Code and Dev Contai... por Dawn Wages
Supercharging your Python Development Environment with VS Code and Dev Contai...Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...
Dawn Wages5 vistas
Introduction to Git Source Control por John Valentino
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source Control
John Valentino8 vistas
Electronic AWB - Electronic Air Waybill por Freightoscope
Electronic AWB - Electronic Air Waybill Electronic AWB - Electronic Air Waybill
Electronic AWB - Electronic Air Waybill
Freightoscope 6 vistas

A sighting of sequence function in Practical FP in Scala

  • 1. sequence a sighting of in @philip_schwarz slides by http://fpilluminated.com/ by
  • 2. with some minor renaming, to ease comprehension for anyone lacking context – see repo for original
  • 4. @typeclass trait Traverse[F[_]] extends Functor[F] with Foldable[F] with … … Thread all the G effects through the F structure to invert the structure from F[G[A]] to G[F[A]]. def sequence[G[_]: Applicative, A](fga: F[G[A]]): G[F[A]] = traverse(fga)(ga => ga) List[F[Unit]] => F[List[Unit]] case class CartRoutes[F[_]: JsonDecoder: Monad] Applicative Monad Functor Traverse Foldable