Is there a way to call the constructor for an F# record type in F#?
My motivation is I've been using the applicative validation from FSharpx but find myself writing lots of boilerplate functions that just construct records.
The buildAddress function for instance in simply boilerplate and I would love to get rid of it if possible.
let buildAddress streetNumber streetLine1 streetLine2 suburb state postcode =
{
Address.StreetNumber = streetNumber
StreetLine1 = streetLine1
StreetLine2 = streetLine2
Suburb = suburb
State = state
Postcode = postcode
}
let validateAddress streetNumber streetLine1 streetLine2 suburb state postcode =
buildAddress
<!> isNumber streetNumber
<*> Success streetLine1
<*> Success streetLine2
<*> Success suburb
<*> Success state
<*> validatePostcode postcode