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.4k
6
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
770
Error Handling in Rust Applications
taiki45
3
860
Efficient Platform for Security and Compliance
taiki45
6
1.7k
RustでAWS Lambda functionをいい感じに書く
taiki45
2
860
SPIFFE Meetup Tokyo #2 LT: Envoy SDS
taiki45
0
850
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
430
Other Decks in Programming
See All in Programming
はてなアカウント基盤 State of the Union
cockscomb
1
730
OSもどきOS
arkw
0
590
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
320
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
240
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
620
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
7k
Contextとはなにか
chiroruxx
1
370
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
400
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
950
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
110
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
1
390
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
8.1k
Featured
See All Featured
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
210
How to Think Like a Performance Engineer
csswizardry
28
2.7k
We Have a Design System, Now What?
morganepeng
55
8.2k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
400
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
140
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
First, design no harm
axbom
PRO
2
1.2k
Thoughts on Productivity
jonyablonski
76
5.2k
The untapped power of vector embeddings
frankvandijk
2
1.8k
Code Reviewing Like a Champion
maltzj
528
40k
Ruling the World: When Life Gets Gamed
codingconduct
0
260
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
280
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