Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Let's talk about PureScript
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kārlis Lauva
August 17, 2016
Programming
84
0
Share
Let's talk about PureScript
Presentation at Frontend Meetup Riga, August 2016.
Kārlis Lauva
August 17, 2016
More Decks by Kārlis Lauva
See All by Kārlis Lauva
Going Full Monty with full.monty
karlis
1
100
The Transatlantic Struggle
karlis
0
78
Two Scoops of Scala
karlis
0
110
Valsts pārvaldes atvērto datu semantiskās integrācijas procesi
karlis
1
200
Tornado in 1 Hour (or Less)
karlis
4
190
Other Decks in Programming
See All in Programming
PHPでバイナリをパースして理解するASN.1
muno92
PRO
0
430
エラー処理の温故知新 / history of error handling technic
ryotanakaya
7
1.9k
Liberating Ruby's Parser from Lexer Hacks
ydah
2
2.6k
🦞OpenClaw works with AWS
licux
1
350
Making the RBS Parser Faster
soutaro
0
680
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
560
ふにゃっとしない名前の付け方 〜哲学で茹で上げる、コシのあるソフトウェア設計〜
shimomura
0
110
Spec-Driven Development with AI Agents (Workshop, May 2026)
antonarhipov
3
330
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
400
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
230
Kingdom of the Machine
yui_knk
2
1.5k
KMP × Kotlin 2.3 - How Android Got Slower While iOS Builds Improved by 47%
rio432
0
160
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.6k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
190
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
550
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
540
Un-Boring Meetings
codingconduct
0
280
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
300
Chasing Engaging Ingredients in Design
codingconduct
0
190
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
180
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
170
The Cult of Friendly URLs
andyhume
79
6.9k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
340
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Transcript
an exciting trip through history prelude
1936 Lambda Calculus is born
1990 A bunch of smart people start working Haskell
1995 Brendan Eich is hired by NetScape to write Scheme
for the browser
Spoiler alert: He doesn't write a Scheme for NetScape
2016
You shouldn't be sad.
Maybe those functional dudes got something right.
let's talk about purescript Kārlis Lauva @skazhy frontend rīga meetup,
2016
Hello. I write Clojure and dabble with other things This
is not a monad tutorial This is, like, my opinion
So, Haskell for the browser, eh
module Main where import Prelude import Control.Monad.Eff import Control.Monad.Eff.Console sup
:: String -> String sup g = "sup, " ++ g main :: forall e. Eff (console :: CONSOLE | e) Unit main = do log $ sup "world"
None
(function(exports) { "use strict"; var Prelude = PS["Prelude"]; var Control_Monad_Eff
= PS["Control.Monad.Eff"]; var Control_Monad_Eff_Console = PS["Control.Monad.Eff.Console"]; var sup = function (g) { return "sup, " + g; }; var main = Control_Monad_Eff_Console.log(sup("world")); exports["main"] = main; exports["sup"] = sup;; })(PS["Main"] = PS["Main"] || {}); PS["Main"].main();
Y
turns out, functional programming languages are really useful for web
things
but javascript too can be purely functional
None
let's discuss the bad parts
[Object object]
an *actual* type system
purescript makes this example boring
like, really boring
sketchy branching
None
None
pattern matching
data Behavior = KillHumans | BeNiceToHumans type Robot = {
naughty :: Boolean } interactWithHumans :: Robot -> Behavior interactWithHumans { naughty: true } = KillHumans interactWithHumans { naughty: false } = BeNiceToHumans
data Behavior = KillAllHumans | BeNiceToHumans | KillOnlyVapers type Robot
= { niceness :: Int } interactWithHumans :: Robot -> Behavior interactWithHumans { niceness: 0 } = KillAllHumans interactWithHumans { niceness: 1 } = KillOnlyVapers interactWithHumans _ = BeNiceToHumans
callback hell
monads
fetchRobots(function(response) { assembleFleet(function(robots) { if (robots) return robots; }, function(error
{ .. }); }, function(error) {... });
data RobotArmy = Army (List Robot) fetchRobots = do robotParts
<- get "/robotParts" robots <- assembleFleet robotParts return $ Army robots
None
does purescript survive in the real world?
yes.
None
ecosystem and tooling
psc short for "purescript compiler"
modules managed via bower
• build tool => pulp • hoogle for purescript =>
pursuit
purescript - javascript teamwork
back to killer robots
data Behavior = KillHumans | BeNiceToHumans instance showBehavior :: Show
Behavior where show KillHumans = "kill all humans11" show BeNiceToHumans = "humans, you are pretty tite" type Robot = { naughty :: Boolean } interactWithHumans :: Robot -> Behavior interactWithHumans { naughty: true } = KillHumans interactWithHumans { naughty: false } = BeNiceToHumans safeInteract :: Boolean -> String safeInteract x = show $ interactWithHumans { crazyMurderer : x }
PS.Main.safeInteract(isCrazyMurderingRobot)();
but will purescript react?
yes.
ok, so what have we learned
so should we all switch to purescript today?
not _all_ of us
most of the internet runs on vanilla javascript just fine
(for years)
None
None
go check it out hack cool things
• purescript.org • karlis.me
thanks