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
20250805 関数型DDD 15
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
saka
December 24, 2025
20
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20250805 関数型DDD 15
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
20250213 関数型DDD 4
sakatttttta
0
12
20250220 Hono カスタムfetch
sakatttttta
0
10
20250225 関数型DDD 5
sakatttttta
0
9
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
570
Fireside Chat
paigeccino
43
4.1k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Unsuck your backbone
ammeep
672
58k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
59k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The Language of Interfaces
destraynor
162
27k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
630
Ethics towards AI in product and experience design
skipperchong
2
440
Chasing Engaging Ingredients in Design
codingconduct
0
360
Transcript
ؔܕDDD
͓͢͢Ίpoint
HonoͷΤϥʔܕͱ૬ੑྑ͠
ఆ͞ΕΔΤϥʔResultͰ ࠷ޙͰऔಘՄೳ
const assertNever = (_: never): never => { throw new
Error(); }; type DogError = { kind: "DogError"; message: string; }; type CatError = { kind: "CatError"; message: string; }; type AnimalError = DogError | CatError;
import { Result, ok, err } from "neverthrow"; const checkAnimal
= (animal: string): Result<string, AnimalError> => { if (animal === "Dogn") { return err({ kind: "DogError", message: "Invalid animal" }); } if (animal === "Catn") { return err({ kind: "CatError", message: "Invalid animal" }); } return ok("Animal"); };
const app = new Hono(); app.get("/", (c) => { return
checkAnimal("Dog").match( (animal) => { return c.json({ message: animal }); }, (error) => { switch (error.kind) { case "DogError": return c.json({ error: `DogError: ${error.message}` }, 401); case "CatError": return c.json({ error: `CatError: ${error.message}` }, 400); default: return assertNever(error); } } ); });
͍͠
ܕͷ໋໊
type InactiveUser = { // kindͬͨ΄͏͕͍͍ʁ id: UserId; email: Email;
inactiveAt: InactiveAt; }; type DeletedUser = { // ຊʹ͜ͷܕ໊Ͱ͍͍ͷ͔ʁ id: UserId; email: Email; deletedAt: DeletedAt; };
Step͝ͱʹܕ͕ඞཁ ͏͑Δ໊લ͕ͳ͍…
ϫʔΫϑϩʔͷαϒες οϓͲ͜Ͱ͚Δ͔
validateͷதʹcheckEmailͱ checkAddress stepʹ͚Δ͖͔
ݕ౼த
֎͔ΒґଘؔΛೖ͍ͯ͠Δ͕ ͳΔ͘७ਮؔʹอ͖ͭʁ
Repositoryͱ͔ͦͷଞґଘؔ ͱ͔Γ͗ͯ͢…
४උ෦ͷಋೖΛݕ౼ generateͱ͔طଘinviͷऔಘͱ͔
ݖݶνΣοΫ
͜Εผʁ
Transaction
ΠϕϯτͳΒ͍͍͚Ͳ
ϓϩμΫτʹΑͬͯແ ཧ͔
ෳʹ·͕ͨΔૢ࡞ग़ͯ ͘Δʁ
ڞ௨Խ͕͍͠
work f lowͰ݁ͯ͠Δ