SlideShare a Scribd company logo
1 of 48
Download to read offline
The Next Great Functional
Programming Language
(OK, not really.)
John A. De Goes — @jdegoes
ML - 1973
Haskell - 19901
OCaml - 19962
2
Or 1987 if you count Caml.
1
Or 1985 if you count Miranda.
Haskell
Haskellz
144 quadrillion flavors.
!
Our Best FPLs Suffer from
Decades Worth of
Accretion
Individual Features were
Designed, but the FPLs
Came Into Existence
What Would a Designed
FPL Look Like Today?
?
!
[This Slide Intentionally Left Blank]
My Ideal FPL
4 Pattern Matching
4 Records
4 Modules
4 Syntax
4 Type Classes
4 Nominative Typing
4 Data
4 Recursion
! Pattern Matching
Pattern Matching
import Lens.Family.Total
import Lens.Family.Stock
total :: Either Char Int -> String -- Same as:
total = _case -- total = case
& on _Left (c -> replicate 3 c ) -- Left c -> replicate 3 c
& on _Right (n -> replicate n '!') -- Right n -> replicate n '!'
! Records
Records
val book =
("author" ->> "Benjamin Pierce") ::
("title" ->> "Types and Programming Languages") ::
("id" ->> 262162091) ::
("price" ->> 44.11) ::
HNil
scala> book("author") // Note result type ...
res0: String = Benjamin Pierce
scala> val extended = book + ("inPrint" ->> true) // Add a new field
extended: ... complex type elided ... =
Benjamin Pierce :: Types and Programming Languages :: 262162091 :: 46.11 :: true :: HNil
scala> val noId = extended - "id" // Removed a field
noId: ... complex type elided ... =
Benjamin Pierce :: Types and Programming Languages :: 46.11 :: true :: HNil
! Modules
Modules
structure ListStack :> STACK =
struct
type t = 'a list
[...]
end
Modules
data Stack f = Stack
{ makeNew :: forall a. f a,
push :: forall a. a -> f a -> f a,
pop :: forall a. f a -> Maybe (Tuple a (f a)) }
doSomeStackStuff :: forall f. Stack f -> Thing
Modules
data Stack f = Stack
{ makeNew :: forall a. f a,
push :: forall a. a -> f a -> f a,
pop :: forall a. f a -> Maybe (Tuple a (f a)) }
data ReservationSystem f = ReservationSystem
(forall g. Stack g -> { ... })
! Syntax
Syntax
Let's stop pretending programs are strings of ASCII
characters.
4 implicits
4 order of function parameters / application
4 compiler errors
4 funky looking operators
4 scopes
4 Haskell-style (fake) modules & imports
4 name clashes
4 information elision
4 ...
! Type Classes
Type Classes
Just 'records' with compiler-enforced laws.3
3
Type classes also add an implicitly applied (a : Type) -> TypeClass a function that's piecewise-
defined, but that's just syntax.
! Partiality
Partiality
If it's partial, it's not a &^@#% function.
! Nominative Typing
Nominative Typing
data Email = Email String
data DOMId = DOMId String
data Positive = Positive Float
data Negative = Negative Float
data DressSize = DressSize Float
Nominative Typing
data ??? = ??? String
data ??? = ??? String
data ??? = ??? Float
data ??? = ??? Float
data ??? = ??? Float
Let's Stop Pretending
Differences in Names
Actually Matter
Nominative Typing
Let's play a guessing game.
data ??? = ??? -- {v: Float | v > 0}
data ??? = ??? -- {v: Float | v < 0}
! Data
Data
Data: Bits-based description.
data Either a b = Left a | Right b
struct either {
int tag;
union {
void *left;
void *right;
};
};
Data
Newbies: addicted to pattern matching.
data List a = Nil | Cons a (List a)
doSomething :: forall a. List a -> Int
doSomething Nil = 0
doSomething (Cons _ l) = 1 + doSomething l
Data
Pros: addicted to folds.
fold :: forall z a. z -> (z -> a -> z) -> List a -> z
fold z _ Nil = z
fold z f (Cons a l) = fold (f z a) l
Data
Folds: Capability-based description.
fold :: forall z a. z -> (z -> a -> z) -> List a -> z
data List a = List (forall z. z -> (z -> a -> z) -> z)
Data
data List a = List (forall z. z -> (z -> a -> z) -> z)
nil = z f -> z
cons a (List as) = z f -> as (f a z) f
Array? Linked List? Vector? Skip List?4
4
Strictly more powerful than a data List (pros & cons).
! Recursion
Recursion
Goto of functional programming.5
f x = if x / 2 > x then g (2 * x) else 42
g x = if x % 1 == 0 then f (g (x + 1)) else h (x - 1)
h x = if x % 1 == 1 then f (x * 2 + 1) else g (x + 1)
5
What's hard for a machine|human to understand is also hard for a human|machine to understand.
Recursion
Induction -> Folds.
Recursion
Coinduction -> State Machines.
type Machine s a b = (s, (s, a) -> (s, b))
6
6
Except this is too weakly typed.
My Ideal FPL
My Ideal FPL
Layered like an onion.
4 Turing incomplete for 99% of program
4 Prove / optimize more
4 Turing complete 'driver'
4 Prove / optimize less
4 Possibly in a different language (e.g. Haskell)
My Ideal FPL
Structured editor.
4 Friendly FP
4 Destroys motivation for most language 'features'
My Ideal FPL
All the things are values.
4 Math functions
4 Abolish incidental complexity
4 Abolish artificial distinctions
My Ideal FPL
Proof search.
4 Turing complete
4 Levels of proof
1. Proven true
2. Evidence for truth but not proven true
3. Proven false (in general or by counterexample)
4 Massive, persistent proof databases
4 Cross-disciplinary research
4 e.g. deep learning to accelerate proof search
My Ideal FPL
Zero cost abstraction.
4 As long as we're shooting for the moon
4 (But genuinely easier w/o recursion/data)
Inspirations
4 Unison Programming Language7
4 LiquidHaskell8
4 Morte9
9
http://www.haskellforall.com/2014/09/morte-intermediate-language-for-super.html
8
http://goto.ucsd.edu/~rjhala/liquid/haskell/blog/
7
http://unisonweb.org
THANK YOU
John A. De Goes — @jdegoes

