SlideShare a Scribd company logo
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 (20)

PDF
Scalaz 8: A Whole New Game
John De Goes
 
PDF
Big picture of category theory in scala with deep dive into contravariant and...
Piotr Paradziński
 
PDF
The Death of Final Tagless
John De Goes
 
PDF
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
John De Goes
 
PDF
Functor, Apply, Applicative And Monad
Oliver Daff
 
PDF
Contravariant functors in scala
Piotr Paradziński
 
PDF
Advanced Tagless Final - Saying Farewell to Free
Luka Jacobowitz
 
PDF
The Design of the Scalaz 8 Effect System
John De Goes
 
PDF
One Monad to Rule Them All
John De Goes
 
PDF
GUL UC3M - Introduction to functional programming
David Muñoz Díaz
 
PDF
T3chFest 2016 - The polyglot programmer
David Muñoz Díaz
 
PDF
Core csharp and net quick reference
ilesh raval
 
PDF
Introduction to functional programming using Ocaml
pramode_ce
 
PDF
O caml2014 leroy-slides
OCaml
 
PDF
Monoids, Monoids, Monoids - ScalaLove 2020
Luka Jacobowitz
 
PDF
Scalaz 8 vs Akka Actors
John De Goes
 
PDF
Testing in the World of Functional Programming
Luka Jacobowitz
 
PDF
Why functional programming and category theory strongly matters
Piotr Paradziński
 
PDF
Why Haskell
Susan Potter
 
PDF
Principled Error Handling with FP
Luka Jacobowitz
 
Scalaz 8: A Whole New Game
John De Goes
 
Big picture of category theory in scala with deep dive into contravariant and...
Piotr Paradziński
 
The Death of Final Tagless
John De Goes
 
Blazing Fast, Pure Effects without Monads — LambdaConf 2018
John De Goes
 
Functor, Apply, Applicative And Monad
Oliver Daff
 
Contravariant functors in scala
Piotr Paradziński
 
Advanced Tagless Final - Saying Farewell to Free
Luka Jacobowitz
 
The Design of the Scalaz 8 Effect System
John De Goes
 
One Monad to Rule Them All
John De Goes
 
GUL UC3M - Introduction to functional programming
David Muñoz Díaz
 
T3chFest 2016 - The polyglot programmer
David Muñoz Díaz
 
Core csharp and net quick reference
ilesh raval
 
Introduction to functional programming using Ocaml
pramode_ce
 
O caml2014 leroy-slides
OCaml
 
Monoids, Monoids, Monoids - ScalaLove 2020
Luka Jacobowitz
 
Scalaz 8 vs Akka Actors
John De Goes
 
Testing in the World of Functional Programming
Luka Jacobowitz
 
Why functional programming and category theory strongly matters
Piotr Paradziński
 
Why Haskell
Susan Potter
 
Principled Error Handling with FP
Luka Jacobowitz
 

Similar to The Next Great Functional Programming Language (20)

PDF
Introduction to Functional Languages
suthi
 
KEY
Five Languages in a Moment
Sergio Gil
 
PDF
Haskell - Being lazy with class
Tiago Babo
 
PDF
FP in scalaで鍛える関数型脳
Yuri Inoue
 
PDF
Is there a perfect data-parallel programming language? (Experiments with More...
Julian Hyde
 
PPT
Haskell retrospective
chenge2k
 
PDF
Template Haskell
Sergey Stretovich
 
PDF
Morel, a Functional Query Language
Julian Hyde
 
PDF
Morel, a data-parallel programming language
Julian Hyde
 
PDF
Is Haskell an acceptable Perl?
osfameron
 
PDF
Functional Algebra: Monoids Applied
Susan Potter
 
PDF
Functional programming ii
Prashant Kalkar
 
PPTX
Scala for curious
Tim (dev-tim) Zadorozhniy
 
PDF
Fp in scala part 1
Hang Zhao
 
PDF
Functional Programming by Examples using Haskell
goncharenko
 
PDF
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
Philip Schwarz
 
ODP
Functional perl
Errorific
 
PPTX
Scala - where objects and functions meet
Mario Fusco
 
PDF
The Fuss about || Haskell | Scala | F# ||
Ashwin Rao
 
PDF
08. haskell Functions
Sebastian Rettig
 
Introduction to Functional Languages
suthi
 
Five Languages in a Moment
Sergio Gil
 
Haskell - Being lazy with class
Tiago Babo
 
FP in scalaで鍛える関数型脳
Yuri Inoue
 
Is there a perfect data-parallel programming language? (Experiments with More...
Julian Hyde
 
Haskell retrospective
chenge2k
 
Template Haskell
Sergey Stretovich
 
Morel, a Functional Query Language
Julian Hyde
 
Morel, a data-parallel programming language
Julian Hyde
 
Is Haskell an acceptable Perl?
osfameron
 
Functional Algebra: Monoids Applied
Susan Potter
 
Functional programming ii
Prashant Kalkar
 
Scala for curious
Tim (dev-tim) Zadorozhniy
 
Fp in scala part 1
Hang Zhao
 
Functional Programming by Examples using Haskell
goncharenko
 
N-Queens Combinatorial Problem - Polyglot FP for Fun and Profit - Haskell and...
Philip Schwarz
 
Functional perl
Errorific
 
Scala - where objects and functions meet
Mario Fusco
 
The Fuss about || Haskell | Scala | F# ||
Ashwin Rao
 
08. haskell Functions
Sebastian Rettig
 
Ad

More from John De Goes (16)

PDF
Refactoring Functional Type Classes
John De Goes
 
PDF
Error Management: Future vs ZIO
John De Goes
 
PDF
Atomically { Delete Your Actors }
John De Goes
 
PDF
Scalaz Stream: Rebirth
John De Goes
 
PDF
Scalaz Stream: Rebirth
John De Goes
 
PDF
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
John De Goes
 
PDF
ZIO Queue
John De Goes
 
PDF
Streams for (Co)Free!
John De Goes
 
PDF
Getting Started with PureScript
John De Goes
 
PPTX
SlamData - How MongoDB Is Powering a Revolution in Visual Analytics
John De Goes
 
PPTX
The Dark Side of NoSQL
John De Goes
 
PDF
Quirrel & R for Dummies
John De Goes
 
PDF
In-Database Predictive Analytics
John De Goes
 
PDF
Analytics Maturity Model
John De Goes
 
PDF
Rise of the scientific database
John De Goes
 
PDF
Fun with automata
John De Goes
 
Refactoring Functional Type Classes
John De Goes
 
Error Management: Future vs ZIO
John De Goes
 
Atomically { Delete Your Actors }
John De Goes
 
Scalaz Stream: Rebirth
John De Goes
 
Scalaz Stream: Rebirth
John De Goes
 
ZIO Schedule: Conquering Flakiness & Recurrence with Pure Functional Programming
John De Goes
 
ZIO Queue
John De Goes
 
Streams for (Co)Free!
John De Goes
 
Getting Started with PureScript
John De Goes
 
SlamData - How MongoDB Is Powering a Revolution in Visual Analytics
John De Goes
 
The Dark Side of NoSQL
John De Goes
 
Quirrel & R for Dummies
John De Goes
 
In-Database Predictive Analytics
John De Goes
 
Analytics Maturity Model
John De Goes
 
Rise of the scientific database
John De Goes
 
Fun with automata
John De Goes
 
Ad

Recently uploaded (20)

PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
Executive Business Intelligence Dashboards
vandeslie24
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Import Data Form Excel to Tally Services
Tally xperts
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 

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