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 でつくる VM 〜散りゆく Endomorphism〜
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
taiki45
May 11, 2014
Programming
1.3k
6
Share
Haskell でつくる VM 〜散りゆく Endomorphism〜
関数型LT大会の LT です
http://connpass.com/event/5795/
taiki45
May 11, 2014
More Decks by taiki45
See All by taiki45
Mocking in Rust Applications
taiki45
2
750
Error Handling in Rust Applications
taiki45
3
840
Efficient Platform for Security and Compliance
taiki45
6
1.7k
RustでAWS Lambda functionをいい感じに書く
taiki45
2
840
SPIFFE Meetup Tokyo #2 LT: Envoy SDS
taiki45
0
840
builderscon Tokyo 2019: Intro Service Mesh
taiki45
6
3.7k
NoOps Meetup Tokyo #7: 入門サービスメッシュ
taiki45
4
2k
CloudNative Days Tokyo 2019: Understanding Envoy
taiki45
3
3.6k
Cloud Native Meetup Tokyo #8 ServiceMesh Day Recap
taiki45
2
420
Other Decks in Programming
See All in Programming
ハーネスエンジニアリングとは?
kinopeee
13
6.8k
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
450
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
220
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
2.8k
Building on Bluesky's AT Protocol with Ruby
mackuba
0
110
cloudnative conference 2026 flyle
azihsoyn
0
110
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
28
19k
継続的な負荷検証を目指して
pyama86
0
330
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
120
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
3
710
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.6k
過去のレビュー知見をSkillsで資産化した話
pkshadeck
PRO
1
1.5k
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
21k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
160
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
280
Thoughts on Productivity
jonyablonski
76
5.1k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
190
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Why Our Code Smells
bkeepers
PRO
340
58k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
350
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
350
How to train your dragon (web standard)
notwaldorf
97
6.6k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Transcript
Haskell Ͱͭ͘Δ VM ʙࢄΓΏ͘ Endomorphisʙ taiki45
ϓϩάϥϛϯάྺ2ͷ
ϖϧγΞޠ͠ΌΔ
͓͔͞ͳ
ε( ε^o^)э
hs-vm Simple Virtual Machine written in Haskell. ! https://github.com/taiki45/hs-vm
Why VM
ܭࢉػͷ ιϑτΣΞ࣮
Register Machine vs Stack Machine
hs-vm has no StateT
Endomorphism
Endomorphism A ࢝ҬͱऴҬ͕ಉ͡ܥͰ͋ΔΑ͏ͳ४ಉܕࣸ૾
Endomorphism A ࢝ҬͱऴҬ͕ಉ͡ू߹Ͱ͋ΔΑ͏ͳؔ
VM ͱ໋ྩ V ͋ΔVMΛߟ͑Δ ͦͷVM͕ͱΔঢ়ଶͷू߹Λ V ͱ͢Δ [1,2] [3] [3,4,5]
VM ͱ໋ྩ V [3,4] [1,2,4] Add
VM ͱ໋ྩ VM ͷ໋ྩ Endomorphism ͱߟ͑ΒΕΔ V
໋ྩͷ߹
Monoid (M, ŋ) m ŋ i = m = i
ŋ m m ŋ (m ŋ m) = (m ŋ m) ŋ m
ਖ਼ͷ (N, ×) 3 × 1 = 3 = 3
× 1 3 × (4 × 5) = (3 × 4) × 5
Ϧετ (L, ++) [1, 2] ++ [] = [1, 2]
= [] ++ [1, 2] [1] ++ ([2] ++ [3]) = ([1] ++ [2]) ++ [3]
Endomorphism as Monoid A id f g f . id
= f = id . f (h . g) . f = h . (g . f) h
VM ͱ໋ྩ V f f: VM → VM f: ॳظঢ়ଶ
→ ऴྃঢ়ଶ
VM ͷ࣮ߦͱ
ͻͱͭͷࣸ૾Λ ୳͢͜ͱͩͬͨΜͩʂ
͋Γ͠ͷ VM ͷ࣮ߦ Dual ର Endo ͷରͦͷ߹ॱং͕ٯ 144c3a3dbdb
݅δϟϯϓ
ݱࡏͷ VM ࣮ߦ V Endo Λॱ࣍ద༻͍ͯ͘͠ελΠϧ ࣍ʹద༻͢Δࣸ૾Λ program counter Λͱʹ୳͢
ֶͼ • ػցޠ(ΞηϯϒϦݴޠ)ͱͷରԠ • call convention