Logo GenPRES

UnitDetails Module

Creates and reads the details of a unit and holds the list with the group, abbreviations, names and synonyms of every known unit.

Functions and values

Function or value Description

apply f ud

Full Usage: apply f ud

Parameters:
Returns: 'a
Type parameters: 'a

Utility function to apply a function to a UnitDetails

f : UnitDetails -> 'a
ud : UnitDetails
Returns: 'a

create un gr ab nm sy

Full Usage: create un gr ab nm sy

Parameters:
    un : Unit - The unit
    gr : Group - The group
    ab : Language - The abbreviation
    nm : Language - The name
    sy : string list - Synonyms

Returns: UnitDetails

Create a UnitDetails

un : Unit

The unit

gr : Group

The group

ab : Language

The abbreviation

nm : Language

The name

sy : string list

Synonyms

Returns: UnitDetails
Example

 create
     (Mass (KiloGram 1N)) (Group.MassGroup)
     { Eng = "kg"; EngPlural = "kg"; Dut = "kg"; DutchPlural = "kg" }
     { Eng = "kilogram"; EngPlural = "kilogram"; Dut = "kilogram"; DutchPlural = "kilogram" }
     []
     =
 {
     Unit = Mass (KiloGram 1N);
     Group = Group.MassGroup;
     Abbreviation = { Eng = "kg"; EngPlural = "kg"; Dut = "kg"; DutchPlural = "kg" };
     Name = { Eng = "kilogram"; EngPlural = "kilogram"; Dut = "kilogram"; DutchPlural = "kilogram" };
     Synonyms = []
 }

createGeneral n v

Full Usage: createGeneral n v

Parameters:
    n : string - the name for the general unit
    v : BigRational - the unit value

Returns: UnitDetails

Create a UnitDetails for a General unit

n : string

the name for the general unit

v : BigRational

the unit value

Returns: UnitDetails
Example

 createGeneral "abc" 1N =
 {
     Unit = General ("abc", 1N);
     Group = Group.GeneralGroup "abc";
     Abbreviation = { Eng = "abc"; EngPlural = "abc"; Dut = "abc"; DutchPlural = "abc" };
     Name = { Eng = "abc"; EngPlural = "abc"; Dut = "abc"; DutchPlural = "abc" };
     Synonyms = []
 }

get

Full Usage: get

Returns: UnitDetails -> UnitDetails

Utility function to enable type inference

Returns: UnitDetails -> UnitDetails

getAbbreviation ud

Full Usage: getAbbreviation ud

Parameters:
Returns: Language

Get the Abbreviation from a UnitDetails

ud : UnitDetails
Returns: Language

getDutchAbbreviation

Full Usage: getDutchAbbreviation

Returns: UnitDetails -> string

Get the Dutch string from Abbreviation from a UnitDetails

Returns: UnitDetails -> string

getDutchName

Full Usage: getDutchName

Returns: UnitDetails -> string

Get the Dutch string from Name from a UnitDetails

Returns: UnitDetails -> string

getEnglishAbbreviation

Full Usage: getEnglishAbbreviation

Returns: UnitDetails -> string

Get the English string from Abbreviation from a UnitDetails

Returns: UnitDetails -> string

getEnglishName

Full Usage: getEnglishName

Returns: UnitDetails -> string

Get the English string from Name from a UnitDetails

Returns: UnitDetails -> string

getGroup ud

Full Usage: getGroup ud

Parameters:
Returns: Group

Get the Group from a UnitDetails

ud : UnitDetails
Returns: Group

getName ud

Full Usage: getName ud

Parameters:
Returns: Language

Get the Name from a UnitDetails

ud : UnitDetails
Returns: Language

getUnit ud

Full Usage: getUnit ud

Parameters:
Returns: Unit

Get the Unit from a UnitDetails

ud : UnitDetails
Returns: Unit

getUnitString loc verb

Full Usage: getUnitString loc verb

Parameters:
Returns: UnitDetails -> string

Get the string for a unit in a specific language

loc : Localization

Localization

verb : Verbal

Verbality

Returns: UnitDetails -> string
Example

getUnitString English Long (Mass (KiloGram 1N)) = "kilogram"

units

Full Usage: units

Returns: UnitDetails list

List of UnitDetails

Returns: UnitDetails list

Type something to start searching.