PartialOrComplete| Partial partial -- keep going
| Complete complete -- done– a pattern used in
type Step folded
= Continue folded
| Done folded
stoppableFold :
folded
-> (element -> folded -> Step folded)
-> Structure element
-> foldedtype Step state complete
= Loop state
| Done complete
loop :
state
-> (state -> Magic (Step state complete))
-> Magic completetype Step
= InProgress InProgress
| Done Complete
step : InProgress -> Stepstep-by-step testing, benchmarking, parsing, simplifying/shrinking, evaluating, ...Maybe it makes sense to have a shared type in a shared place? With shared documentation and helpers?
PartialOrComplete is already being usedStep through a structure; stop when you're done.
Suggestions & additions welcome!
You don't want to require users to manually install this package for just the stoppable type and helpers?
In your domain, variant names can be more specific and descriptive than "partial" and "complete"?
You like avoiding package dependencies? → You can expect this package to not have breaking changes
You have the same intermediate and complete types and use
type InProgress
= Atom { info : Info, report : Maybe Report }
| Structured (List InProgress)
step : InProgress -> InProgress
isDone : InProgress -> Bool→ I do suggest looking into
type Thing report
= Atom { info : Info, report : report }
| Structured (List (Thing report))
step : Thing (Maybe Report) -> PartialOrComplete (Thing (Maybe Report)) (Thing Report)I'd say that's a tiny tiny bit nicer because you can't miss that you're already done.