More Related Content

What's hot

Scalaz 8: A Whole New Game
Scalaz 8: A Whole New GameScalaz 8: A Whole New Game
Scalaz 8: A Whole New GameJohn De Goes
 
Big picture of category theory in scala with deep dive into contravariant and...
Big picture of category theory in scala with deep dive into contravariant and...Big picture of category theory in scala with deep dive into contravariant and...
Big picture of category theory in scala with deep dive into contravariant and...Piotr Paradziński
 
The Death of Final Tagless
The Death of Final TaglessThe Death of Final Tagless
The Death of Final TaglessJohn De Goes
 
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018John De Goes
 
Functor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadOliver Daff
 
Contravariant functors in scala
Contravariant functors in scalaContravariant functors in scala
Contravariant functors in scalaPiotr Paradziński
 
Advanced Tagless Final - Saying Farewell to Free
Advanced Tagless Final - Saying Farewell to FreeAdvanced Tagless Final - Saying Farewell to Free
Advanced Tagless Final - Saying Farewell to FreeLuka Jacobowitz
 
The Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect SystemThe Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect SystemJohn De Goes
 
One Monad to Rule Them All
One Monad to Rule Them AllOne Monad to Rule Them All
One Monad to Rule Them AllJohn De Goes
 
GUL UC3M - Introduction to functional programming
GUL UC3M - Introduction to functional programmingGUL UC3M - Introduction to functional programming
GUL UC3M - Introduction to functional programmingDavid Muñoz Díaz
 
T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerDavid Muñoz Díaz
 
Core csharp and net quick reference
Core csharp and net quick referenceCore csharp and net quick reference
Core csharp and net quick referenceilesh raval
 
Introduction to functional programming using Ocaml
Introduction to functional programming using OcamlIntroduction to functional programming using Ocaml
Introduction to functional programming using Ocamlpramode_ce
 
O caml2014 leroy-slides
O caml2014 leroy-slidesO caml2014 leroy-slides
O caml2014 leroy-slidesOCaml
 
Monoids, Monoids, Monoids - ScalaLove 2020
Monoids, Monoids, Monoids - ScalaLove 2020Monoids, Monoids, Monoids - ScalaLove 2020
Monoids, Monoids, Monoids - ScalaLove 2020Luka Jacobowitz
 
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsScalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsJohn De Goes
 
