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
320
Other Decks in Technology
See All in Technology
システムのアラート調査をサポートするAI Agentの紹介/Introduction to an AI Agent for System Alert Investigation
taddy_919
2
1.9k
インフラエンジニア必見!Kubernetesを用いたクラウドネイティブ設計ポイント大全
daitak
0
330
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
SREが向き合う大規模リアーキテクチャ 〜信頼性とアジリティの両立〜
zepprix
0
400
ブロックテーマでサイトをリニューアルした話 / 2026-01-31 Kansai WordPress Meetup
torounit
0
450
Webhook best practices for rock solid and resilient deployments
glaforge
1
270
Tebiki Engineering Team Deck
tebiki
0
24k
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
170
IaaS/SaaS管理における SREの実践 - SRE Kaigi 2026
bbqallstars
4
1.7k
なぜ今、コスト最適化(倹約)が必要なのか? ~AWSでのコスト最適化の進め方「目的編」~
htan
1
110
GitLab Duo Agent Platform × AGENTS.md で実現するSpec-Driven Development / GitLab Duo Agent Platform × AGENTS.md
n11sh1
0
120
AIと新時代を切り拓く。これからのSREとメルカリIBISの挑戦
0gm
0
780
Featured
See All Featured
Done Done
chrislema
186
16k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
140
Skip the Path - Find Your Career Trail
mkilby
0
53
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Ruling the World: When Life Gets Gamed
codingconduct
0
140
Information Architects: The Missing Link in Design Systems
soysaucechin
0
770
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Designing for Timeless Needs
cassininazir
0
130
HDC tutorial
michielstock
1
360
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
120
Accessibility Awareness
sabderemane
0
49
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.1k
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?