Skip to content

Feature request: PPX support for parametrized types #162

@benadamstyles

Description

@benadamstyles

Would be really helpful if we could do this:

@schema
type thing<'a> = {
  a: 'a,
}

// Would generate:
let thingSchema = aSchema => S.object(s => {
  a: s.field("a", aSchema),
})

and then:

@schema
type parent = {
  property: thing<int>,
}

// Would generate:
let parentSchema = S.object(s => {
  property: s.field("property", thingSchema(S.int),
})

Do you foresee any problems with this idea? Right now I'm just writing this manually each time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions