unison/unison-src/transcripts/suffixes.md

718 B

Suffix-based resolution of names

Any unique name suffix can be used to refer to a definition. For instance:

-- No imports needed even though FQN is `builtin.{Int,Nat}`
foo.bar.a : Int
foo.bar.a = +99

-- No imports needed even though FQN is `builtin.Optional.{None,Some}`
optional.isNone o = case o of
  None -> true
  Some _ -> false

This also affects commands like find. Notice lack of qualified names in output:

.> find take

In the signature, we don't see base.Nat, just Nat. The full declaration name is still shown for each search result though.

Type-based search also benefits from this, we can just say Nat rather than .base.Nat:

.> find : Nat -> [a] -> [a]