It would be nice to have a constraint like SchemaHas base schema that constrains that schema contains at least base. Don't know if this is even possible, requires research.
For example,
type UserSchema = [schema| { userId: Int } |]
type BossSchema = [schema| { group: Text, #UserSchema } |]
type WorkerSchema = [schema| { projects: List Text, #UserSchema } |]
-- would work when passed `Object BossSchema` or `Object WorkerSchema`
getUserId :: SchemaHas UserSchema schema => Object schema -> Int
getUserId = [get| .userId |]
It would be nice to have a constraint like
SchemaHas base schema
that constrains thatschema
contains at leastbase
. Don't know if this is even possible, requires research.For example,