Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type Name = Named UTF8
- data Named (style :: NameStyle) (sym :: Symbol)
- name :: Name sym -> Text
- nameOf :: KnownSymbol sym => Named style sym -> Proxy# sym -> String
- nameProxy :: KnownSymbol sym => Named style sym -> Proxy sym
- styleProxy :: KnownSymbol style => Named style sym -> Proxy style
- caselessName :: Named CaseInsensitive sym -> Text
- type NameStyle = Symbol
- type UTF8 = "UTF8" :: NameStyle
- type CaseInsensitive = "CaseInsensitive" :: NameStyle
- type Secure = "SECURE!" :: NameStyle
- class HasName x style nm | x -> style, x -> nm
- myName :: HasName x style nm => x -> Named style nm
- class NameText style
- nameText :: NameText style => Named style nm -> Text
- data SomeName = forall (s :: Symbol).KnownSymbol s => SomeName (Name s)
- viewSomeName :: (forall (s :: Symbol). KnownSymbol s => Name s -> r) -> SomeName -> r
- data SomeNameStyle nameTy = forall (s :: Symbol).(KnownSymbol s, NameText s) => SomeNameStyle (Named s nameTy)
- viewSomeNameStyle :: (forall (s :: Symbol). KnownSymbol s => Named s nameTy -> r) -> SomeNameStyle nameTy -> r
- type SecureName = Named Secure
- secureName :: Named Secure sym -> Text
- secureNameBypass :: Named Secure sym -> Text
- class IsText a where
- class ConvertName style origTy newTy where
- convertName :: Named style origTy -> Named style newTy
- class ConvertNameStyle inpStyle outStyle nameTy where
- convertStyle :: Named inpStyle nameTy -> Named outStyle nameTy
- class (KnownNat (AllowedNameType nty ntl), DisallowedNameType nty ntl ntl) => ValidNames (nty :: Symbol) (ntl :: [Symbol])
- validName :: ValidNames nty ntl => Proxy ntl -> Name nty -> Text
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
Pretty (Named style nm) => Sayable tag (Named style nm) Source # | |
NameText style => Sayable "info" (Named style nm) Source # | For an |
IsList (Name s) Source # | |
KnownSymbol ty => Pretty (Name ty) Source # | |
IsString (Named CaseInsensitive sym) Source # | |
Defined in Data.Name fromString :: String -> Named CaseInsensitive sym # | |
IsString (Named style sym) Source # | |
Defined in Data.Name fromString :: String -> Named style sym # | |
Semigroup (Named style sym) Source # | |
Generic (Named style sym) Source # | |
NFData (Named style sym) Source # | |
Eq (Named style sym) Source # | |
Ord (Named style sym) Source # | |
Defined in Data.Name 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 # | |
IsText (Named CaseInsensitive sym) Source # | |
IsText (Named style sym) Source # | |
KnownSymbol ty => Pretty (Named CaseInsensitive ty) Source # | |
Defined in Data.Name pretty :: Named CaseInsensitive ty -> Doc ann # prettyList :: [Named CaseInsensitive ty] -> Doc ann # | |
KnownSymbol ty => Pretty (Named Secure ty) Source # | |
type Item (Name s) Source # | |
type Rep (Named style sym) 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
styleProxy :: KnownSymbol style => Named style sym -> Proxy style Source #
caselessName :: Named CaseInsensitive sym -> Text 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 CaseInsensitive = "CaseInsensitive" :: 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.
A general class that can be used to extract the Text back out of a name.
viewSomeName :: (forall (s :: Symbol). KnownSymbol s => Name s -> r) -> SomeName -> r Source #
data SomeNameStyle nameTy Source #
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 ConvertName style origTy newTy where Source #
Nothing
convertName :: Named style origTy -> Named style newTy Source #
Instances
ConvertName UTF8 a a Source # | |
ConvertName UTF8 "component" "instance component" Source # | |
ConvertName UTF8 "git.branch" "git.branch|ref" Source # | |
ConvertName UTF8 "git.ref" "git.branch|ref" Source # | |
class ConvertNameStyle inpStyle outStyle nameTy where Source #
Nothing
convertStyle :: Named inpStyle nameTy -> Named outStyle nameTy Source #