Parameterization defines a type in terms of explicit parameters, allowing one model to represent different lifecycle states or carry state-specific information. For LateFee, a type parameter can encode which lifecycle a decision applies to, so the type system expresses that assessments handle drafts. section 5.4.4
Encoding a reviewed draft
A sealed ReviewedFee model can parameterize each outcome with LateFee<Draft>: Billable and NeedsApproval carry the draft, while NotBillable also carries a Reason. The parameter preserves the relevant lifecycle state across decisions. section 5.4.4
Listing 5.40 Representing the decision in our system
sealed interface ReviewedFee {
record Billable(Latefee<Draft> fee) #A
implements ReviewedFee{}
record NeedsApproval(Latefee<Draft> fee) #A
implements ReviewedFee{}
record NotBillable(Latefee<Draft> fee, Reason reason) #A
implements ReviewedFee{}
}Inspect the sealed decision model to see how LateFee<Draft> makes lifecycle information explicit in each outcome. section 5.4.4


