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
960
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
Applied NLP in the Age of Generative AI
inesmontani
PRO
3
1.1k
モジュラモノリス、その前に / Modular monolith, before that
euglena1215
5
570
[KR] Server Driven Compose With Firebase
skydoves
1
120
"Swarming" をコンセプトに掲げるアジャイルチームのベストプラクティス
boykush
2
170
M5Stackボードの選び方
tanakamasayuki
0
200
RDBの世界をぬりかえていくモデルグラフDB〜truncus graphによるモデルファースト開発〜
jurabi
0
150
クラウドサービスの 利用コストを削減する技術 - 円安の真南風を感じて -
pyama86
3
240
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
1.1k
標準ライブラリの動向とイテレータのパフォーマンス
makki_d
3
190
複数プロダクトの技術改善・クラウド移行に向き合うチームのフレキシブルなペア・モブプログラミングの実践 / Flexible Pair Programming And Mob Programming
honyanya
0
150
CDKを活用した 大規模コンテナ移行 プロジェクトの紹介
yoyoyopg
0
240
Flutterアプリを生成AIで生成する勘所
rizumita
0
250
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
92
16k
The Mythical Team-Month
searls
218
43k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
109
6.9k
Imperfection Machines: The Place of Print at Facebook
scottboms
263
13k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
2
210
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
Producing Creativity
orderedlist
PRO
341
39k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
663
120k
Designing for humans not robots
tammielis
249
25k
Happy Clients
brianwarren
97
6.6k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
30
2.6k
Large-scale JavaScript Application Architecture
addyosmani
509
110k
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
Ҏ্