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
_第4回__AIxIoTビジネス共創ラボ紹介資料_20251203.pdf
iotcomjpadmin
0
160
Bedrock AgentCore Evaluationsで学ぶLLM as a judge入門
shichijoyuhi
2
300
MySQLのSpatial(GIS)機能をもっと充実させたい ~ MyNA望年会2025LT
sakaik
0
180
Building Serverless AI Memory with Mastra × AWS
vvatanabe
1
820
スクラムマスターが スクラムチームに入って取り組む5つのこと - スクラムガイドには書いてないけど入った当初から取り組んでおきたい大切なこと -
scrummasudar
0
160
Keynoteから見るAWSの頭の中
nrinetcom
PRO
1
150
TED_modeki_共創ラボ_20251203.pdf
iotcomjpadmin
0
180
AWSの新機能をフル活用した「re:Inventエージェント」開発秘話
minorun365
2
520
AgentCoreとStrandsで社内d払いナレッジボットを作った話
motojimayu
1
1.2k
テストセンター受験、オンライン受験、どっちなんだい?
yama3133
0
200
松尾研LLM講座2025 応用編Day3「軽量化」 講義資料
aratako
14
4.7k
Strands AgentsのEvaluatorをLangfuseにぶち込んでみた
andoooooo_bb
0
110
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
21k
The agentic SEO stack - context over prompts
schlessera
0
570
Utilizing Notion as your number one productivity tool
mfonobong
2
190
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
How to make the Groovebox
asonas
2
1.9k
30 Presentation Tips
portentint
PRO
1
180
Heart Work Chapter 1 - Part 1
lfama
PRO
3
35k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
37
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
54
48k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
79
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?