unison-core1-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Name.Internal

Description

The private Unison.Name innards. Prefer importing Unison.Name instead, unless you need the data constructor of Name.

Synopsis

Documentation

data Name Source #

A name is an absolute-or-relative non-empty list of name segments. It is used to represent the path to a definition.

A few example names:

  • "foo.bar" --> Name Relative ("bar" :| ["foo"])
  • ".foo.bar" --> Name Absolute ("bar" :| ["foo"])
  • "|>.-- Name Relative (":| ["|"])
  • "." --> Name Relative ("." :| [])
  • ".." --> Name Absolute (".." :| [])

Constructors

Name 

Fields

  • Position

    whether the name is positioned absolutely (to some arbitrary root namespace), or relatively

  • (NonEmpty NameSegment)

    the name segments in reverse order

Instances

Instances details
(TypeError ('Text "You cannot make a Name from a string literal because there may (some day) be more than one syntax") :: Constraint) => IsString Name Source # 
Instance details

Defined in Unison.Name.Internal

Methods

fromString :: String -> Name #

Generic Name Source # 
Instance details

Defined in Unison.Name.Internal

Associated Types

type Rep Name :: Type -> Type #

Methods

from :: Name -> Rep Name x #

to :: Rep Name x -> Name #

Show Name Source # 
Instance details

Defined in Unison.Name.Internal

Methods

showsPrec :: Int -> Name -> ShowS #

show :: Name -> String #

showList :: [Name] -> ShowS #

Eq Name Source # 
Instance details

Defined in Unison.Name.Internal

Methods

(==) :: Name -> Name -> Bool #

(/=) :: Name -> Name -> Bool #

Ord Name Source # 
Instance details

Defined in Unison.Name.Internal

Methods

compare :: Name -> Name -> Ordering #

(<) :: Name -> Name -> Bool #

(<=) :: Name -> Name -> Bool #

(>) :: Name -> Name -> Bool #

(>=) :: Name -> Name -> Bool #

max :: Name -> Name -> Name #

min :: Name -> Name -> Name #

Alphabetical Name Source #

Compare names (kinda) alphabetically: absolute comes before relative, but otherwise compare the name segments alphabetically, in order.

Instance details

Defined in Unison.Name.Internal

Snoc Name Name NameSegment NameSegment Source # 
Instance details

Defined in Unison.Name.Internal

type Rep Name Source # 
Instance details

Defined in Unison.Name.Internal

type Rep Name = D1 ('MetaData "Name" "Unison.Name.Internal" "unison-core1-0.0.0-Kp7ZcNnt5XdB8ImvFwyntI" 'False) (C1 ('MetaCons "Name" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Position) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty NameSegment))))

isAbsolute :: Name -> Bool Source #

Is this name absolute?

O(1).

segments :: Name -> NonEmpty NameSegment Source #

Return the name segments of a name.

>>> segments "a.b.c"
"a" :| ["b", "c"]

O(n), where n is the number of name segments.