Unison identifiers come in two flavors:

  1. Regular identifiersstart with an alphabetic unicode character, emoji (which is any unicode character between 1F400 and 1FAFF inclusive), or underscore (''_''), followed by any number of alphanumeric characters, emoji, or the characters_,!,or\'.For example,foo,_bar4,qux',andset!are valid regular identifiers.
  2. Operatorsconsist entirely of the characters!$%^&*-=+<>.~\\/|:.For example,+,*,<>,and>>=are valid operators.

Namespace-qualified identifiers

Thegeneral reference for identifiersdescribesunqualifiedidentifiers. An identifier can also be qualified. A qualified identifier consists of a qualifier or namespace, followed by a.,followed by either a regular identifier or an operator. The qualifier is one or more regular identifiers separated by.For exampleFoo.Bar.bazis a qualified identifier whereFoo.Baris the qualifier.

Absolutely qualified identifiers

Namespace-qualified identifiersare relative to a “current” namespace, which the programmer can set (and defaults to the root of the global namespace). To ignore the current namespace, an identifier can have anabsolute qualifier.An absolutely qualified name begins with a..For example, the name.base.Listalways refers to the name.base.List,regardless of the current namespace, whereas the namebase.Listwill refer tofoo.base.Listif the current namespace isfoo.

Note thatoperator identifiersmay contain the character..In order for this to not create ambiguity, the rule is as follows:

  1. .by itself is always an operator.
  2. Any other identifier beginning an absolutely qualified identifier.
  3. A.immediately following a namespace is always a namespace separator.
  4. Otherwise treated as part of an operator identifier. followed by whitespace or another operator character, treated like an operator character. If it's followed by aregular identifiercharacter, it's treated as a namespace separator.

Hash-qualified identifiers

Any identifier, including a namespace-qualified one, can appearhash-qualified.A hash-qualified identifier has the formx#hwherexis an identifier and#his ahash literal.The hash disambiguates names that may refer to more than one thing.

Reserved words

The following names are reserved by Unison and cannot be used as identifiers:=,:,->,',|,!,`,if,then,else,forall,handle,unique,structural,where,use,&&,||,true,false,type,ability,alias,let,namespace,cases,match,with,termLink,typeLink.