Given i have the type:
type NewsMessage(identifier:string, headline:string)
and this record:
type NewsMessageParams = {
identifier:string
headline:string
}
Is there an implicit way to adapt the record into the class constructor?
Something like so:
let newsMessageParmas = {identifier=""; headline=""}
new NewsMessage(newsMessageParams) //this is where i need help
You can do this with tuples using the ||> syntax. I would like to do this with a record.
Something like this would work:
Note that object constructor isn’t first-class in F#, so you have more chances of using pipe operators if declaring
NewsMessageas discriminated unions: