named-text-1.0.1.0: A parameterized named text type and associated functionality.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Name

Synopsis

Documentation

type Name = Named UTF8 Source #

The Name type is for the standard/most commonly used style which is orthogonal to a normal String or Text.

data Named (style :: NameStyle) (sym :: Symbol) Source #

The Named is a wrapper around any Text that identifies the type of Text via the sym phantom symbol type, as well as a usage specified by the style type parameter. Use of Named should always be preferred to using a raw Text (or String).

Instances

Instances details
Pretty (Named style nm) => Sayable tag (Named style nm) Source # 
Instance details

Defined in Data.Name

Methods

sayable :: Named style nm -> Saying tag #

NameText style => Sayable "info" (Named style nm) Source #

For an "info" saytag (and possibly others), a Name doesn't include its label. Normally, it shows the label followed by the text itself. The Sayable defers to the Prettyprinting instance for actual representation.

Instance details

Defined in Data.Name

Methods

sayable :: Named style nm -> Saying "info" #

IsList (Name s) Source # 
Instance details

Defined in Data.Name

Associated Types

type Item (Name s) #

Methods

fromList :: [Item (Name s)] -> Name s #

fromListN :: Int -> [Item (Name s)] -> Name s #

toList :: Name s -> [Item (Name s)] #

KnownSymbol ty => Pretty (Name ty) Source # 
Instance details

Defined in Data.Name

Methods

pretty :: Name ty -> Doc ann #

prettyList :: [Name ty] -> Doc ann #

IsString (Named CaseInsensitive sym) Source # 
Instance details

Defined in Data.Name

IsString (Named style sym) Source # 
Instance details

Defined in Data.Name

Methods

fromString :: String -> Named style sym #

Semigroup (Named style sym) Source # 
Instance details

Defined in Data.Name

Methods

(<>) :: Named style sym -> Named style sym -> Named style sym #

sconcat :: NonEmpty (Named style sym) -> Named style sym #

stimes :: Integral b => b -> Named style sym -> Named style sym #

Generic (Named style sym) Source # 
Instance details

Defined in Data.Name

Associated Types

type Rep (Named style sym) :: Type -> Type #

Methods

from :: Named style sym -> Rep (Named style sym) x #

to :: Rep (Named style sym) x -> Named style sym #

NFData (Named style sym) Source # 
Instance details

Defined in Data.Name

Methods

rnf :: Named style sym -> () #

Eq (Named style sym) Source # 
Instance details

Defined in Data.Name

Methods

(==) :: Named style sym -> Named style sym -> Bool #

(/=) :: Named style sym -> Named style sym -> Bool #

Ord (Named style sym) Source # 
Instance details

Defined in Data.Name

Methods

compare :: Named style sym -> Named style sym -> Ordering #

(<) :: Named style sym -> Named style sym -> Bool #

(<=) :: Named style sym -> Named style sym -> Bool #

(>) :: Named style sym -> Named style sym -> Bool #

(>=) :: Named style sym -> Named style sym -> Bool #

max :: Named style sym -> Named style sym -> Named style sym #

min :: Named style sym -> Named style sym -> Named style sym #

Hashable (Named style sym) Source # 
Instance details

Defined in Data.Name

Methods

hashWithSalt :: Int -> Named style sym -> Int #

hash :: Named style sym -> Int #

IsText (Named CaseInsensitive sym) Source # 
Instance details

Defined in Data.Name

IsText (Named style sym) Source # 
Instance details

Defined in Data.Name

Methods

fromText :: Text -> Named style sym Source #

KnownSymbol ty => Pretty (Named CaseInsensitive ty) Source # 
Instance details

Defined in Data.Name

Methods

pretty :: Named CaseInsensitive ty -> Doc ann #

prettyList :: [Named CaseInsensitive ty] -> Doc ann #

KnownSymbol ty => Pretty (Named Secure ty) Source # 
Instance details

Defined in Data.Name

Methods

pretty :: Named Secure ty -> Doc ann #

prettyList :: [Named Secure ty] -> Doc ann #

type Item (Name s) Source # 
Instance details

Defined in Data.Name

type Item (Name s) = Item Text
type Rep (Named style sym) Source # 
Instance details

Defined in Data.Name

type Rep (Named style sym) = D1 ('MetaData "Named" "Data.Name" "named-text-1.0.1.0-71so0H5yJ3v5EdRMm409Ci" 'True) (C1 ('MetaCons "Named" 'PrefixI 'True) (S1 ('MetaSel ('Just "named") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

name :: Name sym -> Text Source #

nameOf :: KnownSymbol sym => Named style sym -> Proxy# sym -> String Source #

Retrieve the sym type parameter (the "what am I") of a Named as a text value

nameProxy :: KnownSymbol sym => Named style sym -> Proxy sym Source #

styleProxy :: KnownSymbol style => Named style sym -> Proxy style Source #

type NameStyle = Symbol Source #

The NameStyle specifies how the name itself is styled.

  • The UTF8 default style is orthogonal to a normal String or Text.
  • The CaseInsensitive style indicates that uppercase ASCII characters are equivalent to their lowercase form.
  • The Secure style is case sensitive, but does not reveal the full contents unless the specific "secureName" accessor function is used. This is useful for storing secrets (e.g. passphrases, access tokens, etc.) that should not be fully visible in log messages and other miscellaneous output.

type UTF8 = "UTF8" :: NameStyle Source #

type CaseInsensitive = "CaseInsensitive" :: NameStyle Source #

type Secure = "SECURE!" :: NameStyle Source #

class HasName x style nm | x -> style, x -> nm Source #

Some objects have (contain) an associated name. If they do, they can declare the HasName constraint, and use myName to reconsistute the name from the object.

Minimal complete definition

myName

myName :: HasName x style nm => x -> Named style nm Source #

class NameText style Source #

A general class that can be used to extract the Text back out of a name.

Instances

Instances details
NameText CaseInsensitive Source # 
Instance details

Defined in Data.Name

Methods

nameText :: forall (nm :: Symbol). Named CaseInsensitive nm -> Text Source #

NameText UTF8 Source # 
Instance details

Defined in Data.Name

Methods

nameText :: forall (nm :: Symbol). Named UTF8 nm -> Text Source #

nameText :: NameText style => Named style nm -> Text Source #

data SomeName Source #

Constructors

forall (s :: Symbol).KnownSymbol s => SomeName (Name s) 

viewSomeName :: (forall (s :: Symbol). KnownSymbol s => Name s -> r) -> SomeName -> r Source #

data SomeNameStyle nameTy Source #

Constructors

forall (s :: Symbol).(KnownSymbol s, NameText s) => SomeNameStyle (Named s nameTy) 

viewSomeNameStyle :: (forall (s :: Symbol). KnownSymbol s => Named s nameTy -> r) -> SomeNameStyle nameTy -> r Source #

type SecureName = Named Secure Source #

The SecureName is like Name, but its display form does not reveal the full name.

secureName :: Named Secure sym -> Text Source #

The secureName accessor is used to obtain the name field from a Secure Named. This is the normal accessor for a Secure Named and will occlude a portion of the extracted name for protection. For those specific cases where the full Secure Named text is needed, the secureNameBypass accessor should be used instead.

secureNameBypass :: Named Secure sym -> Text Source #

The secureNameBypass accessor is used to obtain the raw Text from a Secure Named; this essentially bypasses the security protection and should only be used in the limited cases when the raw form is absolutely needed.

class IsText a where Source #

Methods

fromText :: Text -> a Source #

Instances

Instances details
IsText (Named CaseInsensitive sym) Source # 
Instance details

Defined in Data.Name

IsText (Named style sym) Source # 
Instance details

Defined in Data.Name

Methods

fromText :: Text -> Named style sym Source #

class ConvertName style origTy newTy where Source #

Minimal complete definition

Nothing

Methods

convertName :: Named style origTy -> Named style newTy Source #

Instances

Instances details
ConvertName UTF8 a a Source # 
Instance details

Defined in Data.Name

ConvertName UTF8 "component" "instance component" Source # 
Instance details

Defined in Data.Name

Methods

convertName :: Named UTF8 "component" -> Named UTF8 "instance component" Source #

ConvertName UTF8 "git.branch" "git.branch|ref" Source # 
Instance details

Defined in Data.Name

Methods

convertName :: Named UTF8 "git.branch" -> Named UTF8 "git.branch|ref" Source #

ConvertName UTF8 "git.ref" "git.branch|ref" Source # 
Instance details

Defined in Data.Name

Methods

convertName :: Named UTF8 "git.ref" -> Named UTF8 "git.branch|ref" Source #

class ConvertNameStyle inpStyle outStyle nameTy where Source #

Minimal complete definition

Nothing

Methods

convertStyle :: Named inpStyle nameTy -> Named outStyle nameTy Source #

class (KnownNat (AllowedNameType nty ntl), DisallowedNameType nty ntl ntl) => ValidNames (nty :: Symbol) (ntl :: [Symbol]) Source #

The ValidNames constraint can be used to specify the list of allowed names for a parameterized name argument.

Minimal complete definition

validName

Instances

Instances details
(KnownNat (AllowedNameType nty ntl), DisallowedNameType nty ntl ntl) => ValidNames nty ntl Source # 
Instance details

Defined in Data.Name

Methods

validName :: Proxy ntl -> Name nty -> Text Source #

validName :: ValidNames nty ntl => Proxy ntl -> Name nty -> Text Source #