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
Haskell の型クラスと Typeclassopedia の紹介 #w8lt
Search
Shohei Yasutake
December 16, 2015
Programming
0
480
Haskell の型クラスと Typeclassopedia の紹介 #w8lt
Shohei Yasutake
December 16, 2015
Tweet
Share
More Decks by Shohei Yasutake
See All by Shohei Yasutake
Erlang 事例紹介: メディアストリーム中継システム
amutake
0
420
部屋のメトリクス可視化
amutake
0
720
Actario: A Framework for Reasoning About Actor Systems
amutake
0
680
Coqの紹介 #w8lt
amutake
0
340
🍣 #w8lt
amutake
2
500
代数的データ型について #w8lt
amutake
6
2.4k
Coq で証明付き Web アプリを作る #adf2015
amutake
2
890
FLL
amutake
1
1.4k
Other Decks in Programming
See All in Programming
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
330
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
110
プロダクトの品質に コミットする / Commit to Product Quality
pekepek
2
760
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
160
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
420
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
120
N.E.X.T LEVEL
pluu
2
290
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
180
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
160
Refactor your code - refactor yourself
xosofox
1
230
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
230
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.2k
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Side Projects
sachag
452
42k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Building Adaptive Systems
keathley
38
2.3k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Faster Mobile Websites
deanohume
305
30k
Making Projects Easy
brettharned
116
5.9k
Documentation Writing (for coders)
carmenintech
66
4.5k
A designer walks into a library…
pauljervisheath
204
24k
Transcript
)BTLFMMͷܕΫϥεͱ 5ZQFDMBTTPQFEJBͷհ 8-5 !BNVUBLF@T
ܕΫϥε ܕʹڞ௨͢Δੑ࣭Λൈ͖ग़ͨ͠ͷ ΦϒδΣΫτࢦͷΫϥεͱҧ͏ͷͰҙ ܕΫϥε͍Ζ͍ΖͳݴޠͰ͑Δ ͜ͷεϥΠυͰ)BTLFMMΛ͏
ྫ &RΫϥεҙͷͭͷʹ͍͍͔ͭͯ͘͠͠ͳ ͍͔Θ͔Δ 0SEΫϥεҙͷͭͷʹ͍ͭͯॱংΛ͚ͭΒΕΔ 4IPXΫϥεจࣈྻʹมͰ͖Δ
ܕΫϥε *OU 'MPBU 3BUJPOBM %PVCMF
ܕΫϥε *OU 'MPBU 3BUJPOBM %PVCMF /VN 'MPBUJOH 'SBDUJPOBM ͋·Γ͍͍ྫ͡Όͳ͍͚Ͳ
ܕΫϥεͷఆٛ class Eq a => Ord a where compare ::
a -> a -> Ordering (<=) :: a -> a -> Bool (<) :: a -> a -> Bool ... ʮܕΫϥε0SEͱ͍͏໊લͰ͢ʯ ʮBͱ͍͏ܕ ม ʹ͍ͭͯҎԼͷ ؔΛ࣮͍ͯͩ͘͠͞ʯ ʮB͕&RͰ͋Δ͜ͱ Λཁٻ͠·͢ʯ ʮ͜ΕΒͷܕΛ࣋ͭؔ ϝιου Λ࣮͍ͯͩ͘͠͞ʯ NJOJNBMDPNQMFUFEFpOJUJPO͕͋Δ߹ͦΕ͚࣮ͩ͢Ε͍͍
Πϯελϯεએݴ instance Ord Bool where True <= False = False
_ <= _ = True ʮ#PPMܕΛ0SEͷΠϯελϯεʹ͠·͢ʯ ʮ ͱ͍͏ؔͷ࣮Ͱ͢ʯ ʮ0SEͷ.JOJNBMDPNQMFUFEFpOJUJPO DPNQBSF·ͨ ͳͷͰ͜ΕͰऴΘΓͰ͢ʯ
ܕΫϥεΛͬͨؔ sort :: Ord a => [a] -> [a] sort
= ... ʮ0SEͷੑ࣭Λ͏ͷͰɺܕมB 0SEͷΠϯελϯεͰͳ͚Ε͍͚·ͤΜɻ Ͱ0SEͰ͋ΕͲΜͳܕͰେৎʯ
ܕΫϥεͷخ͠͞ ࣗͰ࡞ͬͨܕΛͳʹ͔ͷܕΫϥεͷΠϯελϯεʹ͢Δ ˠͦͷܕΫϥεʹ͍ͭͯఆٛͯ͋͠Δ͕ؔλμͰ͑ ΔΑ͏ʹͳΔ ྫࣗ࡞ͷܕΛ.POBEͷΠϯελϯεʹ͢Δ Λ࣮͢Δ
ͱɺ$POUSPM.POBEϞδϡʔϧʹఆٛ͞ Ε͍ͯΔ͚ؔͩͰݸͷ͕ؔ͑ΔΑ͏ʹͳΔ Կ͔ͷܕΫϥεʹ͍ͭͯͷؔΛ࡞Δ ˠͦͷܕΫϥεͷΠϯελϯεʹͳ͍ͬͯΔͯ͢ͷܕ Ͱͦͷ͕ؔ͑ΔΑ͏ʹͳΔ CBTF
5ZQFDMBTTPQFEJBͱ )BTLFMMͷجຊతͳܕΫϥεͷղઆهࣄ )BTLFMMͰ͍Ζ͍ΖͳܕͱܕΫϥεʹ׳ΕΔ ͜ͱ͕ͱͯॏཁ IUUQTXJLJIBTLFMMPSH5ZQFDMBTTPQFEJB ܕΫϥεͷґଘؔ
հ͞Ε͍ͯΔܕΫϥε 'VODUPS "QQMJDBUJWF .POBE .POBE5SBOT .POBE'JY 4FNJHSPVQ .POPJE
'PMEBCMF 5SBWFSTBCMF $BUFHPSZ "SSPX $PNPOBE Ұ֮ͭ͑Δ͝ͱʹͰ͖Δ͜ͱ͕͕Δ 'VODUPS "QQMJDBUJWF .POBE .POBE5SBOT͘ Β͍·ͰΔͱ͍ͩͿ͍Ζ͍ΖͰ͖ΔΑ͏ʹͳΔ lThere is no royal road to Haskell.zͱ͍͏ϢʔΫ Ϧουͷ༗໊ͳݴ༿͕͋Δͬͯ5ZQFDMBTTPQFEJBʹॻ͍ͯΔ ࣌
ཧղͷͨΊͷ৺ߏ͑ ˞͜ΕΒݸਓతͳҙݟͰ͢ આ໌ΛಡΜͰ͏Μ͏ΜᄬΔΑΓͱΓ͍͋͑ͣΖ͍ΖͳΠϯε λϯεΛͬͯΈͯ׳ΕΔͷ͕Ұ൪͍͍ͱࢥ͏ .POBEͳͲͷΠϝʔδΛߟ͑͡ΊΔͱυπϘʹ·ΔՄ ೳੑ͕͋ΔͷͰɺܕͱίʔυ͚ͩΈͯߟ͑Δ
ܕΫϥεͷϝιου͚ͩݟΔΑΓݸʑͷΠϯελϯεͷఆٛ ΛΈͯߟ͑Δ 'VODUPS.POBEͨͩͷܕΫϥεɻগ͠ܕ͕ෳࡶͳͩ ͚Ͱ&R0SEͱಉ͡ ͏͚ͩͳΒݍΒͳͯ͘େৎ
༨ஊ ͖࣋ͭੑ࣭Λຬͨ͞ͳ͍Α͏ͳΠϯελϯε࡞ΕΔ ੑ࣭Λຬ͍ͨͯ͠Δ͜ͱΛલఏͱ͢Δ͕ؔյΕΔ ͦ͠ ͯؾ͖ͮʹ͍͘ ϞφυଇΛຬ͍ͨͯ͠ͳ͍Ϟφυͱ͔؆୯ʹ࡞ΕΔ
ੑ࣭Λຬ͍ͨͯ͠ͳ͍ͱΠϯελϯεΛ࡞Εͳ͍Α͏ʹͨ͠ ͍ ˠ$PRͱ͔*ESJTͱ͔͑Ͱ͖·͢ ϝιουͷܕͷͱ͜Ζʹ໋Λॻ͘ )BTLFMMͰͰ͖Δʁ ࠷ۙͷ()$ͷܕϨϕϧࣄΛ͋ ·ΓΒͳ͍
·ͱΊ ܕΫϥεͱ͍͏ػೳʹ͍ͭͯ؆୯ʹઆ໌͠·͠ ͨ 5ZQFDMBTTPQFEJBͱ͍͏ओཁͳܕΫϥεͷղઆ هࣄΛհ͠·ͨ͠ ͱΓ͋͑ͣͬͯΈͯ׳ΕΔͷ͕͍͍ͱࢥ͍· ͢