You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 13, 2023. It is now read-only.
Consider this file. GenType creates everything I expect, including a constant for the whole NegativeInt module. BUT comment out the @genType let bozo = 0 and NOTHING gets generated. This seems really odd. Why would the inclusion of the bozo line affect generation of anything else?
Separately, I'm finding some inconsistent behavior with trying to generate those wrapped up constant exports like NegativeInt that include all the defined module functions. Sometimes it creates the constant with everything wrapped up, and sometimes it only creates the pieces inside NegativeInt without a wrapper. Can't pin this down. I was actually surprised it ever works since you can't put a genType annotation on the module itself and I thought it only worked with first class modules.
module type Validated = {
type t
type domain
@genType
let make: domain => option<t>
@genType
let makeExn: domain => t
@genType
let value: t => domain
}
module type Config = {
type domain
let validate: domain => option<domain>
}
module type MakeValidated = (P: Config) => (Validated with type domain := P.domain)
module Make: MakeValidated = (P: Config) => {
type t = P.domain
let make = v => v->P.validate
let makeExn = v => v->make->Option.getExn
external value: t => P.domain = "%identity"
}
module NegativeInt = Make({
type domain = int
let validate = n =>
switch n < 0 {
| true => Some(n)
| false => None
}
})
// Comment out these lines and nothing is generated
@genType
let bozo = 0