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
RecordDotSyntaxのあれこれ
Search
lotz
December 11, 2019
Programming
2
990
RecordDotSyntaxのあれこれ
lotz
December 11, 2019
Tweet
Share
More Decks by lotz
See All by lotz
Recursion Schemesで考える並べ替えアルゴリズム
lotz84
6
1.9k
関数と型で理解する自動微分
lotz84
6
2.8k
Other Decks in Programming
See All in Programming
Arm移行タイムアタック
qnighy
0
350
我々のデザインシステムは Chakra v3 にアップデートします
shunya078
2
160
Jakarta EE meets AI
ivargrimstad
0
800
受け取る人から提供する人になるということ
little_rubyist
0
260
as(型アサーション)を書く前にできること
marokanatani
10
2.8k
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
120
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.2k
みんなでプロポーザルを書いてみた
yuriko1211
0
290
Remix on Hono on Cloudflare Workers
yusukebe
1
310
カンファレンスの「アレ」Webでなんとかしませんか? / Conference “thing” Why don't you do something about it on the Web?
dero1to
1
120
Modular Monolith Monorepo ~シンプルさを保ちながらmonorepoのメリットを最大化する~
yuisakamoto
9
990
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Embracing the Ebb and Flow
colly
84
4.5k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Designing the Hi-DPI Web
ddemaree
280
34k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
900
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Transcript
Record Dot Syntax ͷ͋Ε͜Ε By lotz 2019/12/11 ୈ2ճGHCษڧձ @ IIJ-II
RecordDotSyntax https://github.com/shayne-fletcher-da/ghc-proposals/blob/record-dot-syntax/proposals/0000-record-dot-syntax.md#motivation
RecordDotSyntaxͷجຊ https://github.com/shayne-fletcher-da/ghc-proposals/blob/record-dot-syntax/proposals/0000-record-dot-syntax.md#recorddotsyntax-language-extension
RecordDotSyntaxͷੜߏจ https://github.com/shayne-fletcher-da/ghc-proposals/blob/record-dot-syntax/proposals/0000-record-dot-syntax.md#recorddotsyntax-language-extension
Recordվળͷ্ʹ͋Δ ()$֦ு1SPQPTBM ()$7FSTJPO %VQMJDBUF3FDPSE'JFMET 0WFSMPBEFE-BCFMT 0WFSMPBEFE3FDPSE'JFMET "EETFU'JFMEUP)BT'JFME
/P'JFME4FMFDUPST "DDFQUFE 3FDPSE%PU4ZOUBY /&8
DAMLͰͷ࣮͋Γ • DAMLHaskell/ScalaͰ։ൃ͞Ε͍ͯΔɺ εϚʔτίϯτϥΫτهड़ݴޠ • DAMLͷ։ൃʹ͓͍ͯGHC Pluginsͱ͍͏ܗͰ RecordDotSyntaxͱ΄΅ಉ͡ػೳ͕ΘΕ͍ͯΔ
ఏҊͯ͠ΔͷDAMLͷਓ https://github.com/ghc-proposals/ghc-proposals/pull/282
PRͷԠ https://github.com/ghc-proposals/ghc-proposals/pull/282#issuecomment-540968106 *TUSPOHMZTVQQPSUUIFEJSFDUJPOPG USBWFMPGUIJTQSPQPTBM
PRͷԠ 5IFMPTTPGQPMZNPSQIJDVQEBUFJT BIVHFQSPCMFN JNP https://github.com/ghc-proposals/ghc-proposals/pull/282#issuecomment-541111003
PRͷԠ 5IJTQSPQPTBMJTGVMMPGVUUFSOPOTFOTF https://github.com/ghc-proposals/ghc-proposals/pull/282#issuecomment-541460439
> :t (.age) (.age) :: Person -> Int > :t
(. age) (. age) :: (Int -> c) -> Person -> c ۭനͷ༗Γແ͠Ͱ͜͜·Ͱҙຯ͕มΘΔͷ ॳ৺ऀʹ͘͠ͳ͍ʁ
ࠓͷεςʔλε https://github.com/ghc-proposals/ghc-proposals/pull/282#issuecomment-559259994 8JUIUIFUIDPNNFOU BGUFSSFBDUJPOTPOUIFJOJUJBM QPTU QBSUJDJQBOUTBOEBUMFBTUQPMMTPGVTFSTFOUJNFOU *EMJLFUPUVSOUIJTPWFSUPUIFDPNNJUUFF
ະղܾ https://twitter.com/ndm_haskell/status/1190680324495302658
͋Ε͜Ε
f a.b.c x ͷύʔε f a.foo.bar.baz.quux 12 f (a.foo.bar.baz.quux)
12 ͱධՁ͞ΕΔ ((f a).foo.bar.baz.quux) 12Ͱͳ͍ https://github.com/shayne-fletcher-da/ghc-proposals/blob/record-dot-syntax/proposals/0000-record-dot-syntax.md#record-selection
Lensʁ • f $ record ^. field ͕ f record.field
ͱॻ͚Δ • Lensෳࡶա͗Δ… • Lensͱ໊લۭ͕ؒҟͳΔͷͰҰॹʹ͑Δ https://github.com/shayne-fletcher-da/ghc-proposals/blob/record-dot-syntax/proposals/0000-record-dot-syntax.md#alternatives-to-this-proposal
͜͏͍͏දهແ͍ • ߋ৽ʹؔ͢Δߏจ • a{field * 2} • a{field <-
(*2)} • a{field * = 2} • ߋ৽ʹؔ͢ΔηΫγϣϯ • ({a=}) • ({a=b}) • (.lbl=) https://github.com/shayne-fletcher-da/ghc-proposals/blob/record-dot-syntax/proposals/0000-record-dot-syntax.md#alternatives-within-this-proposal
Ҏ্