Hi, I’ve tried my best to convert examples from the book “Domain Modeling Made Functional Tackle Software Complexity with Domain-Driven Design and F#” to Kotlin based on Arrow. The result is here: https://github.com/dnowak/domain-modeling-made-functional-in-kotlin
I would be grateful for any hints on making the code more idiomatic regarding FP & Arrow.
😮 1
❤️ 2
arrow 6
s
simon.vergauwen
11/29/2021, 7:50 AM
Hey @dnowak,
Cool work!
I saw your
TODO
, and
Validated
should actually be quite easy to mix with
suspend
code.
Is there a specific use-case in the codebase you’d like to improve?
d
dnowak
11/29/2021, 12:40 PM
Hi @simon.vergauwen, in the book, the address is first checked in external service (thus suspend) and then validated. I’m not too fond of that order of operations as:
1. we call external service then validate
2. it introduces suspend into the “validation” phase
I was thinking about having it done in two phases:
• validate the input - just pure format validation
• check the input = run any business checks of already validated input
And then combine both into verify. I will try to implement it again based on the original order (check than validate) and ask you for guidance 🙂.
👍 1
s
stojan
11/29/2021, 1:22 PM
step 1) has to be suspend because it calls an external service
step 2) can be pure
the combination of 1) plus 2) has to be suspend, because step 1) is suspend
the order of step 1) and 2) doesn't really influence ☝️