3 ms·
F# does have type alias. It takes the form type newname = oldname You can do things like type LoadReceipt = RecordId -> Record let sqlLoad: LoadReceipt = i
by UK-Al05 6y ago
F# does have type alias.
It takes the form
type newname = oldname
You can do things like
type LoadReceipt = RecordId -> Record
let sqlLoad: LoadReceipt = implementation
let noSqlLoad: LoadReceipt = implementation
You can use it like an interface, and accept loadReceipt functions for anyone who needs to load receipts... Then partially apply a SQL version, noSQL version etc.
I use this in my code.
- jolux 6y agoI know, but in TypeScript the compatibility is structural.