Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
20250213 関数型DDD 4
Search
saka
December 24, 2025
12
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20250213 関数型DDD 4
saka
December 24, 2025
More Decks by saka
See All by saka
20250304 関数型DDD 6
sakatttttta
0
25
20241219 Github Actionsの面倒いところ
sakatttttta
0
18
20250109 関数型
sakatttttta
0
11
20250116 関数型DDD 2
sakatttttta
0
11
20250123 関数型DDD 3
sakatttttta
0
11
20250206 関数型DDD 4
sakatttttta
0
12
20250220 Hono カスタムfetch
sakatttttta
0
10
20250225 関数型DDD 5
sakatttttta
0
9
20250311 関数型DDD 7
sakatttttta
0
9
Featured
See All Featured
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
How STYLIGHT went responsive
nonsquared
100
6.3k
Amusing Abliteration
ianozsvald
1
350
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
740
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
Mobile First: as difficult as doing things right
swwweet
225
10k
Deep Space Network (abreviated)
tonyrice
0
370
Mind Mapping
helmedeiros
1
400
Transcript
ؔܕDDD
લճ
ೖग़ྗ͕ෳ
type PlaceOrderEvents = { AcknowledgmentSent : AcknowledgmentSent OrderPlaced : OrderPlaced
BillableOrderPlaced : BillableOrderPlaced } type PlaceOrder = UnvalidatedOrder -> PlaceOrderE
type CategorizedMail = | Quote of QuoteForm | Order of
OrderForm // etc type CategorizeInboundMail = EnvelopeContents -> CategorizedMail
ResultͳͲ·ͱΊ
type ValidationResponse<'a> = Async<Result<'a, ValidationError list>> type ValidateOrder = UnvalidatedOrder
-> Async<Result<ValidatedOrder, ValidationError list>> type ValidateOrder = UnvalidatedOrder -> ValidationResponse<ValidatedOrder>
None
࠷ॳݸผ ޙύΠϓϥΠϯ
ੑ εΩοϓ
ෆมੑ
લʑճͷεϥΠυΑΓ
ঢ়ଶมԽ
ू εΩοϓ
ΦϒδΣΫτͷ࡞ ߟ͑தεΩοϓ
ෆม݅
ඞͣ໌ࡉ͕ ଘࡏ͠ͳ͚Ε͍͚ͳ͍
͜ΕܕͰ
type NonEmptyList<'a> = { First : 'a Rest : 'a
list }
ύΠϓϥΠϯʹ ͍ͯ͜͠͏
ϞσϧԽ͢Δͭ
None
ঢ়ଶͷભҠʹ
None
Ͳ͏Δʁ
ͦΕͧΕͷঢ়ଶͷܕΛ࡞ Δ
type PricedOrder = { OrderId : ... CustomerInfo : CustomerInfo
ShippingAddress : Address BillingAddress : Address // ݕূࡁΈͷจ໌ࡉߦͱҟͳΔ OrderLines : PricedOrderLine list AmountToBill : BillingAmount }
τοϓϨϕϧͰ߹
type Order = | Unvalidated of UnvalidatedOrder | Validated of
ValidatedOrder | Priced of PricedOrder // etc
͜ΕΒͷભҠͲ͏͢ Δʁ
εςʔτϚγϯ
None
ͳͥ͏ͷ͔
• ͦΕͧΕͷঢ়ଶͰडΕΔॲཧΛม͑ΒΕΔ • શͯͷঢ়ଶΛ໌ࣔతʹͰ͖Δ • ى͜Γ͏Δঢ়گΛશͯߟྀʹೖΕΔͱ͍͏ࢥߟ͕ಇ͖͍͢
F#αϯϓϧ
·ͣܕ
type ShoppingCart = | EmptyCart // σʔλແ͠ | ActiveCart of
ActiveCartData | PaidCart of PaidCartData
εςʔτϚγϯ
let addItem cart item = match cart with | EmptyCart
-> // ࢦఆ͞ΕͨΞΠςϜͰɺ৽͍͠ΞΫςΟϒͳΧʔτΛ࡞ ActiveCart { UnpaidItems = [item] } | ActiveCart { UnpaidItems = existingItems } -> // ࢦఆ͞ΕͨΞΠςϜͱՃࡁΈͷΞΠςϜͰɺ৽͍͠ΞΫςΟϒͳΧʔτΛ࡞ ActiveCart { UnpaidItems = item :: existingItems } | PaidCart _ -> // ແࢹ cart
TSʢGPT༷ʣ
None
৽͍͠Χʔτͷฦ͠ํʹෆຬ ͋Δ͚Ͳ·͋͜Μͳײ͡ʁ