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
PureScript.tw Meetup 2: Tutorial 2
Search
Ray Shih
April 28, 2017
Technology
0
74
PureScript.tw Meetup 2: Tutorial 2
Range: Ch6 of the book PureScript by Example
Ray Shih
April 28, 2017
Tweet
Share
More Decks by Ray Shih
See All by Ray Shih
From React To PureScript
rayshih
0
310
Other Decks in Technology
See All in Technology
Observability — Extending Into Incident Response
nari_ex
2
740
AI時代の発信活動 ~技術者として認知してもらうための発信法~ / 20251028 Masaki Okuda
shift_evolve
PRO
1
140
今から間に合う re:Invent 準備グッズと現地の地図、その他ラスベガスを周る際の Tips/reinvent-preparation-guide
emiki
1
230
設計に疎いエンジニアでも始めやすいアーキテクチャドキュメント
phaya72
24
16k
新米エンジニアをTech Leadに任命する ー 成長を支える挑戦的な人と組織のマネジメント
naopr
1
340
今のコンピュータ、AI にも Web にも 向いていないので 作り直そう!!
piacerex
0
420
dbtとAIエージェントを組み合わせて見えたデータ調査の新しい形
10xinc
7
1.7k
戦えるAIエージェントの作り方
iwiwi
20
9.9k
マルチエージェントのチームビルディング_2025-10-25
shinoyamada
0
240
OPENLOGI Company Profile for engineer
hr01
1
46k
様々なファイルシステム
sat
PRO
0
290
オブザーバビリティと育てた ID管理・認証認可基盤の歩み / The Journey of an ID Management, Authentication, and Authorization Platform Nurtured with Observability
kaminashi
2
1.6k
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
192
56k
Code Reviewing Like a Champion
maltzj
526
40k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
For a Future-Friendly Web
brad_frost
180
10k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Speed Design
sergeychernyshev
32
1.2k
Testing 201, or: Great Expectations
jmmastey
46
7.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
54k
RailsConf 2023
tenderlove
30
1.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.8k
Transcript
PureScript Tutorial 2 Ray Shih
Chapter 6~ See how far we can go
Chapter 6: Type Classes • Similar to Java interface •
Show • Monoid, Foldable -> foldMap • Functor • Function constraint • Multi Parameter Type Classes • Nullary Type Class • Superclass
The Class & The Instance
Instance Dependencies
Common type classes
Semigroup, Monoid
Foldable
Functor
Function is a Functor!!! What?
Multi Parameter type class
Nullary type class
Congratulation! That’s all!
Congratulation! That’s all…. the syntax you need (almost)
Challenge! • Try to create a function `printf` which can
print out arbitrary number of arguments • printf “Hello” “World” • printf “a = “ 3 • printf a “ + “ b “ = “ (a + b)
Chapter 7: Applicative Validation • Control.Apply, lift3 on Maybe •
type class Apply • type class Applicative • Maybe -> Either: withError • combineList • purescript-validation (skip) • Traversable Functor • Parallelism
Control.Apply
type class Apply
instance applyMaybe
type class Applicative
Revisit lift3
Maybe -> Either withError
withError example
combineList
Traversable Functor
Parallelism
Chapter 8: The Eff Monad • Do notation revisited •
XML traverse • The Monad Type Class • Monad Law (skip) • Folding With Monads • Monads and Applicative • Eff Monad
Do notation
XML traverse
The Monad Type Class
Monad instances
What `do` really do?
Reveal the XML parsing example
Folding with Monads
Folding with Monad example
FoldM exercise • (Medium) Write a function sums which uses
foldM to determine all possible totals that could be made using a set of coins. The coins will be specified as an array which contains the value of each coin. Your function should have the following result.
Monads and Applicatives • Of course, Monad is a Applicative
• But Monad is more than Applicative
Eff Monad
The type of Eff
Fine-Grained Effects
Next? • Frontend Pux? • Backend? • React Native? •
Chapter 11: Monadic Adventures? • Lenses? • PureScript 24 days?