typed-encoding-0.2.1.0: Type safe string transformations

Safe HaskellSafe
LanguageHaskell2010

Data.TypedEncoding.Combinators.Restriction.Common

Description

Common combinators used across encodings.

Since: 0.2.1.0

Synopsis

Documentation

>>> :set -XOverloadedStrings -XMultiParamTypeClasses -XDataKinds -XTypeApplications

decFR :: (IsR s ~ True, Applicative f) => Enc (s ': xs) c str -> f (Enc xs c str) Source #

Universal decode for all "r-" types

recWithEncR :: forall (s :: Symbol) xs c str. IsR s ~ True => (Enc xs c str -> Either EncodeEx (Enc (s ': xs) c str)) -> Enc xs c str -> Either RecreateEx (Enc (s ': xs) c str) Source #

Manual recreate step combinator converting typical encode function to a recreate step

unsafeRecWithEncR :: forall (s :: Symbol) xs c str. (Enc xs c str -> Either EncodeEx (Enc (s ': xs) c str)) -> Enc xs c str -> Either RecreateEx (Enc (s ': xs) c str) Source #

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