Skip to content

Instantly share code, notes, and snippets.

@secondwtq
Created June 22, 2018 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secondwtq/e7f410f08041c98041114990bc252a09 to your computer and use it in GitHub Desktop.
Save secondwtq/e7f410f08041c98041114990bc252a09 to your computer and use it in GitHub Desktop.
using _ = Music#Classical
# problem: Type vs. Entry
type HumanStatus =
| Active
| Deceased
# optional property should be allowed in entry & type
entry #Human {
name: string;
fullName: string;
born: Maybe date;
died: Maybe date;
status: HumanStatus;
}
entry _#Genre {
}
entry _#Composer is #Human {
}
link _#Composer _#writesGreat _#Genre;
type Catalog =
| Opus u32
| Kochel u32
entry _#Composition {
writtenBy: _#Composer;
catalog: Catalog;
}
link _#Composer _#wrote _#Composition;
let mozart = newEntity _# "mozart" {
name = "Mozart";
fullName = "Wolfgang Amadeus Mozart";
status = Deceased;
}
let k626 = newEntity _# "k626" {
catalog = Kochel 626
}
newLink mozart _#wrote k626;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment