!      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~        !"#$%&'()*+,-./0123456789: ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W!X!Y!Z!["\"]"^"_"`"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z"{"|#}#~$$%%%%%%%%%%%&&&&&&&&''''''''''''''''''''''(((((((((((((((((((((((((((((((((())))).Safe=?Xk typed-encodingIThis class will be removed in 0.3.x.x in favor of classes definined in 8Data.TypedEncoding.Internal.Class.Util.StringConstraints Reverses laws: : toString . fromString == id fromString . toString == id _Note: ByteString is not a valid instance, ByteString "r-ASCII", or "r-UTF8" would be needed. #B.unpack $ B.pack "160688" == "176"typed-encoding0prop_toStringFromString (Proxy :: Proxy TL.Text) prop_fromStringToString @TL.Texttyped-encoding/prop_toStringFromString (Proxy :: Proxy T.Text)prop_fromStringToString @T.TextSafe-.=>?@AHUVXk5utyped-encodingUsed to find exceptions that violated "r-" encoding Expected to be used to check encoding of ASCII-7 so Text and ByteString are compatible.typed-encodingSame as ToStrInj but with additionallaw for types that are also IsString:  fromString . toString == id typed-encoding Reverses law for types that are also IsString:  toString . fromString == id _Note: ByteString is not a valid instance, ByteString "r-ASCII", or "r-UTF8" would be needed. %B8.unpack $ B8.pack "160688" == "176"This class is separated from ToStrIso to allow instances from smaller types the can inject into the  type.typed-encoding0prop_toStringFromString (Proxy :: Proxy TL.Text) typed-encoding/prop_toStringFromString (Proxy :: Proxy T.Text) typed-encoding prop_fromStringToString @TL.Text typed-encodingprop_fromStringToString @T.Texttyped-encodingLB8.pack is basically a convenient way to get Word8 elements into ByteString.pDuring B8.pack conversion charters are downsized to the 0-255 range (become a Word8). The length is preserved. B8.pack "\160582""F"B.length $ B8.pack "\160582"1OThis instance allows to check elements of ByteString interpreting them as Char.ZThis may or may not work with UTF8 conversions. Safe if restricting to 7bit code points.sSafe6typed-encoding+Represents value level (single) annotation.Safe-.=>?@AHUVXk<typed-encoding/Polymorphic data payloads used to encode/decodetyped-encoding,TODO should this be imported from somewhere?typed-encodingHuman friendly version of Showtyped-encoding!symbolVals @ '["FIRST", "SECOND"]["FIRST","SECOND"]typed-encoding*displ (Proxy :: Proxy ["FIRST", "SECOND"])"[FIRST,SECOND]""typed-encodingTODO 0.3 TO BE REMOVEDSafe&'-.=>?HUVXB%typed-encodingconstructor is to be treated as Unsafe to Encode and Decode instance implementations particular encoding instances may expose smart constructors for limited data types6typed-encodingElet disptest = unsafeSetPayload () "hello" :: Enc '["TEST"] () T.Textdispl disptest"MkEnc '[TEST] () (Text hello)"$%&'()*+,-./012345$%&'()*+,-./012345Safe &'1SXkM9typed-encoding*Represents some validated encoded string.  CheckedEnc is untyped version of $.  CheckedEncN contains verified encoded data, encoding is visible at the value level only.@typed-encoding;let encsometest = MkCheckedEnc ["TEST"] () $ T.pack "hello"6proc_toCheckedEncFromCheckedEnc @'["TEST"] encsometestTrue7proc_toCheckedEncFromCheckedEnc @'["TEST1"] encsometestFalseAtyped-encodingDlet enctest = unsafeSetPayload () "hello" :: Enc '["TEST"] () T.Text'proc_fromCheckedEncToCheckedEnc enctestTrueBtyped-encoding8displ $ unsafeCheckedEnc ["TEST"] () ("hello" :: T.Text)%"MkCheckedEnc [TEST] () (Text hello)" 9:;<=>?@A 9:;<=>?@ASafe&'-.=>?HUVXkREtyped-encoding@Represents some encoded string where encoding was not validated. Similar to * but unlike  CheckedEnc4 it can contain payloads that have invalid encoding.Jtyped-encoding6displ $ MkUncheckedEnc ["TEST"] () ("hello" :: T.Text)'"MkUncheckedEnc [TEST] () (Text hello)"EFGHIEFGHISafe&'-.=>?HUVXYMtyped-encodingType safety over encodings makes decoding process safe. However failures are still possible due to bugs or unsafe payload modifications. UnexpectedDecodeEx represents such errors.Otyped-encodingRepresents errors in encodingQtyped-encoding<Represents errors in recovery (recreation of encoded types).Vtyped-encoding.Useful when manually recreating using recovery1$%&'()*+,-./0123459:;<=>?@AEFGHIMNOPQRSTUVWXYZ[\MNOPQRSTUVWXYZ[\ Safe-.>HXm`typed-encodingallows to fold payload in Enc to create another Enc, assumes homogeneous input encodings. This yields not a type safe code, better implementation code should use fixed size dependently typed Vect n or some HList like foldable.atyped-encoding Similar to `', assumes that destination payload has IsString instance and uses "" as base case. btyped-encoding Similar to `, works with untyped 9ctyped-encoding Similar to a, works with untyped 9dtyped-encoding0Splits composite payload into homogenious chunksetyped-encodingUntyped version of dftyped-encoding1sometimes show . read is not identity, eg. Word8:read "256" :: Word804verifyWithRead @Word8 "Word8-decimal" (T.pack "256")9Left "Payload does not satisfy format Word8-decimal: 256"4verifyWithRead @Word8 "Word8-decimal" (T.pack "123") Right "123"gtyped-encoding%Convenience function for checking if str decodes properly using encJ encoding markers and decoders that can pick decoder based on that markergtyped-encoding"proxy defining encoding annotationtyped-encodingfinds encoding marker enc for given annotation or failstyped-encodingdecoder based on enc markertyped-encodinginput`abcdefg`abcdefg Safe-.=>?@AHUVXrhtyped-encodingERecovery errors are expected unless Recovery allows Identity instancemtyped-encoding=Used to safely recover encoded data validating all encodingssptyped-encoding&Useful for partially manual recreationhijlkmnopqrstumnjlkopqrshitu Safe-.>HXktytyped-encoding*Maybe signals annotation mismatch, effect f' is not evaluated unless there is matchyzyz Safe-.=>?@AHUVXw,typed-encodingffor some reason ApplyTypes syntax does not want to work if xs is specified with polymorphic [Symbol] {|}~ }~{| Safe-.=>?@AHUVXz|typed-encodingWith type safety in place decoding errors should be unexpected. This class can be used to provide extra info if decoding could fail Safe &'-.=?HUV}(typed-encoding_Allows to operate within Enc. These are considered unsafe. keeping the same list of encodings Safe&'SXrtyped-encodingCSometimes is easier to pass around a proxy than do TypeApplicationstyped-encoding explicit mapMSafe &'-.HSUVX(Safe&'SXtyped-encoding%Existentially quantified quanitified Enc effectively isomorphic to 9typed-encodingDlet enctest = unsafeSetPayload () "hello" :: Enc '["TEST"] () T.Text#someToChecked . MkSomeEnc $ enctest MkCheckedEnc ["TEST"] () "hello"typed-encoding-let tst = unsafeCheckedEnc ["TEST"] () "test"displ $ checkedToSome tst"Some (MkEnc '[TEST] () test)"typed-encodingDlet enctest = unsafeSetPayload () "hello" :: Enc '["TEST"] () T.Textdispl $ MkSomeEnc enctest&"Some (MkEnc '[TEST] () (Text hello))"Safe-.=>?@AHUVXtyped-encoding :kind! UnSnoc '["1","2","3"] typed-encoding0Concat (Snoc '["1","2","3"] "4") ... = "1234"typed-encoding:kind! LLast '["1","2","3"]...= "3"typed-encoding :kind! LTake 3 (ToList "123456")typed-encoding:kind! Take 3 "123456"typed-encoding<:kind! LDrop 6 (ToList "bool: "r-ban:ff-ff" | "r-ban:ffff"")typed-encodingE:kind! Concat (LDrop 6 (ToList "bool: "r-ban:ff-ff" | "r-ban:ffff""))Safe&'-.=>?@AHUVX typed-encodingmore permissive than classtyped-encodingDEPRECATED see eSubsets are useful for restriction encodings like r-UFT8 but should not be used for other encodings.SThis would be dangerous, it would, for example, permit converting encoded binary "Enc '["enc-"] c ByteString to "Enc '["enc-"] c Text1, decoding which could result in runtime errors.iThe requirement is that that the decoding in the superset can replace the decoding from injected subset. 9instance Superset "r-ASCII" "enc-B64" where -- DANGEROUS  is identity on payloadsSuperset bigger smaller reads as bigger is a superset of smallertyped-encodingPremove redundant superset right after the top (at second last encoding position)bdispl $ demoteFlattenTop (unsafeSetPayload () "" :: Enc '["r-ASCII", "r-UTF8", "r-boo"] () T.Text)#"MkEnc '[r-ASCII,r-boo] () (Text )"typed-encoding"add redundant superset right afteredispl $ promoteUnFlattenTop @"r-UTF8" (unsafeSetPayload () "" :: Enc '["r-ASCII", "r-boo"] () T.Text)*"MkEnc '[r-ASCII,r-UTF8,r-boo] () (Text )"typed-encodingIremove redunant superset from the top (at last applied encoding position)adispl $ demoteRemoveTop (unsafeSetPayload () "" :: Enc '["r-UTF8", "r-ASCII", "r-boo"] () T.Text)#"MkEnc '[r-ASCII,r-boo] () (Text )"typed-encoding!add redundant superset at the top_displ $ promoteAddTop @"r-UTF8" (unsafeSetPayload () "" :: Enc '["r-ASCII", "r-boo"] () T.Text)*"MkEnc '[r-UTF8,r-ASCII,r-boo] () (Text )"typed-encoding=remove redundant superset at bottom (first encoding) positionadispl $ demoteRemoveBot (unsafeSetPayload () "" :: Enc '["r-boo", "r-ASCII", "r-UTF8"] () T.Text)#"MkEnc '[r-boo,r-ASCII] () (Text )"typed-encoding:add redundant superset at bottom (first encoding) position_displ $ promoteAddBot @"r-UTF8" (unsafeSetPayload () "" :: Enc '["r-boo", "r-ASCII"] () T.Text)*"MkEnc '[r-boo,r-ASCII,r-UTF8] () (Text )"typed-encodingEremove redundant superset at second bottom (second encoding) positionbdispl $ demoteFlattenBot (unsafeSetPayload () "" :: Enc '["r-boo", "r-UTF8", "r-ASCII"] () T.Text)#"MkEnc '[r-boo,r-ASCII] () (Text )"typed-encodingBadd redundant superset at second bottom (second encoding) positionedispl $ promoteUnFlattenBot @"r-UTF8" (unsafeSetPayload () "" :: Enc '["r-boo", "r-ASCII"] () T.Text)*"MkEnc '[r-boo,r-UTF8,r-ASCII] () (Text )" Safe&'-.=>?@AHUVXhktyped-encodingconstructor is to be treated as Unsafe to Encode and Decode instance implementations particular encoding instances may expose smart constructors for limited data typesSafe-.=>?@AHUVXktyped-encoding Flatten is more permissive than  6 instance FlattenAs "r-ASCII" "enc-B64" where -- OK Now encoded data has form Enc '["r-ASCII"] c str: and there is no danger of it begin incorrectly decoded.typed-encoding Reverse of  decodes encoded string back to atyped-encodingGeneralized Java toString% or a type safe version of Haskell's .Encodes a as  Enc '[xs].Hhijklmnopqrstu{|}~+Safe.@A’i$&'239;<=>?EFGHIMNOPQRSThijklmnopqrstuyz{|}~$9OPQRSMN23'&;<=>?T,Safeļ$%&'()*+,-./0123459:;<=>?@AEFGHIMNOPQRSTUVWXYZ[\`abcdefghijklmnopqrstu{|}~Safe-.=>?@AHUVXkSafe-.=>?@AHUVXhk۝typed-encoding>DEPRECATED will be removed in 0.3 empty string is valid utf8typed-encoding$| DEPRECATED will be removed in 0.3 use #- and .typed-encoding DEPRECATED$| DEPRECATED will be removed in 0.3 use #/ and 0See warning in "13Type-safer version of Data.Text.Encoding.decodeUtf8typed-encoding To be removedtyped-encodinghelper function checks that given ByteString, if is encoded as Left is must be not Utf8 decodable is is encoded as Right is must be Utf8 encodable typed-encodingYUTF8 encodings are defined for ByteString only as that would not make much sense for Text\encodeFAll . toEncoding () $ "\xc3\xb1" :: Either EncodeEx (Enc '["r-UTF8"] () B.ByteString)!Right (MkEnc Proxy () "\195\177")\encodeFAll . toEncoding () $ "\xc3\x28" :: Either EncodeEx (Enc '["r-UTF8"] () B.ByteString)rLeft (EncodeEx "r-UTF8" (Cannot decode byte '\xc3': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream))Following test uses Q helper that checks that bytes are encoded as Right iff they are valid UTF8 bytes\(b :: B.ByteString) -> verEncoding b (fmap (fromEncoding . decodeAll . proxiedId (Proxy :: Proxy (Enc '["r-UTF8"] _ _))) . (encodeFAll :: _ -> Either EncodeEx _). toEncoding () $ b) Safe .=>?@AUVXk܃Safe .=>?@AUVktyped-encodingDEPRECATED use $/ and 0Will be removed in 0.3.x.xSee warning in "1typed-encodingDEPRECATED use #/ and 0Will be removed in 0.3.x.xSee warning in "1typed-encoding|B64 encoded bytestring can be converted to Text as "enc-B64-nontext" preventing it from being B64-decoded directly to Texttyped-encodingEffectful instance for corruption detection. This protocol is used, for example, in emails. It is a well known encoding and hackers will have no problem making undetectable changes, but error handling at this stage could verify that email was corrupted.typed-encodingCallow to treat B64 encodings as ASCII forgetting about B64 encodingZlet tstB64 = encodeAll . toEncoding () $ "Hello World" :: Enc '["enc-B64"] () B.ByteString<displ (flattenAs tstB64 :: Enc '["r-ASCII"] () B.ByteString)3"MkEnc '[r-ASCII] () (ByteString SGVsbG8gV29ybGQ=)"  Safe.=>?@AHUVXkSafe-.HV+typed-encodingText is automatically "r-UTF8" encoded,typed-encodingFor 23 "r-UTF8" is redundant)*+,)*+,Safe-.HV-typed-encoding+This assumes that each of the encodings in xs work work equivalently in String and Text. .typed-encoding+This assumes that each of the encodings in xs work work equivalently in String and Text. /typed-encodingText is automatically "r-UTF8" encoded6displ $ utf8Promote $ toEncoding () ("text" :: T.Text) "MkEnc '[r-UTF8] () (Text text)"0typed-encodingFor  "r-UTF8" is redundantOdispl . utf8Demote $ (unsafeSetPayload () "Hello" :: Enc '["r-UTF8"] () T.Text)"MkEnc '[] () (Text Hello)"-./0-./0Safe-.>HV21typed-encodingType safe version of .t:t pack (undefined :: Enc '["r-bar", "r-ASCII"] () String) :t pack (undefined :: Enc '["r-bar", "r-foo"] () String)2typed-encodingType safe version of .1212Safe-.>HV3typed-encodingType safer version of 45.+This assumes that each of the encodings in xs work work equivalently in String and  ByteString.Because of how ByteString.Char8.packY works, the first encoding (last in the list) must restrict character set to a subset of ASCII. 8:t pack (undefined :: Enc '["r-bar", "r-foo"] () String)... ... error:... Couldn't match type ...... "r-ASCII" "r-foo" ......Qdispl $ pack (unsafeSetPayload () "Hello" :: Enc '["r-bar", "r-ASCII"] () String)."MkEnc '[r-bar,r-ASCII] () (ByteString Hello)"4typed-encodingunpack on encoded strings.See 33434Safe .=>?HUVX 6typed-encoding:kind! IsR "r-UPPER"... ... 'True:kind! IsR "do-UPPER"...= (TypeError ... 7typed-encoding#Universal decode for all "r-" types8typed-encoding+Manual recreate step combinator converting "r-"$ encode function to a recreate step.WFor "r-" encoding recreate and encode are the same other than the exception type used. The convention in typed-encoding3 is to implement encode and convert it to recreate.5678978965 Safe.=>?HUVXk, Dtyped-encoding):kind! RightTerm "boolSomeOp:(agag)(222)"...= "222" :kind! RightTerm "r-Int-decimal"...= ""Etyped-encoding(:kind! LeftTerm "boolSomeOp:(agag)(222)"...= "agag":kind! LeftTerm "r-Int-decimal"...= ""Ftyped-encodingreturns "" for unary operatorHtyped-encoding%:kind! NestedR "boolOr:(r-abc)(r-cd)"...= 'True>:kind! NestedR "boolOr:(boolAnd:(r-ab)(r-ac))(boolNot:(r-cd))"...= 'True<:kind! NestedR "boolOr:(boolAnd:(r-ab)(ac))(boolNot:(r-cd))"...... (TypeError ...)...Ktyped-encodingThis works fast with !kind@ but is much slower in declaration :kind! BoolOp "boolOr:()()"Ltyped-encoding3:kind! BoolOpIs "boolAnd:(someenc)(otherenc)" "and"...= 'TrueMtyped-encodingSee examples in PNtyped-encodingSee examples in POtyped-encodingPtyped-encoding:{dlet tst1, tst2, tst3 :: Either EncodeEx (Enc '["boolOr:(r-Word8-decimal)(r-Int-decimal)"] () T.Text)2 tst1 = encBoolOrLeft' . toEncoding () $ "212" 7 tst2 = encBoolOrRight' . toEncoding () $ "1000000" 5 tst3 = encBoolOrLeft' . toEncoding () $ "1000000":}tst1Right (MkEnc Proxy () "212")tst2 Right (MkEnc Proxy () "1000000")tst3\Left (EncodeEx "r-Word8-decimal" ("Payload does not satisfy format Word8-decimal: 1000000"))Rtyped-encoding"boolOr:(enc1)(enc2)"O contains strings that encode the same way under both encodings. for example "boolOr:(r-UPPER)(r-lower)" valid elements would include "123-34" but not "abc":{_let tst1, tst2 :: Either EncodeEx (Enc '["boolAnd:(r-Word8-decimal)(r-Int-decimal)"] () T.Text). tst1 = encBoolAnd' . toEncoding () $ "234"1 tst2 = encBoolAnd' . toEncoding () $ "100000":}tst1Right (MkEnc Proxy () "234")tst2[Left (EncodeEx "r-Word8-decimal" ("Payload does not satisfy format Word8-decimal: 100000"))Ttyped-encoding:{Plet tst1, tst2 :: Either EncodeEx (Enc '["boolNot:(r-Word8-decimal)"] () T.Text). tst1 = encBoolNot' . toEncoding () $ "334". tst2 = encBoolNot' . toEncoding () $ "127":}tst1Right (MkEnc Proxy () "334")tst2RLeft (EncodeEx "boolNot:(r-Word8-decimal)" ("Encoding r-Word8-decimal succeeded"))Utyped-encoding-Decodes boolean expression if all leaves are "r-":;<=>A?@BCDEFGHIJKLMNOPQRSTUVMNOPQRSTUVLKJIHGFEDCB>A?@=<;:!Safe.=>?@AHUVXk;Xtyped-encodingencFBan . toEncoding () $ "C59F9FB7-4621-44D9-9020-CE37BF6E2BD1" :: Either EncodeEx (Enc '["r-ban:FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"] () T.Text)=Right (MkEnc Proxy () "C59F9FB7-4621-44D9-9020-CE37BF6E2BD1")orecWithEncR encFBan . toEncoding () $ "211-22-9934" :: Either RecreateEx (Enc '["r-ban:999-99-9999"] () T.Text)$Right (MkEnc Proxy () "211-22-9934")Ytyped-encodingEverifyBoundedAlphaNum (Proxy :: Proxy "r-ban:FF-FF") (T.pack "12-3E") Right "12-3E"EverifyBoundedAlphaNum (Proxy :: Proxy "r-ban:FF-FF") (T.pack "1G-3E")Left "'G' not boulded by 'F'"EverifyBoundedAlphaNum (Proxy :: Proxy "r-ban:FF-FF") (T.pack "13G3E")Left "'G' not matching '-'"FverifyBoundedAlphaNum (Proxy :: Proxy "r-ban:FF-FF") (T.pack "13-234")GLeft "Input list has wrong size expecting 5 but length \"13-234\" == 6"WXYWXY6Safe &'-.=?HUV;"Safe.=>?@AHUVXkK0]typed-encodingDEPRECATED use $/Will be removed in 0.3.x.x:This is not type safe, for example, would allow converting*Enc `["r-ASCII", "enc-B64"] c B.ByteString$ containing B64 encoded binary to $Enc `["r-ASCII", "enc-B64"] c T.Text> and which then could be decoded causing unexpected error. ^typed-encodingDEPRECATED use #/Will be removed in 0.3.x.xsee ]_typed-encodingDEPRECATED use $-Will be removed in 0.3.x.x`typed-encodingDEPRECATED use #-Will be removed in 0.3.x.xxtyped-encodingDallow to treat ASCII encodings as UTF8 forgetting about B64 encodingUUTF-8 is backward compatible on first 128 characters using just one byte to store it.Payload does not change when ASCII only strings are encoded to UTF8 in types like  ByteString.olet Right tstAscii = encodeFAll . toEncoding () $ "Hello World" :: Either EncodeEx (Enc '["r-ASCII"] () T.Text)"displ (inject @ "r-UTF8" tstAscii)'"MkEnc '[r-UTF8] () (Text Hello World)"[\]^_`ab]^_`[\ab#Safe.>HVXK|}|}$Safe.>HVXZ~typed-encodingWith given constraints ~ and  can be used on subsets of "r-UTF8"Vdispl . decodeUtf8 $ (unsafeSetPayload () "Hello" :: Enc '["r-ASCII"] () B.ByteString)""MkEnc '[r-ASCII] () (Text Hello)""r-UTF8" is redundant:bdispl . utf8Demote . decodeUtf8 $ (unsafeSetPayload () "Hello" :: Enc '["r-UTF8"] () B.ByteString)"MkEnc '[] () (Text Hello)" decodeUtf8 and  encodeUtf8 form isomorphismR\x -> getPayload x == (getPayload . encodeUtf8 . decodeUtf8 @ '["r-UTF8"] @() $ x)R\x -> getPayload x == (getPayload . decodeUtf8 . encodeUtf8 @ '["r-UTF8"] @() $ x)/These nicely work as iso's for "r-ASCII" subsetS\x -> getPayload x == (getPayload . encodeUtf8 . decodeUtf8 @ '["r-ASCII"] @() $ x)S\x -> getPayload x == (getPayload . decodeUtf8 . encodeUtf8 @ '["r-ASCII"] @() $ x)typed-encodingCdispl $ encodeUtf8 $ utf8Promote $ toEncoding () ("text" :: T.Text)&"MkEnc '[r-UTF8] () (ByteString text)"~~%Safe .=>?@AHk typed-encodingExample value to play with`encodeFAll . toEncoding () $ "HeLlo world" :: Either EncodeEx (Enc '["r-ASCII"] () B.ByteString)$Right (MkEnc Proxy () "HeLlo world")typed-encodingabove with either removedtyped-encoding'We use a tween function to the popular 7/ from the test package.,Notice the encoding annotation is preserved.$displ $ EncTe.decodeUtf8 helloAsciiB("MkEnc '[r-ASCII] () (Text HeLlo world)"typed-encodingConsider 0-encoding of a , to move it to Enc '[] () String one could try:displ . EncT.pack $ helloZero"MkEnc '[] () (Text Hello)"this works, but:EncB8.pack helloZero... ... error: !... Empty Symbol list not allowed...+this does not compile. And it should not. pack from Data.ByteString.Char8d is error prone. It is not an injection as it only considers first 7 bits of information from each d. I doubt that there are any code examples of its intentional use on a String that is not ASCII.  EncB8.packF will not compile unless the encoding is ASCII restricted, this works:Sfmap (displ . EncB8.pack) . encodeFAll @(Either EncodeEx) @'["r-ASCII"] $ helloZero.Right "MkEnc '[r-ASCII] () (ByteString Hello)"And the result is a  ByteString. with bonus annotation describing its content.typed-encodingmore interstingly  EncB8.packJ works fine on "r-" encodings that are subsets of "r-ASCII" this example  "r-ban:zzzzz". restricts to 5 alapha-numeric charters all < zdispl <$> helloRestricted2Right "MkEnc '[r-ban:zzzzz] () (ByteString Hello)"Adding  "r-ASCII"? annotation on this ByteString would have been redundant since  "r-ban:zzzzz", is more restrictive (see Supersets below).unpackA, as expected will put us back in a String keeping the annotation+fmap (displ . EncB8.unpack) helloRestricted%Right "MkEnc '[r-ban:zzzzz] () Hello"typed-encoding/To get UTF8 annotation, instead of doing this: _encodeFAll . toEncoding () $ "HeLlo world" :: Either EncodeEx (Enc '["r-UTF8"] () B.ByteString)$Right (MkEnc Proxy () "HeLlo world")?We should be able to convert the ASCII version we already have.This is done using  typeclass. injectInto1 method accepts proxy to specify superset to use.)displ $ injectInto @ "r-UTF8" helloAsciiB-"MkEnc '[r-UTF8] () (ByteString HeLlo world)"Superset is intended for "r-"C annotations only, should not be used with general encodings like  "enc-B64"Z, it assumes that decoding in the superset can replace the decoding from injected subset.typed-encoding:We put Base64 on a ByteString which adheres to UTF8 layout<displ $ encodePart_ (Proxy :: Proxy '["enc-B64"]) helloUtf8B:"MkEnc '[enc-B64,r-UTF8] () (ByteString SGVMbG8gd29ybGQ=)"typed-encoding.. and copy it over to Text.&displ $ EncTe.decodeUtf8 helloUtf8B64B4"MkEnc '[enc-B64,r-UTF8] () (Text SGVMbG8gd29ybGQ=)"Cbut UTF8 would be redundant in Text so the "r-UTF8" can be dropped::displ . EncT.utf8Demote . EncTe.decodeUtf8 $ helloUtf8B64B-"MkEnc '[enc-B64] () (Text SGVMbG8gd29ybGQ=)"FConversely moving back to ByteString we need to recover the annotation!:t EncTe.encodeUtf8 helloUtf8B64T...'... Couldn't match type IsSupersetOpen... "r-UTF8" "enc-B64" ......@This is not allowed! We need to add the redundant "r-UTF8" back:<displ . EncTe.encodeUtf8 . EncT.utf8Promote $ helloUtf8B64T:"MkEnc '[enc-B64,r-UTF8] () (ByteString SGVMbG8gd29ybGQ=)"To achieve type safety, our  encodeUtf8 and  decodeUtf8* require "r-UTF8" annotation. But since Text values can always emit UTF8< layout, we can simply add and remove these annotations on TextY encodings. This approach gives us type level safety over UTF8 encoding/decoding errors.typed-encoding9 a binary, one that does not even represent a valid UTF8.JencodeAll . toEncoding () $ "\195\177" :: Enc '["enc-B64"] () B.ByteStringMkEnc Proxy () "w7E="0Decoding it to Text is prevented by the compiler:t EncTe.decodeUtf8 notTextB... ... error:... Couldn't match type ...... "r-UTF8" "enc-B64" ......2This is good because having the payload inside of Enc '["enc-B64"] () TextF would allow us to try to decode it to Text (causing runtime errors).We can move it to Text but to do that we will need to forget the "enc-B64" annotation. This can be done, for example, using flattening (see below).typed-encodingOrecreateAll . toEncoding () $ "abc==CB" :: Enc '["enc-B64-len"] () B.ByteStringMkEnc Proxy () "abc==CB"The rest of Haskell does lenient decoding, type safety allows this library to use it for recovery. lenient algorithms are not partial and automatically fix invalid input:`recreateFAll . toEncoding () $ "abc==CB" :: Either RecreateEx (Enc '["enc-B64"] () B.ByteString)/Left (RecreateEx "enc-B64" ("invalid padding"))QThis library allows to recover to "enc-B64-len" which is different than "enc-B64"89- allows to convert "enc-B64-len" to "enc-B64"-displ $ EnB64.acceptLenientS lenientSomething'"MkEnc '[enc-B64] () (ByteString abc=)"!This is now properly encoded data]recreateFAll . toEncoding () $ "abc=" :: Either RecreateEx (Enc '["enc-B64"] () B.ByteString)Right (MkEnc Proxy () "abc=")&Except the content could be surprising1decodeAll $ EnB64.acceptLenientS lenientSomethingMkEnc Proxy () "i\183"typed-encodingBase 64 encodes binary data as ASCII text. thus, we should be able to treat "enc-B64" as "r-ASCII" losing some information. this is done using  type class&:t flattenAs @ "r-ASCII" helloUtf8B64B#flattenAs @ "r-ASCII" helloUtf8B64B'... :: Enc '["r-ASCII"] () B.ByteString  &Safe .=>?@AUVXkCtyped-encoding6encoding function, typically should be module private typed-encoding,dual purpose decoding and recovery function.(This typically should be module private.decodeSign "3:abc" Right "abc"decodeSign "4:abc"Left "Corrupted Signature"typed-encodingEncoded hello world example. helloSignedMkEnc Proxy () "11:Hello World"&fromEncoding . decodeAll $ helloSigned "Hello World"typed-encodingproperty checks that > values are expected to decode without error after encoding.\t -> propEncDectyped-encodingJHacker example The data was transmitted over a network and got corrupted.0let payload = getPayload $ helloSigned :: T.Text%let newpay = payload <> " corruption"WrecreateFAll . toEncoding () $ newpay :: Either RecreateEx (Enc '["my-sign"] () T.Text)3Left (RecreateEx "my-sign" ("Corrupted Signature"))XrecreateFAll . toEncoding () $ payload :: Either RecreateEx (Enc '["my-sign"] () T.Text)'Right (MkEnc Proxy () "11:Hello World")typed-encodingRecreation allows effectful f? to check for tampering with data. Implementation simply uses *% combinator on the recovery function.typed-encodingDecoding allows effectful f9 to allow for troubleshooting and unsafe payload changes.Implementation simply uses ) combinator on the # composed with decoding function.  has Identity instance allowing for decoding that assumes errors are not possible. For debugging purposes or when unsafe changes to "my-sign" Error UnexpectedDecodeEx instance can be used.typed-encodingdBecause encoding function is pure we can create instance of EncodeF that is polymorphic in effect f. This is done using - combinator.'Safe.@Ak!`typed-encodingExample configurationtyped-encoding"Hello World" encoded as Base64helloB64!MkEnc Proxy () "SGVsbG8gV29ybGQ="displ helloB643"MkEnc '[enc-B64] () (ByteString SGVsbG8gV29ybGQ=)"MencodeAll . toEncoding () $ "Hello World" :: Enc '["enc-B64"] () B.ByteString!MkEnc Proxy () "SGVsbG8gV29ybGQ="UThere is currently an alternative polymorphic way (prototype) to create encodings by running  on c. This approach works better with more open / dynamic encoding setup it also provides first class Encoderz. In future versions encodeAll will either be improved to provide similar flexibility or will be deprecated and removed.|displ <$> (runEncoder @'["enc-B64"] encodings $ toEncoding () "Hello" :: Either EncodeEx (Enc '["enc-B64"] () B.ByteString))1Right "MkEnc '[enc-B64] () (ByteString SGVsbG8=)"typed-encoding!Previous text decoded from Base64#fromEncoding . decodeAll $ helloB64 "Hello World"typed-encodingl allows for recovering data at program boundaries (for example, when parsing JSON input). It makes sure that the content satisfies specified encodings.irecreateFAll . toEncoding () $ "SGVsbG8gV29ybGQ=" :: Either RecreateEx (Enc '["enc-B64"] () B.ByteString))Right (MkEnc Proxy () "SGVsbG8gV29ybGQ=")hrecreateFAll . toEncoding () $ "SGVsbG8gV29ybGQ" :: Either RecreateEx (Enc '["enc-B64"] () B.ByteString)/Left (RecreateEx "enc-B64" ("invalid padding"));The above example start by placing payload in zero-encoded  Enc '[] () type and then apply lD this is a good way to recreate encoded type if encoding is known. If is it not, E type can be used. (See :; for better example).7This module is concerned only with the first approach. Llet unchecked = toUncheckedEnc ["enc-B64"] () ("SGVsbG8gV29ybGQ=" :: T.Text)+verifyUncheckedEnc' @'["enc-B64"] unchecked0Just (Right (MkEnc Proxy () "SGVsbG8gV29ybGQ="))typed-encodingx"Hello World" double-Base64 encoded. Notice the same code used as in single encoding, the game is played at type level.WencodeAll . toEncoding () $ "Hello World" :: Enc '["enc-B64","enc-B64"] () B.ByteString)MkEnc Proxy () "U0dWc2JHOGdWMjl5YkdRPQ=="displ helloB64B64C"MkEnc '[enc-B64,enc-B64] () (ByteString U0dWc2JHOGdWMjl5YkdRPQ==)"typed-encodingFDouble Base64 encoded "Hello World" with one layer of encoding removedJdecodePart @'["enc-B64"] $ helloB64B64 :: Enc '["enc-B64"] () B.ByteString!MkEnc Proxy () "SGVsbG8gV29ybGQ="!helloB64B64PartDecode == helloB64Truetyped-encoding all the way to *Notice a similar polymorphism in decoding.6fromEncoding . decodeAll $ helloB64B64 :: B.ByteString "Hello World""We can also decode all the parts: ?fromEncoding . decodePart @'["enc-B64","enc-B64"] $ helloB64B64 "Hello World"typed-encoding9what happens when we try to recover encoded once text to Enc '["enc-B64", "enc-B64"]. CAgain, notice the same expression is used as in previous recovery. trecreateFAll . toEncoding () $ "SGVsbG8gV29ybGQ=" :: Either RecreateEx (Enc '["enc-B64", "enc-B64"] () B.ByteString)/Left (RecreateEx "enc-B64" ("invalid padding"))typed-encoding"do-UPPER" (from <=* module) encoding applied to "Hello World"Notice a namespace thing going on, "enc-" is encoding, "do-" is some transformation. These are typically not reversible, some could be recoverable.FThe same code is used as in "enc-" examples to encode (now transform).HencodeAll . toEncoding () $ "Hello World" :: Enc '["do-UPPER"] () T.TextMkEnc Proxy () "HELLO WORLD"typed-encodingSample compound transformation VencodeAll . toEncoding () $ "HeLLo world" :: Enc '["do-reverse", "do-Title"] () T.TextMkEnc Proxy () "dlroW olleH" typed-encoding is needed in following examplestyped-encoding9Configuration can be used to impact the encoding process.So far we had used () as configuration of all encodings. But since both "do-reverse", "do-Title" are polymorphic in configuration we can also do this:cencodeAll . toEncoding exampleConf $ "HeLLo world" :: Enc '["do-reverse", "do-Title"] Config T.TextLMkEnc Proxy (Config {sizeLimit = SizeLimit {unSizeLimit = 8}}) "dlroW olleH"tencodeAll . toEncoding exampleConf $ "HeLlo world" :: Enc '["do-size-limit", "do-reverse", "do-Title"] Config T.TextIMkEnc Proxy (Config {sizeLimit = SizeLimit {unSizeLimit = 8}}) "dlroW ol"#Instead, encode previously defined & by reversing it and adding size limityencodePart @'["do-size-limit", "do-reverse"] helloTitle :: Enc '["do-size-limit", "do-reverse", "do-Title"] Config T.TextIMkEnc Proxy (Config {sizeLimit = SizeLimit {unSizeLimit = 8}}) "dlroW ol"typed-encoding#... and we unwrap the B64 part only(decodePart @'["enc-B64"] $ helloLimitB64IMkEnc Proxy (Config {sizeLimit = SizeLimit {unSizeLimit = 8}}) "HeLlo wo"typed-encoding4ASCII char set ByteStrings are sequences of Bytes (>?Q). The type is very permissive, it may contain binary data such as jpeg picture."r-ASCII" encoding acts as partial identity function it does not change any bytes in bytestring but it fails if a byte is outside of ASCII range (in Either monad).GNote naming thing: "r-" is partial identity ("r-" is from restriction).`encodeFAll . toEncoding () $ "HeLlo world" :: Either EncodeEx (Enc '["r-ASCII"] () B.ByteString)$Right (MkEnc Proxy () "HeLlo world")typed-encodingUArguably the type we used for helloB64 was too permissive. a better version is here:kencodeFAll . toEncoding () $ "Hello World" :: Either EncodeEx (Enc '["enc-B64", "r-ASCII"] () B.ByteString)*Right (MkEnc Proxy () "SGVsbG8gV29ybGQ=") typed-encoding*decodePart @'["enc-B64"] <$> helloAsciiB64$Right (MkEnc Proxy () "Hello World")(Safe.456=>?@AXhksR typed-encoding4This section shows a type safe processing of emails.C is an over-simplified email type, it has parts that can be either )binary and have to be Base 64 encoded or 6are text that have either UTF8 or ASCII character set NThe text parts can be optionally can be Base 64 encoded but do not have to be.mFor simplicity, the layout of simplified headers is assumed the same as encoding annotations in this library.typed-encodingSimplified Email header typed-encodingSimplified Part header typed-encodingIn this example all data fields have the same type. This simplifies encoding work as all fields will be encoded the same way. We use IP address since all fields are single byte size.typed-encodingtstEmail' contains some simple data to play withtyped-encodingThis example encodes fields in  into an untyped version of Enc_ which stores verified encoded data and encoding information is stored at the value level: CheckedEnc () B.ByteString.%Part of email are first converted to EA (that stores encoding information at the value level as well). E. that can easily represent parts of the email let part = parts tstEmail L.!! 2part-(["enc-B64","r-UTF8"],"U29tZSBVVEY4IFRleHQ=")7let unchecked = toUncheckedEnc (fst part) () (snd part) unchecked=MkUncheckedEnc ["enc-B64","r-UTF8"] () "U29tZSBVVEY4IFRleHQ=" We can play  () game (we acually use Maybe) with final option being a Q error:7verifyUncheckedEnc' @'["enc-B64","r-ASCII"] $ uncheckedNothing6verifyUncheckedEnc' @'["enc-B64","r-UTF8"] $ unchecked4Just (Right (MkEnc Proxy () "U29tZSBVVEY4IFRleHQ="))Since the data is heterogeneous (each piece has a different encoding annotation), we need wrap the result in another plain ADT: 9.9 is similar to Ec with the difference that the only (safe) way to get values of this type is from properly encoded $ values. Using ; would break type safety here. YIt is important to handle all cases during encoding so decoding errors become impossible.vAgain, use of dependently typed variant types that could enumerate all possible encodings would made this code nicer.typed-encodingNExample decodes parts of email that are base 64 encoded text and nothing else.This provides a type safety assurance that we do not decode certain parts of email (like trying to decode base 64 on a plain text part).2decodeB64ForTextOnly <$> recreateEncoding tstEmailRight (SimplifiedEmailF {emailHeader = "Some Header", parts = [MkCheckedEnc ["enc-B64"] () "U29tZSBBU0NJSSBUZXh0",MkCheckedEnc ["r-ASCII"] () "Some ASCII Text",MkCheckedEnc ["r-UTF8"] () "Some UTF8 Text",MkCheckedEnc ["r-ASCII"] () "Some ASCII plain text"]}) Combinator &fromCheckedEnc @'["enc-B64", "r-UTF8"]( acts as a selector and picks only the ["enc-B64", "r-UTF8"] values from our  type.  We play the (K) game on all the selectors we want picking and decoding right pieces only."Imagine this is one of the pieces:^let piece = unsafeCheckedEnc ["enc-B64","r-ASCII"] () ("U29tZSBBU0NJSSBUZXh0" :: B.ByteString) displ pieceE"MkCheckedEnc [enc-B64,r-ASCII] () (ByteString U29tZSBBU0NJSSBUZXh0)"This code will not pick it up:/fromCheckedEnc @ '["enc-B64", "r-UTF8"] $ pieceNothingBut this one will:1fromCheckedEnc @ '["enc-B64", "r-ASCII"] $ piece,Just (MkEnc Proxy () "U29tZSBBU0NJSSBUZXh0")3so we can apply the decoding on the selected piece afmap (toCheckedEnc . decodePart @'["enc-B64"]) . fromCheckedEnc @ '["enc-B64", "r-ASCII"] $ piece4Just (MkCheckedEnc ["r-ASCII"] () "Some ASCII Text")typed-encoding*Provides easy to read encoding informationtyped-encoding-let enc = toEncString @"r-IPv4" @T.Text tstIpfromEncString @IpV4 enc1IpV4F {oct1 = 128, oct2 = 1, oct3 = 1, oct4 = 10}To get / out of the string we need to reverse previous reduce'. This is currently done using helper d combinator. FEnT.splitPayload @ '["r-Word8-decimal"] (T.splitOn $ T.pack ".") $ encP[MkEnc Proxy () "128",MkEnc Proxy () "1",MkEnc Proxy () "1",MkEnc Proxy () "10"]cThe conversion of a list to IpV4F needs handle errors but these errors are considered unexpected.\Note, again, the error condition exposed by this implementation could have been avoided if d returned fixed size Vect 4.typed-encodingIn this example  toEncString converts  to Enc '["r-IPv4"] Text.#This is done with help of existing "r-Word8-decimal" annotation defined in /Data.TypedEncoding.Instances.Restriction.Common#toEncString @"r-IPv4" @T.Text tstIpMkEnc Proxy () "128.1.1.10"JImplementation is a classic map reduce where reduce is done with help of a1let fn a b = if b == "" then a else a <> "." <> bDlet reduce = EnT.foldEncStr @'["r-IPv4"] @'["r-Word8-decimal"] () fn)displ . reduce . fmap toEncString $ tstIp"MkEnc '[r-IPv4] () 128.1.1.10"\Note lack of type safety here, the same code would work just fine if we added 5th field to  constructor. (Using something like a dependently typed ,Vect 4 (Enc '["r-Word8-decimal"] () T.Text) %would have improved this situation. HList: could be used for record types with heterogeneous fields. Currently, 'type-encoding'. library does not have these types in scope. typed-encoding*Provides easy to read encoding information)Safe .=>?@AUV2typed-encodingStarting exampletyped-encodingwith either removedtyped-encodingl- is the way to recover encoding in a safe way!let payload = getPayload exAsciiT/let newPayload = payload <> " some extra stuff"[recreateFAll . toEncoding () $ newPayload :: Either RecreateEx (Enc '["r-ASCII"] () T.Text)/Right (MkEnc Proxy () "HELLO some extra stuff")Alternatively, E% type can be used in recreation, see :@typed-encodingThe issue with l is that it may be expensive.This apprach uses 6AB to perform (in general risky) operation on the internal payload. exAsciiTERight (MkEnc Proxy () "HELLO")7exAsciiTE >>= pure . Unsafe.withUnsafe (fmap T.toLower)Right (MkEnc Proxy () "hello")Example uses of H within encoded data this operation is safe for ASCII restriction but Enc '["r-ASCII"] () T.TextV does not expose it We use Functor instance of Unsafe wrapper type to accomplish thistyped-encoding-Similar example uses applicative instance of let Right hELLO = exAsciiTElet Right hello = toLowerAsciiOdispl $ Unsafe.runUnsafe ((<>) <$> Unsafe.Unsafe hELLO <*> Unsafe.Unsafe hello)'"MkEnc '[r-ASCII] () (Text HELLOhello)":Safe?BSafeCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{*|}~         AA     ; !"1#$%&'()*+,-./0)*+-./1&"%123495*)6.-789:;<=>?,@ABCDDE67;?FGH*IJKLM5N.05N.05N5NOPQRS T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p!q!r!s!t"u"u"1"&"""%"v"w")"*"+","-"."/"0":"8"x"y">"9"z"{"|"<"}"~"""""#/#-$/$-%%%%%%%%%%%&&&&&&*&)&6''''''''''''''''''''''(((((((((((((((((((((((((((((((((()))))35NBBBBBBBB-typed-encoding-0.2.2.0-8hGFy9JhFd14sLqh0snEVv+Data.TypedEncoding.Internal.Class.IsStringR8Data.TypedEncoding.Internal.Class.Util.StringConstraints(Data.TypedEncoding.Internal.Types.Common&Data.TypedEncoding.Internal.Class.Util%Data.TypedEncoding.Internal.Types.Enc,Data.TypedEncoding.Internal.Types.CheckedEnc.Data.TypedEncoding.Internal.Types.UncheckedEnc!Data.TypedEncoding.Internal.Types1Data.TypedEncoding.Internal.Instances.Combinators*Data.TypedEncoding.Internal.Class.Recreate'Data.TypedEncoding.Internal.Combinators(Data.TypedEncoding.Internal.Class.Encode(Data.TypedEncoding.Internal.Class.Decode(Data.TypedEncoding.Internal.Types.Unsafe Data.TypedEncoding.Internal.Util0Data.TypedEncoding.Internal.Types.SomeAnnotation)Data.TypedEncoding.Internal.Types.SomeEnc)Data.TypedEncoding.Internal.Util.TypeLits*Data.TypedEncoding.Internal.Class.Superset)Data.TypedEncoding.Internal.Class.Encoder!Data.TypedEncoding.Internal.Class/Data.TypedEncoding.Instances.ToEncString.Common-Data.TypedEncoding.Instances.Restriction.UTF8/Data.TypedEncoding.Instances.Restriction.Common'Data.TypedEncoding.Instances.Enc.Base64&Data.TypedEncoding.Instances.Do.Sample!Data.TypedEncoding.Conv.Text.LazyData.TypedEncoding.Conv.Text-Data.TypedEncoding.Conv.ByteString.Lazy.Char8(Data.TypedEncoding.Conv.ByteString.Char81Data.TypedEncoding.Combinators.Restriction.Common/Data.TypedEncoding.Combinators.Restriction.Bool;Data.TypedEncoding.Combinators.Restriction.BoundedAlphaNums.Data.TypedEncoding.Instances.Restriction.ASCII*Data.TypedEncoding.Conv.Text.Lazy.Encoding%Data.TypedEncoding.Conv.Text.Encoding"Examples.TypedEncoding.Conversions&Examples.TypedEncoding.DiySignEncodingExamples.TypedEncoding.Overview"Examples.TypedEncoding.ToEncStringExamples.TypedEncoding.Unsafe CheckedEncData.TypedEncoding$Data.TypedEncoding.Instances.Support encodeUtf8 utf8Promote decodeUtf8 utf8DemotebyteString2TextSTTextData.ByteString.Char8packData.TypedEncoding.UnsafeData.Text.EncodingEnB64acceptLenientSExamples.TypedEncoding ToEncStringData.TypedEncoding.Instances.DoSample Data.WordWord8OverviewUnsafePaths_typed_encoding IsStringRtoStringprop_fromStringToStringprop_toStringFromString $fIsStringR[]$fIsStringRText$fIsStringRText0$fToStrInj[][]$fToStrInj[]Text$fToStrInj[]Text0$fToStrIso[][]$fToStrIso[]Text$fToStrIso[]Text0$fChar7FindByteString$fChar7FindByteString0$fChar7FindText$fChar7FindText0EncAnnHasAhasAppendDispldispl SymbolList symbolVals symbolVals_ $fSymbolList:$fSymbolList[] $fDisplProxy$fDisplByteString$fDisplByteString0 $fDisplText $fDisplText0 $fDispl[] $fDispl[]0 $fHasA()cEncMkEnc toEncoding fromEncoding implTranF implDecodeFimplCheckPrevF implTranF' implDecodeF' implTranP implEncodeP implTranP' implEncodeP' implChangeAnn getPayloadunsafeSetPayloadwithUnsafeCoerceunsafeChangePayload $fDisplEnc $fShowEnc$fEqEnc MkCheckedEncunsafeCheckedEncgetCheckedPayloadgetCheckedEncPayload toCheckedEncfromCheckedEncproc_toCheckedEncFromCheckedEncproc_fromCheckedEncToCheckedEnc$fDisplCheckedEnc$fShowCheckedEnc$fEqCheckedEnc UncheckedEncMkUncheckedEnctoUncheckedEncgetUncheckedEncAnn verifyAnn$fDisplUncheckedEnc$fShowUncheckedEnc$fEqUncheckedEncUnexpectedDecodeExEncodeEx RecreateExRecreateExUnkSteprecreateErrUnknown asEncodeEx encToRecrEx mergeEncodeEx emptyEncErr implEncodeF_ implEncodeF implEncodeF_' mergeErrs$fShowRecreateEx$fShowEncodeEx$fShowUnexpectedDecodeExfoldEnc foldEncStrfoldCheckedEncfoldCheckedEncStr splitPayloadsplitSomePayloadverifyWithRead verifyDynEnc RecreateErr recoveryErr RecreateFAll checkFAll recreateFAll RecreateF checkPrevF recreateAllrecreateFPart_ recreateFPart recreatePart_ recreatePartasRecreateErr_ asRecreateErr$fRecreateFAllf:cstr$fRecreateFAllf[]cstr$fRecreateErrTYPEEitherverifyUncheckedEncverifyUncheckedEnc' EncodeFAll encodeFAllEncodeFencodeF encodeAll encodeFPart_ encodeFPart encodePart_ encodePart$fEncodeFAllf:cstr$fEncodeFAllf[]cstrUnexpectedDecodeErrunexpectedDecodeErr DecodeFAll decodeFAllDecodeFdecodeF decodeAll decodeFPart_ decodeFPart decodePart_ decodePart asUnexpected_ asUnexpected$fDecodeFAllf:cstr$fDecodeFAllf[]cstr$fUnexpectedDecodeErrTYPEEither!$fUnexpectedDecodeErrTYPEIdentity runUnsafe withUnsafe $fMonadUnsafe$fApplicativeUnsafe$fFunctorUnsafe $fShowUnsafe explainBool proxiedId extractEitherwithSomeSymbolSomeAnnotationMkSomeAnnotationwithSomeAnnotation someAnnValue proxyConsSomeEnc MkSomeEnc withSomeEnctoSome someToChecked checkedToSome$fDisplSomeEnc UnSnocHelperUnSnocSnocLLastLLenghLengthLTakeUntilHelper LTakeUntil TakeUntilLTakeTakeLDropDropConcatDuplFstRepeatOrAndAcceptEqIsSupersetOpen IsSupersetSupersetinject injectIntodemoteFlattenToppromoteUnFlattenTopdemoteRemoveTop promoteAddTopdemoteRemoveBot promoteAddBotdemoteFlattenBotpromoteUnFlattenBot $fSupersetxx Encodings encodingsEncoderZeroEnc AppendEnc runEncoderencodeFEncoder$fEncodingsf[][]cstr FlattenAs flattenAs FromEncStringfromEncStringF toEncStringF toEncString fromEncString-$fFromEncStringTYPEWord8fstr"r-Word8-decimal".$fToEncString"r-Word8-decimal"strIdentityWord8*$fToEncString"r-Int-decimal"strIdentityInt $fToEncString"r-()"strIdentity() emptyUTF8Btext2ByteStringS txtBsSIdProp bsTxtIdProptext2ByteStringLbyteString2TextLprxyUtf8 verEncoding$fDecodeFTYPEfEncEnc$fRecreateFTYPEfEncEnc$fEncodeFTYPEEitherEncEnc$fEncodingsEither::cByteString$fDecodeFTYPEfEncEnc0$fRecreateFTYPEfEncEnc0$fEncodeFTYPEEitherEncEnc0$fEncodingsEither::cByteString0byteString2TextS'byteString2TextL'text2ByteStringS'text2ByteStringL'acceptLenientL$fEncodeFTYPEfEncEnc$fEncodeFTYPEfEncEnc0$fRecreateFTYPEfEncEnc1$fRecreateFTYPEfEncEnc2$fDecodeFTYPEfEncEnc1$fEncodeFTYPEfEncEnc1$fRecreateFTYPEfEncEnc3$fRecreateFTYPEfEncEnc4$fDecodeFTYPEfEncEnc2$fEncodeFTYPEfEncEnc2$fSuperset"r-ASCII""enc-B64"$$fSuperset"r-ASCII""enc-B64-nontext"$fFlattenAs"r-ASCII""enc-B64"%$fFlattenAs"r-ASCII""enc-B64-nontext" SizeLimit unSizeLimit$fEncodeFTYPEfEncEnc3$fEncodeFTYPEfEncEnc4$fEncodeFTYPEfEncEnc5$fEncodeFTYPEfEncEnc6$fEncodeFTYPEfEncEnc7$fEncodeFTYPEfEncEnc8 $fEqSizeLimit$fShowSizeLimitunpack IsROrEmptyIsRdecFR recWithEncRunsafeRecWithEncR LTakeSndParen LTakeFstParenLParenCntHelper AdjHelperAdjustIncrDecrNoChng LParenCnt LDropLast RightTermLeftTerm SecondTerm FirstTermNestedRIsBool BoolOpHelperBoolOpBoolOpIs encBoolOrLeftencBoolOrLeft'encBoolOrRightencBoolOrRight' encBoolAnd encBoolAnd' encBoolNot encBoolNot'decBoolRrecWithEncBoolRIsBanencFBanverifyBoundedAlphaNum$fEncodingsEither::cstr NonAsciiChar prxyAscii encodeImpl$fEncodeFTYPEEitherEncEnc1$fEncodingsEither::cText$fEncodeFTYPEEitherEncEnc2$fEncodingsEither::cText0$fDecodeFTYPEfEncEnc3$fEncodeFTYPEEitherEncEnc3$fEncodingsEither::c[]$fDecodeFTYPEfEncEnc4$fSuperset"r-UTF8""r-ASCII"$fEncodeFTYPEEitherEncEnc4$fEqNonAsciiChar$fShowNonAsciiChar eHelloAsciiB helloAsciiB helloAsciiT helloZerohelloRestricted helloUtf8B helloUtf8B64B helloUtf8B64TnotTextBlenientSomething b64IsAscii encodeSign decodeSign helloSigned propEncDechackerConfig sizeLimithelloB64helloB64DecodedhelloB64Recovered helloB64B64helloB64B64PartDecodehelloB64B64DecodedhelloB64B64RecoveredErrhelloUPP helloTitleRev exampleConf helloTitle helloRevLimit helloLimitB64helloRevLimitParDec helloAscii helloAsciiB64helloAsciiB64PartDec$fHasASizeLimitConfig $fShowConfigSimplifiedEmailEncBSimplifiedEmailSimplifiedEmailF emailHeaderparts EmailHeader PartHeaderIpV4Foct1oct2oct3oct4IpV4tstIptstEmailrecreateEncodingdecodeB64ForTextOnlyrunAlternatives'runAlternatives alternatives $fDisplIpV4F%$fFromEncStringTYPEIpV4FfText"r-IPv4"&$fToEncString"r-IPv4"TextIdentityIpV4F$fDisplSimplifiedEmailF $fShowIpV4F$fFunctorIpV4F$fFoldableIpV4F$fShowSimplifiedEmailF$fEqSimplifiedEmailF$fFunctorSimplifiedEmailF$fFoldableSimplifiedEmailF$fTraversableSimplifiedEmailF exAsciiTEexAsciiTmodifiedAsciiT toLowerAscii appendAsciibase Data.StringIsString Char7FindToStrIsoToStrInjGHC.BaseStringGHC.ShowShow text-1.2.3.1Data.Text.Internalbytestring-0.10.8.2Data.ByteString.Lazy.Char8ghc-prim GHC.TypesCharData.ByteString.Internal ByteString Alternative<|>Data.Traversable Traversable Data.TexttoLowerversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName