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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Kārlis Lauva
August 17, 2016
Programming
87
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
82
Two Scoops of Scala
karlis
0
120
Valsts pārvaldes atvērto datu semantiskās integrācijas procesi
karlis
1
200
Tornado in 1 Hour (or Less)
karlis
4
200
Other Decks in Programming
See All in Programming
CSC307 Lecture 17
javiergs
PRO
0
290
Old Dog, New Tricks: The Java 25 Reinvention - JNation
bazlur_rahman
0
140
Oxlintのカスタムルールの現況
syumai
5
910
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
180
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3k
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
1.4k
Oxcを導入して開発体験が向上した話
yug1224
4
260
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
280
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
410
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
320
TSKaigi 2026 TypeScriptバックエンドのオブザーバビリティ戦略 — Datadog × NestJSの実践
taiseiyamamotoan
1
210
ReactとSvelteのその先、Ripple-TS / Beyond React and Svelte: Ripple-TS
ssssota
3
1.8k
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
190
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
200
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
710
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
320
Navigating Team Friction
lara
192
16k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
520
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
190
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
130
Google's AI Overviews - The New Search
badams
0
1k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
150
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