HCL variable type evaluation

Hi everyone,
How can I convert Terraform-like variable types to cty types?

For example:
type = object({ service = set(string) public_accessible = set(string) })
I would also want to validate if the value provided by the user for this object complies with the defined type.

Any guidance would be appreciated!

@apparentlymart answered in GitHub, cross-linking for posterity.