Testing in the World of Functional Programming
Testing in the World of Functional ProgrammingTesting in the World of Functional Programming
Testing in the World of Functional ProgrammingLuka Jacobowitz
 
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 mattersPiotr Paradziński
 
Principled Error Handling with FP
Principled Error Handling with FPPrincipled Error Handling with FP
Principled Error Handling with FPLuka Jacobowitz
 

What's hot (20)

Scalaz 8: A Whole New Game
Scalaz 8: A Whole New GameScalaz 8: A Whole New Game
Scalaz 8: A Whole New Game
 
Big picture of category theory in scala with deep dive into contravariant and...
Big picture of category theory in scala with deep dive into contravariant and...Big picture of category theory in scala with deep dive into contravariant and...
Big picture of category theory in scala with deep dive into contravariant and...
 
The Death of Final Tagless
The Death of Final TaglessThe Death of Final Tagless
The Death of Final Tagless
 
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018Blazing Fast, Pure Effects without Monads — LambdaConf 2018
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
 
Functor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And Monad
 
Contravariant functors in scala
Contravariant functors in scalaContravariant functors in scala
Contravariant functors in scala
 
Advanced Tagless Final - Saying Farewell to Free
Advanced Tagless Final - Saying Farewell to FreeAdvanced Tagless Final - Saying Farewell to Free
Advanced Tagless Final - Saying Farewell to Free
 
The Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect SystemThe Design of the Scalaz 8 Effect System
The Design of the Scalaz 8 Effect System
 
One Monad to Rule Them All
One Monad to Rule Them AllOne Monad to Rule Them All
One Monad to Rule Them All
 
GUL UC3M - Introduction to functional programming
GUL UC3M - Introduction to functional programmingGUL UC3M - Introduction to functional programming
GUL UC3M - Introduction to functional programming
 
T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmer
 
Core csharp and net quick reference
Core csharp and net quick referenceCore csharp and net quick reference
Core csharp and net quick reference
 
Introduction to functional programming using Ocaml
Introduction to functional programming using OcamlIntroduction to functional programming using Ocaml
Introduction to functional programming using Ocaml
 
O caml2014 leroy-slides
O caml2014 leroy-slidesO caml2014 leroy-slides
O caml2014 leroy-slides
 
Monoids, Monoids, Monoids - ScalaLove 2020
Monoids, Monoids, Monoids - ScalaLove 2020Monoids, Monoids, Monoids - ScalaLove 2020
Monoids, Monoids, Monoids - ScalaLove 2020
 
Scalaz 8 vs Akka Actors
Scalaz 8 vs Akka ActorsScalaz 8 vs Akka Actors
Scalaz 8 vs Akka Actors
 
Testing in the World of Functional Programming
Testing in the World of Functional ProgrammingTesting in the World of Functional Programming
Testing in the World of Functional Programming
 
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
 
Why Haskell
Why HaskellWhy Haskell
Why Haskell
 
Principled Error Handling with FP
Principled Error Handling with FPPrincipled Error Handling with FP
Principled Error Handling with FP
 

Similar to The Next Great Functional Programming Language

Introduction to Functional Languages
Introduction to Functional LanguagesIntroduction to Functional Languages
Introduction to Functional Languagessuthi
 
Five Languages in a Moment
Five Languages in a MomentFive Languages in a Moment
Five Languages in a MomentSergio Gil
 
Haskell - Being lazy with class
Haskell - Being lazy with classHaskell - Being lazy with class
Haskell - Being lazy with classTiago Babo
 
FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳Yuri Inoue
 
