Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Module defines CheckedEnc
- untyped ADT version of Enc
Synopsis
- data CheckedEnc conf str = MkCheckedEnc [EncAnn] conf str
- unsafeCheckedEnc :: [EncAnn] -> c -> s -> CheckedEnc c s
- getCheckedPayload :: CheckedEnc conf str -> str
- getCheckedEncPayload :: CheckedEnc conf str -> ([EncAnn], str)
- toCheckedEnc :: forall xs c str. SymbolList xs => Enc xs c str -> CheckedEnc c str
- fromCheckedEnc :: forall xs c str. SymbolList xs => CheckedEnc c str -> Maybe (Enc xs c str)
- proc_toCheckedEncFromCheckedEnc :: forall xs c str. (SymbolList xs, Eq c, Eq str) => CheckedEnc c str -> Bool
- proc_fromCheckedEncToCheckedEnc :: forall xs c str. (SymbolList xs, Eq c, Eq str) => Enc xs c str -> Bool
Documentation
>>>
:set -XOverloadedStrings -XMultiParamTypeClasses -XDataKinds -XAllowAmbiguousTypes
>>>
import qualified Data.Text as T
Untyped Enc
data CheckedEnc conf str Source #
Represents some validated encoded string.
CheckedEnc
is untyped version of Enc
.
CheckedEnc
contains verified encoded data, encoding is visible
at the value level only.
MkCheckedEnc [EncAnn] conf str |
Instances
(Eq conf, Eq str) => Eq (CheckedEnc conf str) Source # | |
Defined in Data.TypedEncoding.Internal.Types.CheckedEnc (==) :: CheckedEnc conf str -> CheckedEnc conf str -> Bool # (/=) :: CheckedEnc conf str -> CheckedEnc conf str -> Bool # | |
(Show conf, Show str) => Show (CheckedEnc conf str) Source # | |
Defined in Data.TypedEncoding.Internal.Types.CheckedEnc showsPrec :: Int -> CheckedEnc conf str -> ShowS # show :: CheckedEnc conf str -> String # showList :: [CheckedEnc conf str] -> ShowS # | |
(Show c, Displ str) => Displ (CheckedEnc c str) Source # |
|
Defined in Data.TypedEncoding.Internal.Types.CheckedEnc displ :: CheckedEnc c str -> String Source # |
unsafeCheckedEnc :: [EncAnn] -> c -> s -> CheckedEnc c s Source #
getCheckedPayload :: CheckedEnc conf str -> str Source #
getCheckedEncPayload :: CheckedEnc conf str -> ([EncAnn], str) Source #
toCheckedEnc :: forall xs c str. SymbolList xs => Enc xs c str -> CheckedEnc c str Source #
fromCheckedEnc :: forall xs c str. SymbolList xs => CheckedEnc c str -> Maybe (Enc xs c str) Source #
proc_toCheckedEncFromCheckedEnc :: forall xs c str. (SymbolList xs, Eq c, Eq str) => CheckedEnc c str -> Bool Source #
>>>
let encsometest = MkCheckedEnc ["TEST"] () $ T.pack "hello"
>>>
proc_toCheckedEncFromCheckedEnc @'["TEST"] encsometest
True>>>
proc_toCheckedEncFromCheckedEnc @'["TEST1"] encsometest
False
proc_fromCheckedEncToCheckedEnc :: forall xs c str. (SymbolList xs, Eq c, Eq str) => Enc xs c str -> Bool Source #
>>>
let enctest = unsafeSetPayload () "hello" :: Enc '["TEST"] () T.Text
>>>
proc_fromCheckedEncToCheckedEnc enctest
True