Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RecordDotSyntaxのあれこれ

315791eefd7b239aaae562274dfc0e75?s=47 lotz
December 11, 2019

 RecordDotSyntaxのあれこれ

315791eefd7b239aaae562274dfc0e75?s=128

lotz

December 11, 2019
Tweet

Transcript

  1. Record Dot Syntax ͷ͋Ε͜Ε By lotz
 2019/12/11 ୈ2ճGHCษڧձ @ IIJ-II

  2. RecordDotSyntax https://github.com/shayne-fletcher-da/ghc-proposals/blob/record-dot-syntax/proposals/0000-record-dot-syntax.md#motivation

  3. RecordDotSyntaxͷجຊ https://github.com/shayne-fletcher-da/ghc-proposals/blob/record-dot-syntax/proposals/0000-record-dot-syntax.md#recorddotsyntax-language-extension

  4. RecordDotSyntaxͷ೿ੜߏจ https://github.com/shayne-fletcher-da/ghc-proposals/blob/record-dot-syntax/proposals/0000-record-dot-syntax.md#recorddotsyntax-language-extension

  5. Recordվળͷ্ʹ͋Δ ()$֦ு1SPQPTBM ()$7FSTJPO %VQMJDBUF3FDPSE'JFMET  0WFSMPBEFE-BCFMT  0WFSMPBEFE3FDPSE'JFMET  "EETFU'JFMEUP)BT'JFME

     /P'JFME4FMFDUPST "DDFQUFE 3FDPSE%PU4ZOUBY /&8
  6. DAMLͰͷ࣮੷͋Γ • DAML͸Haskell/ScalaͰ։ൃ͞Ε͍ͯΔɺ
 εϚʔτίϯτϥΫτهड़ݴޠ • DAMLͷ։ൃʹ͓͍ͯGHC Pluginsͱ͍͏ܗͰ RecordDotSyntaxͱ΄΅ಉ͡ػೳ͕࢖ΘΕ͍ͯΔ

  7. ఏҊͯ͠Δͷ΋DAMLͷਓ https://github.com/ghc-proposals/ghc-proposals/pull/282

  8. PR΁ͷ൓Ԡ https://github.com/ghc-proposals/ghc-proposals/pull/282#issuecomment-540968106 *TUSPOHMZTVQQPSUUIFEJSFDUJPOPG USBWFMPGUIJTQSPQPTBM

  9. PR΁ͷ൓Ԡ 5IFMPTTPGQPMZNPSQIJDVQEBUFJT BIVHFQSPCMFN JNP https://github.com/ghc-proposals/ghc-proposals/pull/282#issuecomment-541111003

  10. PR΁ͷ൓Ԡ 5IJTQSPQPTBMJTGVMMPGVUUFSOPOTFOTF https://github.com/ghc-proposals/ghc-proposals/pull/282#issuecomment-541460439

  11. > :t (.age) (.age) :: Person -> Int > :t

    (. age) (. age) :: (Int -> c) -> Person -> c ۭനͷ༗Γແ͠Ͱ͜͜·Ͱҙຯ͕มΘΔͷ͸ ॳ৺ऀʹ͸೉͘͠ͳ͍ʁ
  12. ࠓͷεςʔλε https://github.com/ghc-proposals/ghc-proposals/pull/282#issuecomment-559259994 8JUIUIFUIDPNNFOU BGUFSSFBDUJPOTPOUIFJOJUJBM QPTU QBSUJDJQBOUTBOEBUMFBTUQPMMTPGVTFSTFOUJNFOU  *EMJLFUPUVSOUIJTPWFSUPUIFDPNNJUUFF

  13. ະղܾ໰୊ https://twitter.com/ndm_haskell/status/1190680324495302658

  14. ͋Ε͜Ε

  15. 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
  16. 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
  17. ͜͏͍͏දه͸ແ͍ • ߋ৽ʹؔ͢Δߏจ • 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
  18. Ҏ্