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
980
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
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
240
Nuxtベースの「WXT」でChrome拡張を作成する | Vue Fes 2024 ランチセッション
moshi1121
1
500
僕がつくった48個のWebサービス達
yusukebe
18
17k
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
9
990
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
23
11k
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
240
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
210
JaSST 24 九州:ワークショップ(は除く)実践!マインドマップを活用したソフトウェアテスト+活用事例
satohiroyuki
0
260
macOS でできる リアルタイム動画像処理
biacco42
6
1.7k
Golang と Erlang
taiyow
8
1.9k
現場で役立つモデリング 超入門
masuda220
PRO
12
2.9k
Modern Angular: Renovation for Your Applications
manfredsteyer
PRO
0
200
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
41
2.1k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
9
680
Scaling GitHub
holman
458
140k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Bash Introduction
62gerente
608
210k
KATA
mclloyd
29
13k
A Philosophy of Restraint
colly
203
16k
Producing Creativity
orderedlist
PRO
341
39k
Designing the Hi-DPI Web
ddemaree
280
34k
The Pragmatic Product Professional
lauravandoore
31
6.3k
A better future with KSS
kneath
238
17k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
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
Ҏ্