Is there a perfect data-parallel programming language? (Experiments with More...
Is there a perfect data-parallel programming language? (Experiments with More...Is there a perfect data-parallel programming language? (Experiments with More...
Is there a perfect data-parallel programming language? (Experiments with More...Julian Hyde
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospectivechenge2k
 
Morel, a Functional Query Language
Morel, a Functional Query LanguageMorel, a Functional Query Language
Morel, a Functional Query LanguageJulian Hyde
 
Morel, a data-parallel programming language
Morel, a data-parallel programming languageMorel, a data-parallel programming language
Morel, a data-parallel programming languageJulian Hyde
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?osfameron
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedSusan Potter
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming iiPrashant Kalkar
 
Fp in scala part 1
Fp in scala part 1Fp in scala part 1
Fp in scala part 1Hang Zhao
 
Functional Programming by Examples using Haskell
Functional Programming by Examples using HaskellFunctional Programming by Examples using Haskell
Functional Programming by Examples using Haskellgoncharenko
 
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...
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...Philip Schwarz
 
Functional perl
Functional perlFunctional perl
Functional perlErrorific
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meetMario Fusco
 
The Fuss about || Haskell | Scala | F# ||
The Fuss about || Haskell | Scala | F# ||The Fuss about || Haskell | Scala | F# ||
The Fuss about || Haskell | Scala | F# ||Ashwin Rao
 

Similar to The Next Great Functional Programming Language (20)

Introduction to Functional Languages
Introduction to Functional LanguagesIntroduction to Functional Languages
Introduction to Functional Languages
 
Five Languages in a Moment
Five Languages in a MomentFive Languages in a Moment
Five Languages in a Moment
 
Haskell - Being lazy with class
Haskell - Being lazy with classHaskell - Being lazy with class
Haskell - Being lazy with class
 
FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳
 
Is there a perfect data-parallel programming language? (Experiments with More...
Is there a perfect data-parallel programming language? (Experiments with More...Is there a perfect data-parallel programming language? (Experiments with More...
Is there a perfect data-parallel programming language? (Experiments with More...
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospective
 
Template Haskell
Template HaskellTemplate Haskell
Template Haskell
 
Morel, a Functional Query Language
Morel, a Functional Query LanguageMorel, a Functional Query Language
Morel, a Functional Query Language
 
Morel, a data-parallel programming language
Morel, a data-parallel programming languageMorel, a data-parallel programming language
Morel, a data-parallel programming language
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids Applied
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming ii
 
Scala for curious
Scala for curiousScala for curious
Scala for curious
 
Fp in scala part 1
Fp in scala part 1Fp in scala part 1
Fp in scala part 1
 
Functional Programming by Examples using Haskell
Functional Programming by Examples using HaskellFunctional Programming by Examples using Haskell
Functional Programming by Examples using Haskell
 
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...
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
 
Functional perl
Functional perlFunctional perl
Functional perl
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
 
The Fuss about || Haskell | Scala | F# ||
The Fuss about || Haskell | Scala | F# ||The Fuss about || Haskell | Scala | F# ||
The Fuss about || Haskell | Scala | F# ||
 
08. haskell Functions
08. haskell Functions08. haskell Functions
08. haskell Functions
 

More from John De Goes

Refactoring Functional Type Classes
Refactoring Functional Type ClassesRefactoring Functional Type Classes
Refactoring Functional Type ClassesJohn De Goes
 
Error Management: Future vs ZIO
Error Management: Future vs ZIOError Management: Future vs ZIO
Error Management: Future vs ZIOJohn De Goes
 
Atomically { Delete Your Actors }
Atomically { Delete Your Actors }Atomically { Delete Your Actors }
Atomically { Delete Your Actors }John De Goes
 
Scalaz Stream: Rebirth
Scalaz Stream: RebirthScalaz Stream: Rebirth
Scalaz Stream: RebirthJohn De Goes
 
Scalaz Stream: Rebirth
Scalaz Stream: RebirthScalaz Stream: Rebirth
Scalaz Stream: RebirthJohn De Goes
 
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional ProgrammingZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional ProgrammingJohn De Goes
 
Streams for (Co)Free!
Streams for (Co)Free!Streams for (Co)Free!
Streams for (Co)Free!John De Goes
 
Getting Started with PureScript
Getting Started with PureScriptGetting Started with PureScript
Getting Started with PureScriptJohn De Goes
 
SlamData - How MongoDB Is Powering a Revolution in Visual Analytics
SlamData - How MongoDB Is Powering a Revolution in Visual AnalyticsSlamData - How MongoDB Is Powering a Revolution in Visual Analytics
SlamData - How MongoDB Is Powering a Revolution in Visual AnalyticsJohn De Goes
 
The Dark Side of NoSQL
The Dark Side of NoSQLThe Dark Side of NoSQL
The Dark Side of NoSQLJohn De Goes
 
Quirrel & R for Dummies
Quirrel & R for DummiesQuirrel & R for Dummies
Quirrel & R for DummiesJohn De Goes
 
In-Database Predictive Analytics
In-Database Predictive AnalyticsIn-Database Predictive Analytics
In-Database Predictive AnalyticsJohn De Goes
 
Analytics Maturity Model
Analytics Maturity ModelAnalytics Maturity Model
Analytics Maturity ModelJohn De Goes
 
Rise of the scientific database
Rise of the scientific databaseRise of the scientific database
Rise of the scientific databaseJohn De Goes
 

More from John De Goes (16)

Refactoring Functional Type Classes
Refactoring Functional Type ClassesRefactoring Functional Type Classes
Refactoring Functional Type Classes
 
Error Management: Future vs ZIO
Error Management: Future vs ZIOError Management: Future vs ZIO
Error Management: Future vs ZIO
 
Atomically { Delete Your Actors }
Atomically { Delete Your Actors }Atomically { Delete Your Actors }
Atomically { Delete Your Actors }
 
Scalaz Stream: Rebirth
Scalaz Stream: RebirthScalaz Stream: Rebirth
Scalaz Stream: Rebirth
 
Scalaz Stream: Rebirth
Scalaz Stream: RebirthScalaz Stream: Rebirth
Scalaz Stream: Rebirth
 
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional ProgrammingZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
 
ZIO Queue
ZIO QueueZIO Queue
ZIO Queue
 
Streams for (Co)Free!
Streams for (Co)Free!Streams for (Co)Free!
Streams for (Co)Free!
 
Getting Started with PureScript
Getting Started with PureScriptGetting Started with PureScript
Getting Started with PureScript
 
SlamData - How MongoDB Is Powering a Revolution in Visual Analytics
SlamData - How MongoDB Is Powering a Revolution in Visual AnalyticsSlamData - How MongoDB Is Powering a Revolution in Visual Analytics
SlamData - How MongoDB Is Powering a Revolution in Visual Analytics
 
The Dark Side of NoSQL
The Dark Side of NoSQLThe Dark Side of NoSQL
The Dark Side of NoSQL
 
Quirrel & R for Dummies
Quirrel & R for DummiesQuirrel & R for Dummies
Quirrel & R for Dummies
 
In-Database Predictive Analytics
In-Database Predictive AnalyticsIn-Database Predictive Analytics
In-Database Predictive Analytics
 
Analytics Maturity Model
Analytics Maturity ModelAnalytics Maturity Model
Analytics Maturity Model
 
Rise of the scientific database
Rise of the scientific databaseRise of the scientific database
Rise of the scientific database
 
Fun with automata
Fun with automataFun with automata
Fun with automata
 

Recently uploaded

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 

Recently uploaded (20)

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 

The Next Great Functional Programming Language

  • 1. The Next Great Functional Programming Language (OK, not really.) John A. De Goes — @jdegoes
  • 2. ML - 1973 Haskell - 19901 OCaml - 19962 2 Or 1987 if you count Caml. 1 Or 1985 if you count Miranda.
  • 5. Our Best FPLs Suffer from Decades Worth of Accretion
  • 6. Individual Features were Designed, but the FPLs Came Into Existence
  • 7. What Would a Designed FPL Look Like Today?
  • 8. ?
  • 9. !
  • 11. My Ideal FPL 4 Pattern Matching 4 Records 4 Modules 4 Syntax 4 Type Classes 4 Nominative Typing 4 Data 4 Recursion
  • 13. Pattern Matching import Lens.Family.Total import Lens.Family.Stock total :: Either Char Int -> String -- Same as: total = _case -- total = case & on _Left (c -> replicate 3 c ) -- Left c -> replicate 3 c & on _Right (n -> replicate n '!') -- Right n -> replicate n '!'
  • 15. Records val book = ("author" ->> "Benjamin Pierce") :: ("title" ->> "Types and Programming Languages") :: ("id" ->> 262162091) :: ("price" ->> 44.11) :: HNil scala> book("author") // Note result type ... res0: String = Benjamin Pierce scala> val extended = book + ("inPrint" ->> true) // Add a new field extended: ... complex type elided ... = Benjamin Pierce :: Types and Programming Languages :: 262162091 :: 46.11 :: true :: HNil scala> val noId = extended - "id" // Removed a field noId: ... complex type elided ... = Benjamin Pierce :: Types and Programming Languages :: 46.11 :: true :: HNil
  • 17. Modules structure ListStack :> STACK = struct type t = 'a list [...] end
  • 18. Modules data Stack f = Stack { makeNew :: forall a. f a, push :: forall a. a -> f a -> f a, pop :: forall a. f a -> Maybe (Tuple a (f a)) } doSomeStackStuff :: forall f. Stack f -> Thing
  • 19. Modules data Stack f = Stack { makeNew :: forall a. f a, push :: forall a. a -> f a -> f a, pop :: forall a. f a -> Maybe (Tuple a (f a)) } data ReservationSystem f = ReservationSystem (forall g. Stack g -> { ... })
  • 21. Syntax Let's stop pretending programs are strings of ASCII characters. 4 implicits 4 order of function parameters / application 4 compiler errors 4 funky looking operators 4 scopes 4 Haskell-style (fake) modules & imports 4 name clashes 4 information elision 4 ...
  • 23. Type Classes Just 'records' with compiler-enforced laws.3 3 Type classes also add an implicitly applied (a : Type) -> TypeClass a function that's piecewise- defined, but that's just syntax.
  • 25. Partiality If it's partial, it's not a &^@#% function.
  • 27. Nominative Typing data Email = Email String data DOMId = DOMId String data Positive = Positive Float data Negative = Negative Float data DressSize = DressSize Float
  • 28. Nominative Typing data ??? = ??? String data ??? = ??? String data ??? = ??? Float data ??? = ??? Float data ??? = ??? Float
  • 29. Let's Stop Pretending Differences in Names Actually Matter
  • 30. Nominative Typing Let's play a guessing game. data ??? = ??? -- {v: Float | v > 0} data ??? = ??? -- {v: Float | v < 0}
  • 32. Data Data: Bits-based description. data Either a b = Left a | Right b struct either { int tag; union { void *left; void *right; }; };
  • 33. Data Newbies: addicted to pattern matching. data List a = Nil | Cons a (List a) doSomething :: forall a. List a -> Int doSomething Nil = 0 doSomething (Cons _ l) = 1 + doSomething l
  • 34. Data Pros: addicted to folds. fold :: forall z a. z -> (z -> a -> z) -> List a -> z fold z _ Nil = z fold z f (Cons a l) = fold (f z a) l
  • 35. Data Folds: Capability-based description. fold :: forall z a. z -> (z -> a -> z) -> List a -> z data List a = List (forall z. z -> (z -> a -> z) -> z)
  • 36. Data data List a = List (forall z. z -> (z -> a -> z) -> z) nil = z f -> z cons a (List as) = z f -> as (f a z) f Array? Linked List? Vector? Skip List?4 4 Strictly more powerful than a data List (pros & cons).
  • 38. Recursion Goto of functional programming.5 f x = if x / 2 > x then g (2 * x) else 42 g x = if x % 1 == 0 then f (g (x + 1)) else h (x - 1) h x = if x % 1 == 1 then f (x * 2 + 1) else g (x + 1) 5 What's hard for a machine|human to understand is also hard for a human|machine to understand.
  • 40. Recursion Coinduction -> State Machines. type Machine s a b = (s, (s, a) -> (s, b)) 6 6 Except this is too weakly typed.
  • 42. My Ideal FPL Layered like an onion. 4 Turing incomplete for 99% of program 4 Prove / optimize more 4 Turing complete 'driver' 4 Prove / optimize less 4 Possibly in a different language (e.g. Haskell)
  • 43. My Ideal FPL Structured editor. 4 Friendly FP 4 Destroys motivation for most language 'features'
  • 44. My Ideal FPL All the things are values. 4 Math functions 4 Abolish incidental complexity 4 Abolish artificial distinctions
  • 45. My Ideal FPL Proof search. 4 Turing complete 4 Levels of proof 1. Proven true 2. Evidence for truth but not proven true 3. Proven false (in general or by counterexample) 4 Massive, persistent proof databases 4 Cross-disciplinary research 4 e.g. deep learning to accelerate proof search
  • 46. My Ideal FPL Zero cost abstraction. 4 As long as we're shooting for the moon 4 (But genuinely easier w/o recursion/data)
  • 47. Inspirations 4 Unison Programming Language7 4 LiquidHaskell8 4 Morte9 9 http://www.haskellforall.com/2014/09/morte-intermediate-language-for-super.html 8 http://goto.ucsd.edu/~rjhala/liquid/haskell/blog/ 7 http://unisonweb.org
  • 48. THANK YOU John A. De Goes — @jdegoes