typed-encoding-0.3.0.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.

type Algorithm nm alg = AlgNm nm ~ alg Source #

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"

Equations

AlgNm encnm = TakeUntil encnm ":" 

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

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 ... 

Equations

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

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

Equations

IsROrEmpty "" = True 
IsROrEmpty x = IsR x