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
Bash Introduction
62gerente
615
220k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
Design in an AI World
tapps
1
350
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
580
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
600
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
420
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
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
৽͍͠Χʔτͷฦ͠ํʹෆຬ ͋Δ͚Ͳ·͋͜Μͳײ͡ʁ