#observation i now fully understand the [[(hidden) U5k5oJ6YK]] pattern of returning an exit code, and if success, writing into the function argument's reference. the [[(hidden) U5k5oJ6YK]] fellas are even more [[round-trips]] ahead than the #fp crew? 5Head
-
okay now we have created our own monad or similar, that works like a Promise. sadly, now i'd need to have a `.map` or similar like `.then`, so that in case it does fail, we don't run the "expect to succeed" part.
-
we now have a situation like this:
-
```typescript
const goodCommands: Exitable<GoodCommand[]> = parseTodoOfStackedRebase({
pathToStackedRebaseTodoFile,
});
if (goodCommands.code === ExitCode.FAIL) {
return goodCommands;
}
logGoodCmds(goodCommands);
```
-
but, "goodCommands" is wrapped inside a monad `Exitable`. it's not easy to re-cast the type, it kinda sucks checking for it; it's not even clear what we're returning.
-
instead, imagine this:
-
fuck, this doesn't play well w/ [[typescript]].
-
{{[[TODO]]}} is this also what [[(hidden) pokav_dad]] is about? 👀
-
oh okay more [[observation]]s:
-
1. sad that ts cannot infer that if type is `[A | null] | [null | B]`, if you verify one side is null, then other should not be, but doesn't infer automatically yet...
-
2. could use a type assertion fn that could verify this. sadly more syntax.
-
2.1 but, i also now see where the `Some(x)` comes from in [[(hidden) KMBIAt8MO]]. damn, these people have went thru many [[round-trips]] haven't they?:D
-
.
-
i guess this is the best we can do for now?
-
-
...more discoveries... and they all suck...
-
oooh, maybe?
-
-
[[roam-traverse-graph]] [[export-html-pages]]
-