2 ms·
This isn't about encoding the validation rules in the type system, only the requirement that validation with respect to some properties has been done. So in you
by lkitching 7y ago
This isn't about encoding the validation rules in the type system, only the requirement that validation with respect to some properties has been done. So in your example you would just define a function
createPurchaseRequest :: UserRequest -> Purchase -> Maybe PurchaseRequest
now everywhere in the code taking a PurchaseRequest can assume it is valid.