typed-encoding-0.4.1.0: Type safe string transformations

Safe HaskellSafe
LanguageHaskell2010

Data.TypedEncoding.Common.Types.Common

Synopsis

Documentation

>>> :set -XScopedTypeVariables -XTypeFamilies -XKindSignatures -XDataKinds

type EncAnn = String Source #

Represents value level (single) annotation. @since 0.2.0.0

type Restriction s = (KnownSymbol s, IsR s ~ True) Source #

Constraint for "r-" annotations.

Since: 0.3.0.0

type EncodingAnn s = (KnownSymbol s, IsEnc s ~ True) Source #

Constraint for "r-" annotations.

Since: 0.4.1.0

type Algorithm nm alg = AlgNm nm ~ alg Source #

Constraint for algorithm name.

Since: 0.3.0.0

type family AlgNm (encnm :: Symbol) :: Symbol where ... Source #

Converts encoding name to algorithm name, this assumes the ":" delimiter expected by this library.

This allows working with open encoding definitions such as "r-ban" or "r-bool"

>>> :kind! AlgNm "enc-B64"
...
= "enc-B64"
>>> :kind! AlgNm "r-ban:999-99-9999"
...
= "r-ban"

Since: 0.3.0.0

Equations

AlgNm encnm = TakeUntil encnm ":" 

type family AlgNmMap (nms :: [Symbol]) :: [Symbol] where ... Source #

Since: 0.3.0.0

Equations

AlgNmMap '[] = '[] 
AlgNmMap (x ': xs) = AlgNm x ': AlgNmMap xs 

type family IsR (s :: Symbol) :: Bool where ... Source #

>>> :kind! IsR "r-UPPER"
...
... 'True
>>> :kind! IsR "do-UPPER"
...
= (TypeError ... 

Since: 0.2.1.0

Equations

IsR s = AcceptEq (Text "Not restriction encoding " :<>: ShowType s) (CmpSymbol "r-" (Take 2 s)) 

type family IsROrEmpty (s :: Symbol) :: Bool where ... Source #

Since: 0.2.1.0

Equations

IsROrEmpty "" = True 
IsROrEmpty x = IsR x 

type family RemoveRs (s :: [Symbol]) :: [Symbol] where ... Source #

>>> :kind! RemoveRs '["r-UPPER", "enc-test", "r-lower", "do-UPPER"]
...
= '["enc-test", "do-UPPER"]

Equations

RemoveRs '[] = '[] 
RemoveRs (x ': xs) = If (OrdBool (CmpSymbol "r-" (Take 2 x))) (RemoveRs xs) (x ': RemoveRs xs) 

type family IsEnc (s :: Symbol) :: Bool where ... Source #

>>> :kind! IsEnc "enc-boo"
...
= 'True

Since: 0.4.1.0

Equations

IsEnc s = AcceptEq (Text "Not enc- encoding " :<>: ShowType s) (CmpSymbol "enc-" (Take 4 s))