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
1k
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
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
14 Years of iOS: Lessons and Key Points
seyfoyun
1
770
nekko cloudにおけるProxmox VE利用事例
irumaru
3
420
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
720
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
190
たのしいparse.y
ydah
3
120
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
KATA
mclloyd
29
14k
Six Lessons from altMBA
skipperchong
27
3.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
Building Applications with DynamoDB
mza
91
6.1k
How STYLIGHT went responsive
nonsquared
95
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
Ҏ্