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
470
Haskell の型クラスと Typeclassopedia の紹介 #w8lt
Shohei Yasutake
December 16, 2015
Tweet
Share
More Decks by Shohei Yasutake
See All by Shohei Yasutake
Erlang 事例紹介: メディアストリーム中継システム
amutake
0
410
部屋のメトリクス可視化
amutake
0
720
Actario: A Framework for Reasoning About Actor Systems
amutake
0
670
Coqの紹介 #w8lt
amutake
0
340
🍣 #w8lt
amutake
2
500
代数的データ型について #w8lt
amutake
6
2.4k
Coq で証明付き Web アプリを作る #adf2015
amutake
2
880
FLL
amutake
1
1.4k
Other Decks in Programming
See All in Programming
推し活としてのrails new/oshikatsu_ha_iizo
sakahukamaki
3
2k
CSC509 Lecture 09
javiergs
PRO
0
140
Amazon Qを使ってIaCを触ろう!
maruto
0
370
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
430
JavaでLチカしたい! / JJUG CCC 2024 Fall LT
nhayato
0
120
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
250
僕がつくった48個のWebサービス達
yusukebe
20
17k
CSC509 Lecture 11
javiergs
PRO
0
180
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
790
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
390
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
1.5k
Featured
See All Featured
Scaling GitHub
holman
458
140k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
32
1.8k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Documentation Writing (for coders)
carmenintech
65
4.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
820
Fireside Chat
paigeccino
33
3k
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ͱ͍͏ओཁͳܕΫϥεͷղઆ هࣄΛհ͠·ͨ͠ ͱΓ͋͑ͣͬͯΈͯ׳ΕΔͷ͕͍͍ͱࢥ͍· ͢