Just a simple ML study.
| birth | ||
| person | ||
| prompt | ||
| tests | ||
| .gitignore | ||
| COPYING | ||
| main.sml | ||
| person-study.mlb | ||
| README.md | ||
PersonStudy
This is a simple ML study. It explores concepts like signature, structure, type aliases, and template matching.
Person structure
The Person structure is the main one. Its API has three functions:
Person.new : string -> Person.date -> Person.place -> Person.personbuilds and return a personPerson.birthDate : Person.person -> Person.datereturns the person’s birth datePerson.hometown : Person.person -> Person.placereturns the person’s hometownPerson.show : Person.person -> stringserialises the person for show
The type aliases are:
Person.date: the sameBirth.date–Date.datefrom basisPerson.place: the sameBirth.place– string optionPerson.person: a hash containing the keysname(string) andbirth(Birth.birth)
The Person structure depends on the Birth structure.
Birth structure
The Birth structure manage birth date and place. Its API has two functions:
Birth.new : Birth.date -> Birth.place -> Birth.birthbuilds and return a birthBirth.show : Birth.birth -> stringserialises the birth for show
The type aliases are:
Birth.date:Date.datefrom basisBirth.place: string optionBirth.birth: a hash containing the keysdate(Birth.date) andplace(Birth.place)
Prompt structure
The Prompt structure offers helpers to request informations from standard
input.
Prompt.forInt : Prompt.message -> int optionrequests an integerPrompt.forOpt : Prompt.message -> string optionrequests a stringPrompt.forStr : Prompt.message -> stringrequests a straight stringPrompt.getDate : Prompt.message -> Date.daterequests a date
forInt and forOpt return NONE when the supplied value is invalid.
The type alias Prompt.message is string.