!طU      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuv 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&{&|'}'~''(((())))*************++++++++++++++++,,-----------.....///////000011111111111111111111111111111111112222222222222222222222222233445555555 5 5 5 5 5566666666677777777 7!7"7#7$7%7&7'7(7)7*7+7,7-7.8/808182838485868788898:8;8<8=8>8?8@8A8B8C8D8E8F8G8H8I8J8K8L8M8N8O8P9Q9R9S9T9?Safe=?Xk'ktyped-encodingIThis class will be removed in 0.3.x.x in favor of classes definined in 6Data.TypedEncoding.Common.Class.Util.StringConstraints Reverses Ulaws: : 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-.=>?@AHUVXk<typed-encodingUsed to find exceptions that violated "r-" encoding Expected to be used to check encoding of ASCII-7 so Text and ByteString are compatible or to check 0-255 range restrictions. typed-encodingSame as ToStrInj but with additionallaw for types that are also IsString:  fromString . toString == id typed-encoding Reverses Ulaw 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 V type.typed-encoding0prop_toStringFromString (Proxy :: Proxy TL.Text)typed-encoding/prop_toStringFromString (Proxy :: Proxy T.Text)typed-encoding prop_fromStringToString @TL.Texttyped-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.(Safe if restricting to 7bit code points.  Safe&'-.=>?HUVXEtyped-encodingType safety over encodings makes decoding process safe. However failures are still possible due to bugs or unsafe payload modifications. UnexpectedDecodeEx represents such errors.typed-encoding.Represents errors in encoding @since 0.1.0.0 typed-encoding<Represents errors in recovery (recreation of encoded types).!typed-encoding"typed-encoding>Useful when manually recreating using recovery @since 0.2.2.0#typed-encoding$typed-encoding%typed-encoding  !"#$%  !"#$%Safe-.=>?@AHUVXO *typed-encoding^:kind! UnSnoc '["1","2","3"] ... = '( (':) Symbol "1" ((':) Symbol "2" ('[] Symbol)), "3")+typed-encoding':kind! Concat (Snoc '["1","2","3"] "4")...= "1234",typed-encoding:kind! LLast '["1","2","3"]...= "3"-typed-encoding.typed-encoding0typed-encoding2typed-encoding3typed-encoding:kind! Take 3 "123456"...= "123"4typed-encoding6typed-encodingI:kind! Concat (LDrop 6 (ToList "bool: \"r-ban:ff-ff\" | \"r-ban:ffff\""))...$= "\"r-ban:ff-ff\" | \"r-ban:ffff\"")*+,-./0123456789:;<=>>=<;:9876543210/.-,+*)Safe ,-.@AHUV^ ?typed-encoding:kind! IsEnc "enc-boo"...= 'True@typed-encoding?:kind! RemoveRs '["r-UPPER", "enc-test", "r-lower", "do-UPPER"]...= '["enc-test", "do-UPPER"]Atyped-encodingBtyped-encoding:kind! IsR "r-UPPER"... ... 'True:kind! IsR "do-UPPER"...= (TypeError ... Ctyped-encodingDtyped-encodingcConverts encoding name to algorithm name, this assumes the ":" delimiter expected by this library. NThis 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"Etyped-encodingConstraint for algorithm name.Ftyped-encoding Constraint for "r-" annotations.Gtyped-encoding Constraint for "r-" annotations.Htyped-encoding;Represents value level (single) annotation. @since 0.2.0.0 ?@ABCDEFGH HGFEDCBA@?Safe-.=>?@AHUVXkfItyped-encoding/Polymorphic data payloads used to encode/decodeQThis class is intended for example use only and will be moved to Example modules.MUse your favorite polymorphic records / ad-hock product polymorphism library.Ktyped-encodingType level list appendLtyped-encodingHuman friendly version of ShowNtyped-encodingQtyped-encoding!symbolVals @ '["FIRST", "SECOND"]["FIRST","SECOND"]Styped-encoding*displ (Proxy :: Proxy ["FIRST", "SECOND"])"[FIRST,SECOND]"IJKLMNOPNOPLMKIJSafe&'-.=>?HUVXkm[typed-encoding@Represents some encoded string where encoding was not validated. Similar to :; but unlike  CheckedEnc4 it can contain payloads that have invalid encoding.See <]typed-encoding^typed-encoding`typed-encodingatyped-encoding6displ $ MkUncheckedEnc ["TEST"] () ("hello" :: T.Text)'"MkUncheckedEnc [TEST] () (Text hello)"[\]^_`[\]^_`Safe&'-.=>?HSUVXhkdtyped-encoding/HList like construction that defines a list of Encoding elements.=This type is used by programs using / manipulating encodings.Can be easily accessed with  = constraint using >?'. But could also be used by creating  Encodings list by hand.etyped-encodingconstructor is to be treated as Unsafe to Encode and Decode instance implementations particular encoding instances may expose smart constructors for limited data typesgtyped-encodingnWraps the encoding function. Contains type level information about the encoding name and the algorithm used. This type is used by programs implementing encoding instance. Such program needs to define a value of this type. It also implements  @) instance that simply returns that value.3Programs using encoding can access this type using AB (from the EncodeQ typeclass) but a better (and recommended) approach is to use its plural sibling d defined below.&This type has 2 symbol type variables:nm defines the encodingalg defines algorithm <These two are related, currently this library only supports Names nm[ containing ":" using format "alg:...", for example name "r-ban:999" has "r-ban" algorithm Names without ":" require that nm ~ alg}Future version are likely to relax this, possibly introducing ability do define more than one algorithm for given encoding. ]Using 2 variables allows us to define typeclass constraints that work with definitions like "r-ban" where "r-ban:/" can be followed by arbitrary string literal. Examples:  7Encoding (Either EncodeEx) "r-ban:9" "r-ban" () String encodes a single character  <= 9' 4Encoding Identity "enc-B64" "enc-B64" () ByteString  Represents a Byte 64 encoder that can operate on any stack of previous encodings. (encoding name and algorithm name are "enc-B64", there is no additional configuration () needed and it runs in the Identity Functor.Similar boilerplate for Decoding and  Validation" is specified in separate modules.htyped-encoding8Consider this constructor as private or use it with care!Defining constructor like this:  MkEncoding :: Proxy nm -> (forall (xs :: [Symbol]) . Enc xs conf str -> f (Enc (nm ': xs) conf str)) -> Encoding f nm (AlgNm nm) conf str "would make compilation much slowerityped-encoding#Contains encoded data annotated by nms list of Symbol&s with encoding names (encoding stack)confF that can contain configuration / encoding information such as digest.str the encoded data Example: Enc '["r-ASCII"] () ByteString jtyped-encoding"@since 0.3.0.0 renamed from MkEnc 5Use of this constructor should be kept to a minimum. Use of  C' currently recommended for recovering i1 from trusted input sources (if avoiding cost of *Data.TypedEncoding.Common.Types.Validation is important).ktyped-encodingltyped-encodingmtyped-encodingntyped-encodingType safe smart constructorAdding the type family  (AlgNm nm) mapping to Encoding] constructor slows down the compilation. Using smart constructor does not have that issue.{This approach also provides more future flexibility with possibility of future overloads relaxing current limitations on alg names. Notice underscore _# convention, it indicates a use of  Algorithm AlgNm: compiler figures out alg2 value. These can be slower to compile when used. ;Here are other conventions that relate to the existence of algfunctions ending with: ', for example D have alg" as first type variable in the forall list.&functions without tick tend to assume nm ~ algCThis particular function appears to not increase compilation time. otyped-encodingptyped-encodingSame as o( but compiler figures out algorithm name!Using it can slowdown compilationThis combinator has Algorithm nm alg constraint (which stands for TakeUntil ":" nm ~ alg. If rules on alg' are relaxed this will just return the default algorithm.If that happens -XTypeApplications annotations will be needed and _2 methods will simply use default algorithm name.qtyped-encodingQRuns encodings, requires -XTypeApplication annotation specifying the algorithm(s)nrunEncodings' @'["r-ban"] encodings . toEncoding () $ ("22") :: Either EncodeEx (Enc '["r-ban:111"] () T.Text)\Left (EncodeEx "r-ban:111" ("Input list has wrong size expecting 3 but length \"22\" == 2"))rtyped-encodingNAt a possibly some compilation cost, have compiler figure out algorithm names.r_runEncodings encodings . toEncoding () $ ("Hello World") :: Identity (Enc '["enc-B64","enc-B64"] () B.ByteString):Identity (UnsafeMkEnc Proxy () "U0dWc2JHOGdWMjl5YkdRPQ==")b_runEncodings encodings . toEncoding () $ ("22") :: Either EncodeEx (Enc '["r-ban:111"] () T.Text)\Left (EncodeEx "r-ban:111" ("Input list has wrong size expecting 3 but length \"22\" == 2")) (see also p) @since 0.3.0.0styped-encodingFlet disptest = UnsafeMkEnc Proxy () "hello" :: Enc '["TEST"] () T.Textdispl disptest"Enc '[TEST] () (Text hello)"dfeghijklmnopqrijklmghnopdfeqr Safe&'-.=>?HSUVXhk͍vtyped-encodingWraps a list of  Validation elements. Similarly to y" it can be used with a typeclass E=wtyped-encodingconstructor is to be treated as Unsafe to Encode and Decode instance implementations particular encoding instances may expose smart constructors for limited data typesytyped-encodingrValidation unwraps a layer of encoding and offers payload data down the encoding stack for further verification. :For "enc-" encodings this will typically be decoding step.8For "r-" encodings this will typically be encoding step.{typed-encoding4Type safe smart constructor adding the type family  (AlgNm nm)U restriction to UnsafeMkValidation slows down compilation, especially in tests. ~typed-encoding?Same as 'runValidation" but compiler figures out algorithm name!Using it can slowdown compilationtyped-encodingNThis basically puts payload in decoded state. More useful combinators are in 'Data.TypedEncoding.Combinators.Validate vxwyz{|}~ yz{|}~vxw Safe&'-.=>?HSUVXhkW typed-encodingWraps a list of Decoding elements. Similarly to d can be used with a typeclass FGtyped-encodingconstructor is to be treated as Unsafe to Encode and Decode instance implementations particular encoding instances may expose smart constructors for limited data typestyped-encoding Similar to g%Used to create instances of decoding.typed-encoding8Consider this constructor as private or use it with careUsing this constructor:  MkDecoding :: Proxy nm -> (forall (xs :: [Symbol]) . Enc (nm ': xs) conf str -> f (Enc xs conf str)) -> Decoding f nm (AlgNm nm) conf str "would make compilation much slowertyped-encoding'Type safe smart constructor (See also n) typed-encodingtyped-encodingtyped-encoding=Same as 'runDecoding" but compiler figures out algorithm name!Using it can slowdown compilationtyped-encodingtyped-encodingKAt possibly big compilation cost, have compiler figure out algorithm names. Safe-.=>?@AHUVXktyped-encodingtyped-encodingUsing 2 Symbol type variables (nm and algT) creates what seems like redundant typing in statically defined instances such as  "r-ASCII":, however it provides future flexibility to constrain nm) in some interesting way, different than AlgNm nm ~ alg. UIt also seems to be easier to understand as type variables used in the definition of g& match with what is on the typeclass.alg` is expected to be very statically defined and is needed to support more open instances such as "r-ban". Safe-HX^typed-encodingfCurrently this is the recommended way of recreating encoding from trusted input, if avoiding cost of *Data.TypedEncoding.Common.Types.Validation is important.typed-encodingtyped-encodingtyped-encoding Safe &'1SXk typed-encoding*Represents some validated encoded string.  CheckedEnc is untyped version of i.  CheckedEncN contains verified encoded data, encoding is visible at the value level only.typed-encoding*Constructor renamed from previous versionstyped-encodingtyped-encodingtyped-encodingtyped-encodingtyped-encodingtyped-encodingAlet encsometest = UnsafeMkCheckedEnc ["TEST"] () $ T.pack "hello"6proc_toCheckedEncFromCheckedEnc @'["TEST"] encsometestTrue7proc_toCheckedEncFromCheckedEnc @'["TEST1"] encsometestFalsetyped-encodingDlet enctest = unsafeSetPayload () "hello" :: Enc '["TEST"] () T.Text'proc_fromCheckedEncToCheckedEnc enctestTruetyped-encoding8displ $ unsafeCheckedEnc ["TEST"] () ("hello" :: T.Text)+"UnsafeMkCheckedEnc [TEST] () (Text hello)" :SafexK !"#$%?@ABCDEFGH[\]^_`defghijklmnopqrvwxyz{|}~Safe &'-.=?HUVtyped-encoding_Allows to operate within Enc. These are considered unsafe. keeping the same list of encodings typed-encoding @since 0.1.0.Safe-.=>?@AHUVXtyped-encodingERecovery errors are expected unless Recovery allows Identity instancetyped-encodingtyped-encodingSafe-.=>?@AHUVXkktyped-encodingWith type safety in place decoding errors should be unexpected. This class can be used to provide extra info if decoding could failtyped-encodingtyped-encodingtyped-encodingtyped-encodingSafe-.>HXk `typed-encoding0Any valid transformation of encodings (encoding  decoding A recreation) can be replayed on top of another encoding stack. This subsumes various $encodePart, decodePart, recreatePart combinators.typed-encodingtyped-encodingSafe -.=>?HUVXk typed-encoding*Maybe signals annotation mismatch, effect f' is not evaluated unless there is match Safe-.=>?@AHUVXktyped-encoding Safe -.=>?HUVXkCtyped-encodingtyped-encoding Safe-.=>?@AHUVXkISafe&',-.=>?@AHUVXk/ typed-encodingAggregate version of  This is not ideal but easy to implement. The issue is that this assumes restricted co-domain which is what often happens but often does not, e.g. it will not work well with id transformation.typed-encodingIsSuperset is not intended for "enc-" encodings. This class is.=It allows to specify constraints that say, for example, that Base 64 encodes into a subset of ASCII.typed-encodingtyped-encodingReplaces previous Superset typeclass.Subsets are useful for restriction encodings like r-UFT8 but should not be used for other encodings as this would be dangerous. For example, considering "enc-" encoding as a superset of "r-" encoding would permit converting encoded binary "Enc '["enc-"] c ByteString to "Enc '["r-ASCII"] c ByteString and then to "Enc '["r-ASCII"] c Text), which could result in runtime errors.iThe requirement is that that the decoding in the superset can replace the decoding from injected subset.IsSuperset bigger smaller reads as bigger is a superset of smaller{Note, no IsSuperset "r-UNICODE.D76" "r-CHAR8" even though the numeric range of D76 includes all CHAR8 bytes. This is more nominalI decision that prevents certain unwanted conversions from being possible.typed-encodingolet Right tstAscii = encodeFAll . toEncoding () $ "Hello World" :: Either EncodeEx (Enc '["r-ASCII"] () T.Text)&displ (injectInto @ "r-UTF8" tstAscii)%"Enc '[r-UTF8] () (Text Hello World)"typed-encoding)Test for Supersets defined in this moduleActual tests in the project test suite.typed-encodingvalidates superset restrictionActual tests in the project test suite.typed-encodingvalidates superset restrictionActual tests in the project test suite.typed-encodingOChecks if first encoding exceptions less often than second (has bigger domain).Safe-.=>?@AHUVXk81typed-encodingFlatten is more permissive  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 W.Encodes a as  Enc '[xs] specifying algorithm alg and using effect f 5IJKLMNOPSafe-.=>?@AHUVXk9          Safe&'-.=>?HUVXV(typed-encodingPRemove redundant superset right after the top (at second last encoding position)bdispl $ demoteFlattenTop (unsafeSetPayload () "" :: Enc '["r-ASCII", "r-UTF8", "r-boo"] () T.Text)!"Enc '[r-ASCII,r-boo] () (Text )"typed-encoding"add redundant superset right afteredispl $ promoteUnFlattenTop @"r-UTF8" (unsafeSetPayload () "" :: Enc '["r-ASCII", "r-boo"] () T.Text)("Enc '[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)!"Enc '[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)("Enc '[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)!"Enc '[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)("Enc '[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)!"Enc '[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)("Enc '[r-boo,r-UTF8,r-ASCII] () (Text )"HSafeVSafe .>HUVXkpgtyped-encodingEDefines new encoding by specifying 2 encodings, one needs to succeed.typed-encoding[let tst = _implEncOr @"r-tst:999(9)" @"r-ban:9999" @"r-ban:999" @() @String encFBan encFBan3fmap displ $ _runEncoding tst $ toEncoding () "123"+Right "Enc '[r-tst:999(9)] () (String 123)"4fmap displ $ _runEncoding tst $ toEncoding () "1234",Right "Enc '[r-tst:999(9)] () (String 1234)"5fmap displ $ _runEncoding tst $ toEncoding () "12345"Left (EncodeEx "r-tst:999(9)" (("Input list has wrong size expecting 4 but length \"12345\" == 5","Input list has wrong size expecting 3 but length \"12345\" == 5")))typed-encodingcDefines new encoding by specifying 2 encodings, both needs to succeed and produce the same payload.typed-encodingVlet tst2 = _implEncAnd @"r-tst:99" @"r-ban:9Z" @"r-ban:Z9" @() @String encFBan encFBan3fmap displ $ _runEncoding tst2 $ toEncoding () "99"&Right "Enc '[r-tst:99] () (String 99)"3fmap displ $ _runEncoding tst2 $ toEncoding () "AB"PLeft (EncodeEx "r-tst:99" (("'A' not bounded by '9'","'B' not bounded by '9'")))typed-encodingDefines new encoding which succeeds only if specified encoding fails. It that happens, it applies given transformation function.  typed-encodingHDefines restriction encoding that succeeds when specified encoding failsFlet tst3 = _implREncNot @"r-tstnot:99" @"r-ban:99" @() @String encFBan3fmap displ $ _runEncoding tst3 $ toEncoding () "AA")Right "Enc '[r-tstnot:99] () (String AA)"3fmap displ $ _runEncoding tst3 $ toEncoding () "99"<Left (EncodeEx "r-tstnot:99" ("Negated encoding succeeded"))   Safe-.>HX!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."typed-encoding Similar to !', assumes that destination payload has IsString instance and uses "" as base case. #typed-encoding Similar to !, works with untyped $typed-encoding Similar to ", works with untyped %typed-encoding0Splits composite payload into homogenious chunks&typed-encodingUntyped version of %'typed-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"(typed-encoding%Convenience function for checking if str decodes without error using encJ encoding markers and decoders that can pick decoder based on that marker(typed-encoding"proxy defining encoding annotationtyped-encodingfinds encoding marker enc for given annotation or failstyped-encodingdecoder based on enc markertyped-encodinginput!"#$%&'(!"#$%&'(Safe-.>HX|)typed-encoding*typed-encoding+typed-encoding,typed-encoding-typed-encoding)*+,-)*+,-Safe -.>HUVXk*.typed-encodingCreate "r-" - like encoding based on I like function. NUseful for small not performance critical encoding since it executed provided fromEnc! function to verify the encodingthis method does not restrict nmG to follow "r-" naming convention but is expected to be used to define "r-" encoding. ./01234567 ./01234567Safe -.>HXk89:;89:;Safe .=>?HUVXko<typed-encoding%Universal decoding for all "r-" types=typed-encoding>typed-encoding<=><=> Safe .=>?HUVXkN?typed-encoding@typed-encodingAtyped-encodingBtyped-encoding"Can cause slow compilation if usedCtyped-encoding.This should be used with "r-" validations only?@ABCD?@ABCDJSafe !"#$%)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP[\]^_`defghijklmnopqrvwxyz{|}~!"#$%&'(./0123456789:;<=>?@ABCD!Safe -.=>?@AHUVXhHtyped-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 Ityped-encodingprivate implementation helperNtyped-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 (UnsafeMkEnc Proxy () "\195\177")\encodeFAll . toEncoding () $ "\xc3\x28" :: Either EncodeEx (Enc '["r-UTF8"] () B.ByteString)7Left (EncodeEx "r-UTF8" (Cannot decode byte '\xc3': ...Following test uses HQ helper that checks that bytes are encoded as Right iff they are valid UTF8 bytes:{;quickCheck $ \(b :: B.ByteString) -> verEncoding b $ fmap ( fromEncoding ! . decodeAll @'["r-UTF8"]7 ) . encodeFAll @'["r-UTF8"] @(Either EncodeEx) . toEncoding () $ b:}+++ OK, passed 100 tests.EFGHIEFGHI"Safe .=>?@AUVXkOPOP#Safe,.=>?@AHUVXk]typed-encodingrunEncoding' encFBan . toEncoding () $ "C59F9FB7-4621-44D9-9020-CE37BF6E2BD1" :: Either EncodeEx (Enc '["r-ban:FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"] () T.Text)CRight (UnsafeMkEnc Proxy () "C59F9FB7-4621-44D9-9020-CE37BF6E2BD1")urecreateFAll' @'["r-ban"] . toEncoding () $ "211-22-9934" :: Either RecreateEx (Enc '["r-ban:999-99-9999"] () T.Text)*Right (UnsafeMkEnc Proxy () "211-22-9934")^typed-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 bounded by 'F'"EverifyBoundedAlphaNum (Proxy :: Proxy "r-ban:FF-FF") (T.pack "13G3E")Left "'G' not matching '-'"FverifyBoundedAlphaNum (Proxy :: Proxy "r-ban:FFOFF") (T.pack "13O234"),Left "Not ASCII char in annotation '\\1103'"[\]^\[]^$Safe.=>?@AHUVXkbtyped-encodingftyped-encodinghtyped-encodingjtyped-encodingmtyped-encodingotyped-encodingbcdbcd%Safe-.>HVBttyped-encodingText is automatically "r-UTF8" encodedutyped-encodingFor KL "r-UTF8" is redundantrsturstu&Safe-.>HVʵvtyped-encoding+This assumes that each of the encodings in xs work work equivalently in String and Text. See discussion in "Examples.TypedEncoding.Conversions6 and "Data.TypedEncoding.Conv.ByteString.Char8.pack"wtyped-encoding+This assumes that each of the encodings in xs work work equivalently in String and Text.. This is similar to the assumptions made in v. xtyped-encodingText is automatically "r-UTF8" encodedAdding "r-UTF8"A annotation simply adds type level interpretion requirement that X is treated as UTF8. The internals of X (currently UTF-16) are not relevant and  utf8Promote is implemented as Y$. This is not the same as encoding Word8 layouts into Z-s. This, in typed-encoding terminology, would be  "enc-UTF8", not @"r-UTF8".6displ $ utf8Promote $ toEncoding () ("text" :: T.Text)"Enc '[r-UTF8] () (Text text)"ytyped-encodingFor X "r-UTF8" is redundantOdispl . utf8Demote $ (unsafeSetPayload () "Hello" :: Enc '["r-UTF8"] () T.Text)"Enc '[] () (Text Hello)"vwxyz{vwxyz{'Safe-.>HVͣ|typed-encodingLazy version of (M.}typed-encodingLazy version of (N.~typed-encodingLazy version of (O.typed-encodingLazy version of (P.|}~|}~(Safe-.>HVtyped-encodingType safer version of QM.+This assumes that each of the encodings in xs work equivalently in String and  ByteString. See "Examples.TypedEncoding.Conversions.4This function also (currently) does not insist that xs is a valid encoding stack for  ByteStringS. This will be reexamined in the future, possibly offering stricter overloads of pack.Expected encoding stack xs needs to have d"r-" as last element and it needs to be more restrictive than "r-CHAR8" (String cannot have chars R> 255@). Otherwise any encodings other than "r-" need to encode into "r-CHAR8".See Data.TypedEncoding.Conv for more detailed discussion.8:t pack (undefined :: Enc '["r-bar", "r-foo"] () String)... ... error:... Couldn't match type ......Qdispl $ pack (unsafeSetPayload () "Hello" :: Enc '["r-bar", "r-ASCII"] () String),"Enc '[r-bar,r-ASCII] () (ByteString Hello)"typed-encoding7Version of pack that works without first "r-" encoding.Udispl $ pack'' (unsafeSetPayload () "SGVsbG8gV29ybGQ=" :: Enc '["enc-B64"] () String)1"Enc '[enc-B64] () (ByteString SGVsbG8gV29ybGQ=)"typed-encodingunpack on encoded strings.See  Similarly to  this makes assumptions on what the encoding stack is allowed to do. These are not type checked. Again, this is safe with any stack that uses "r-" only encodings. Future versions of  type-encodingW are likely to introduce constraints to guard this aspect of the type safety better. typed-encoding6Version of pack that works without first "r-" encoding^displ $ unpack'' (unsafeSetPayload () "SGVsbG8gV29ybGQ=" :: Enc '["enc-B64"] () B8.ByteString)-"Enc '[enc-B64] () (String SGVsbG8gV29ybGQ=)")Safe&'SXtyped-encodingCSometimes is easier to pass around a proxy than do TypeApplicationstyped-encoding explicit mapM*Safe.=>?@AHUVXk&typed-encodingNo-check version+Safe.=>?@AHUVXk,Safe.=>?@AHUVXk-Safe.=>?@AHUVXk.Safe &'-.HSUVXtyped-encodingtyped-encodingtyped-encodingMfolds over SomeSymbol list using withSomeSymbol and proxyCons @since 0.2.0.0typed-encoding/Safe&'SXtyped-encoding$Existentially quantified quantified Enc effectively isomorphic to typed-encodingtyped-encodingtyped-encodingDlet enctest = unsafeSetPayload () "hello" :: Enc '["TEST"] () T.Text#someToChecked . MkSomeEnc $ enctest&UnsafeMkCheckedEnc ["TEST"] () "hello"typed-encoding-let tst = unsafeCheckedEnc ["TEST"] () "test"displ $ checkedToSome tst%"Some (Enc '[TEST] () (String test))"@since 0.2.0.0 styped-encodingDlet enctest = unsafeSetPayload () "hello" :: Enc '["TEST"] () T.Textdispl $ MkSomeEnc enctest$"Some (Enc '[TEST] () (Text hello))"0Safe.HVXktyped-encoding5Main property that encodings are expected to enforce.Decoding is safe and can use Identity instance of .-Errors are handled during the encoding phase.typed-encoding Similar to  but y based. y acts as  recovering original payload value. Recovering with validation keeps the encoded value and that value is supposed to decode without error. Expects input of encoded values !"#$%?@ABCDEFGHIJKLMNOP[\]^_`defghiklmnopqrvwxyz{|}~     iklmghnopdefqr1Safe.=>?HUVXk(, typed-encoding):kind! RightTerm "boolSomeOp:(agag)(222)"...= "222" :kind! RightTerm "r-Int-decimal"...= ""typed-encoding(:kind! LeftTerm "boolSomeOp:(agag)(222)"...= "agag":kind! LeftTerm "r-Int-decimal"...= ""typed-encodingreturns "" for unary operatortyped-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 ...)...typed-encodingThis works fast with !kind@ but is much slower in declaration :kind! BoolOp "boolOr:()()"typed-encoding3:kind! BoolOpIs "boolAnd:(someenc)(otherenc)" "and"...= 'Truetyped-encodingSee examples in typed-encodingSee examples in typed-encodingtyped-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":}tst1"Right (UnsafeMkEnc Proxy () "212")tst2&Right (UnsafeMkEnc Proxy () "1000000")tst3\Left (EncodeEx "r-Word8-decimal" ("Payload does not satisfy format Word8-decimal: 1000000"))typed-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":}tst1"Right (UnsafeMkEnc Proxy () "234")tst2[Left (EncodeEx "r-Word8-decimal" ("Payload does not satisfy format Word8-decimal: 100000"))typed-encoding:{Plet tst1, tst2 :: Either EncodeEx (Enc '["boolNot:(r-Word8-decimal)"] () T.Text). tst1 = encBoolNot' . toEncoding () $ "334". tst2 = encBoolNot' . toEncoding () $ "127":}tst1"Right (UnsafeMkEnc Proxy () "334")tst2RLeft (EncodeEx "boolNot:(r-Word8-decimal)" ("Encoding r-Word8-decimal succeeded"))typed-encoding-Decodes boolean expression if all leaves are "r-"""2Safe .=>?@AHUVkLRtyped-encodingtyped-encodingtyped-encodingtyped-encodingtyped-encodingNThis function will likely be removed in future versions (performance concerns)typed-encodingEffectful decoding 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.A_propSafeDecoding @"enc-B64" @() @B.ByteString encB64B decB64B ()u_propSafeValidatedDecoding @"enc-B64" @() @B.ByteString validation decB64B () . getUncheckedPayload @() @B.ByteStringtyped-encodingA_propSafeDecoding @"enc-B64" @() @BL.ByteString encB64BL decB64BLtyped-encodingtyped-encodingtyped-encodingLenient decoding does not failtyped-encodingLenient decoding does not failtyped-encodingtyped-encodingtyped-encodingtyped-encodingtyped-encodingWARNING (performance)typed-encodingWARNING (performance)typed-encodingtyped-encodingtyped-encodingNThis instance will likely be removed in future versions (performance concerns)typed-encodingtyped-encodingtyped-encoding/tstChar8Encodable @ '["enc-B64-len", "enc-B64"]"I am CHAR8 encodable"typed-encodingThis is not precise, actually Base 64A uses a subset of ASCII and that would require a new definition "r-B64".@This instance likely to be changed / corrected in the future if "r-B64" is defined.Zlet tstB64 = encodeAll . toEncoding () $ "Hello World" :: Enc '["enc-B64"] () B.ByteString(displ (_encodesInto @"r-ASCII" $ tstB64)9"Enc '[r-ASCII,enc-B64] () (ByteString SGVsbG8gV29ybGQ=)"'displ (_encodesInto @"r-UTF8" $ tstB64)8"Enc '[r-UTF8,enc-B64] () (ByteString SGVsbG8gV29ybGQ=)"typed-encodingtyped-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)1"Enc '[r-ASCII] () (ByteString SGVsbG8gV29ybGQ=)"  RSafe &'-.=?HUVM 3Safe.>HVXNtyped-encodingLazy version of 4Styped-encodingLazy version of 4T4Safe.>HVXotyped-encodingWith given constraints  and  can be used on subsets of "r-UTF8"Note: For example, the  ByteString encoding of "xd800" (11101101 10100000 10000000 ed a0 80) is considered invalid UTF8 by the Xm library To be consistent we make the same assumption of also restricting representable Unicode chars as in  Unicode.D76.TE.decodeUtf8 "\237\160\128"g"*** Exception: Cannot decode byte '\xed': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 streamThe "xdfff" case (11101101 10111111 10111111 ed bf bfF): >>> TE.decodeUtf8 "237191191" "*** Exception: Cannot decode byte '\xed'>: Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 streamVdispl . decodeUtf8 $ (unsafeSetPayload () "Hello" :: Enc '["r-ASCII"] () B.ByteString) "Enc '[r-ASCII] () (Text Hello)""r-UTF8" is redundant:bdispl . utf8Demote . decodeUtf8 $ (unsafeSetPayload () "Hello" :: Enc '["r-UTF8"] () B.ByteString)"Enc '[] () (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) Similarly to (MD this function makes unverified assumption that the encoding stack xs does invalidate UTF8 byte layout. This is safe for any "r-" encoding as well as any of the "enc-" and "do-" encodings that can be currently found in this library. Future versions of this method are likely to introduce constraints that guarantee better type safety.See Data.TypedEncoding.Conv for more detailed discussion.typed-encodingCdispl $ encodeUtf8 $ utf8Promote $ toEncoding () ("text" :: T.Text)$"Enc '[r-UTF8] () (ByteString text)"See &. Similar type safety concerns apply.See Data.TypedEncoding.Conv for more detailed discussion.5Safe .=>?@AHk typed-encodingExample value to play with`encodeFAll . toEncoding () $ "HeLlo world" :: Either EncodeEx (Enc '["r-ASCII"] () B.ByteString)*Right (UnsafeMkEnc Proxy () "HeLlo world")typed-encodingabove with either removedtyped-encoding'We use a tween function of the popular US from the text package.,Notice the encoding annotation is preserved.$displ $ EncTe.decodeUtf8 helloAsciiB&"Enc '[r-ASCII] () (Text HeLlo world)"typed-encodingConsider 0-encoding of a V, to move it to Enc '[] () ByteString one could try:EncB8.pack helloZero... ... error: ... Empty list, no last element...+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 8 bits of information from each Z`. I doubt that there are any code examples of its intentional use on a String that has chars > '255'. EncB8.packQ will not compile unless the encoding has "r-CHAR8" as its superset. This works:Sfmap (displ . EncB8.pack) . encodeFAll @'["r-ASCII"] @(Either EncodeEx) $ helloZero,Right "Enc '[r-ASCII] () (ByteString Hello)"And the result is a  ByteString. with bonus annotation describing its content.Similar game is played for Text:ifmap (displ . EncT.d76Demote . EncT.pack) . encodeFAll @'["r-UNICODE.D76"] @(Either EncodeEx) $ helloZeroRight "Enc '[] () (Text Hello)"See Data.TypedEncoding.Conv for more information on this.typed-encodingmore interestingly  EncB8.packJ works fine on "r-" encodings that are subsets of "r-ASCII" this example  "r-ban:zzzzz"+ restricts to 5 alpha-numeric charters all < 'z'displ <$> helloRestricted0Right "Enc '[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 "Enc '[r-ban:zzzzz] () (String Hello)"typed-encodingFor low level use of Char instead of Word8(, "r-ByteRep" represents anything under 256.typed-encoding:We Base64 encode a ByteString which adheres to UTF8 layout+displ $ encodePart @'["enc-B64"] helloUtf8B8"Enc '[enc-B64,r-UTF8] () (ByteString SGVMbG8gd29ybGQ=)" typed-encoding.. and copy it over to Text.&displ $ EncTe.decodeUtf8 helloUtf8B64B2"Enc '[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+"Enc '[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 $ helloUtf8B64T8"Enc '[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-encoding 9 a binary, one that does not even represent a valid UTF8.JencodeAll . toEncoding () $ "\195\177" :: Enc '["enc-B64"] () B.ByteStringUnsafeMkEnc 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-encodingTo claim UTF8 on  helloAsciiB, instead encoding again: _encodeFAll . toEncoding () $ "HeLlo world" :: Either EncodeEx (Enc '["r-UTF8"] () B.ByteString)*Right (UnsafeMkEnc Proxy () "HeLlo world");We should be able to convert the ASCII annotation directly.This is done using  type family. injectInto1 method accepts proxy to specify superset to use.)displ $ injectInto @ "r-UTF8" helloAsciiB+"Enc '[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-encodingBase64; encoding represents binary data in an ASCII string format.7In Haskell, we should be able to express this in types. class is what specifies this.We can use it with  combinator. 2 should not be used directly at the calling site. *displ (_encodesInto @"r-ASCII" $ notTextB)-"Enc '[r-ASCII,enc-B64] () (ByteString w7E=)" can be used with a superset of the encoding character set as well making it more backward compatible (the definition of @EncodingSuperset "enc-B64" could be made more precise without breaking the code).)displ (_encodesInto @"r-UTF8" $ notTextB),"Enc '[r-UTF8,enc-B64] () (ByteString w7E=)" typed-encodingOrecreateAll . toEncoding () $ "abc==CB" :: Enc '["enc-B64-len"] () B.ByteStringUnsafeMkEnc 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"VW- allows to convert "enc-B64-len" to "enc-B64"-displ $ EnB64.acceptLenientS lenientSomething%"Enc '[enc-B64] () (ByteString abc=)"!This is now properly encoded data]recreateFAll . toEncoding () $ "abc=" :: Either RecreateEx (Enc '["enc-B64"] () B.ByteString)#Right (UnsafeMkEnc Proxy () "abc=")&Except the content could be surprising1decodeAll $ EnB64.acceptLenientS lenientSomethingUnsafeMkEnc 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            6Safe .=>?@AUVXktyped-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. helloSigned%UnsafeMkEnc Proxy () "11:Hello World"&fromEncoding . decodeAll $ helloSigned "Hello World"typed-encodingproperty checks that X> 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 (UnsafeMkEnc 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.R 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-encoding<Because encoding function is pure we can create instance of ! that is polymorphic in effect f. This is done using XY combinator.7Safe.@AkNHtyped-encodingExample configurationtyped-encoding"Hello World" encoded as Base64helloB64'UnsafeMkEnc Proxy () "SGVsbG8gV29ybGQ="displ helloB641"Enc '[enc-B64] () (ByteString SGVsbG8gV29ybGQ=)"MencodeAll . toEncoding () $ "Hello World" :: Enc '["enc-B64"] () B.ByteString'UnsafeMkEnc 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/UnsafeMkEnc Proxy () "U0dWc2JHOGdWMjl5YkdRPQ=="displ helloB64B64A"Enc '[enc-B64,enc-B64] () (ByteString U0dWc2JHOGdWMjl5YkdRPQ==)"1An alternative version of the above code is this:fmap displ . runEncodings' @'["enc-B64","enc-B64"] @'["enc-B64","enc-B64"] @Identity encodings . toEncoding () $ ("Hello World" :: B.ByteString)JIdentity "Enc '[enc-B64,enc-B64] () (ByteString U0dWc2JHOGdWMjl5YkdRPQ==)" This is how typed-encoding works, the 0Data.TypedEncoding.Common.Class.Encode.EncodeAlla constraint can be used to get access to list to encodings required by the symbol annotation. q, executes all the necessary transformations.Similar story is true for decoding and  validation5. In these examples we will use shortcut combinators.typed-encoding!Previous text decoded from Base64#fromEncoding . decodeAll $ helloB64 "Hello World"typed-encoding 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 (UnsafeMkEnc 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 D this is a good way to recreate encoded type if encoding is known. If is it not, [ type can be used. (See Z[ for better example).7This module is concerned only with the first approach. Llet unchecked = toUncheckedEnc ["enc-B64"] () ("SGVsbG8gV29ybGQ=" :: T.Text)2check @'["enc-B64"] @(Either RecreateEx) unchecked6Just (Right (UnsafeMkEnc Proxy () "SGVsbG8gV29ybGQ="))typed-encodingFDouble Base64 encoded "Hello World" with one layer of encoding removedJdecodePart @'["enc-B64"] $ helloB64B64 :: Enc '["enc-B64"] () B.ByteString'UnsafeMkEnc Proxy () "SGVsbG8gV29ybGQ="!helloB64B64PartDecode == helloB64True decodePart8 is a convenience function that simply replies decoding  first "enc-B64">above @'["enc-B64"] @'["enc-B64"] @'[] decodeAll $ helloB64B64'UnsafeMkEnc Proxy () "SGVsbG8gV29ybGQ=" typed-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.Text"UnsafeMkEnc Proxy () "HELLO WORLD"#typed-encodingSample compound transformation VencodeAll . toEncoding () $ "HeLLo world" :: Enc '["do-reverse", "do-Title"] () T.Text#UnsafeMkEnc Proxy () "dlroW olleH" %typed-encoding% is needed in following examples&typed-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.TextRUnsafeMkEnc Proxy (Config {sizeLimit = SizeLimit {unSizeLimit = 8}}) "dlroW olleH"tencodeAll . toEncoding exampleConf $ "HeLlo world" :: Enc '["do-size-limit", "do-reverse", "do-Title"] Config T.TextOUnsafeMkEnc 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.TextOUnsafeMkEnc Proxy (Config {sizeLimit = SizeLimit {unSizeLimit = 8}}) "dlroW ol" encodePart6 is simply encodeAll played above "do-Title" encoding:Pabove @'["do-Title"] @'[] @'["do-size-limit", "do-reverse"] encodeAll helloTitleOUnsafeMkEnc Proxy (Config {sizeLimit = SizeLimit {unSizeLimit = 8}}) "dlroW ol"(typed-encoding#... and we unwrap the B64 part only(decodePart @'["enc-B64"] $ helloLimitB64OUnsafeMkEnc 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 (UnsafeMkEnc 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)0Right (UnsafeMkEnc Proxy () "SGVsbG8gV29ybGQ=") +typed-encoding*decodePart @'["enc-B64"] <$> helloAsciiB64*Right (UnsafeMkEnc Proxy () "Hello World") !"#$%&'()*+ !"#$%&'()*+8Safe.456=>?@AXhk 0typed-encoding4This section shows a type safe processing of emails.0C 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.4typed-encodingSimplified Email header 5typed-encodingSimplified Part header 6typed-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 with?typed-encodingThis example encodes fields in 0 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 [A (that stores encoding information at the value level as well). [. 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  error:>check @'["enc-B64","r-ASCII"] @(Either RecreateEx) $ uncheckedNothing=check @'["enc-B64","r-UTF8"] @(Either RecreateEx) $ unchecked:Just (Right (UnsafeMkEnc Proxy () "U29tZSBVVEY4IFRleHQ="))Since the data is heterogeneous (each piece has a different encoding annotation), we need wrap the result in another plain ADT: . is similar to [c with the difference that the only (safe) way to get values of this type is from properly encoded i 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 = [UnsafeMkCheckedEnc ["enc-B64"] () "U29tZSBBU0NJSSBUZXh0",UnsafeMkCheckedEnc ["r-ASCII"] () "Some ASCII Text",UnsafeMkCheckedEnc ["r-UTF8"] () "Some UTF8 Text",UnsafeMkCheckedEnc ["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 pieceK"UnsafeMkCheckedEnc [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"] $ piece2Just (UnsafeMkEnc Proxy () "U29tZSBBU0NJSSBUZXh0")3so we can apply the decoding on the selected piece afmap (toCheckedEnc . decodePart @'["enc-B64"]) . fromCheckedEnc @ '["enc-B64", "r-ASCII"] $ piece:Just (UnsafeMkCheckedEnc ["r-ASCII"] () "Some ASCII Text")Dtyped-encoding*Provides easy to read encoding informationEtyped-encoding3let enc = toEncString @"r-IPv4" @IpV4 @T.Text tstIp!fromEncString @"r-IPv4" @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 % combinator. FEnT.splitPayload @ '["r-Word8-decimal"] (T.splitOn $ T.pack ".") $ ench[UnsafeMkEnc Proxy () "128",UnsafeMkEnc Proxy () "1",UnsafeMkEnc Proxy () "1",UnsafeMkEnc 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 % returned fixed size Vect 4.Ftyped-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.Misc)toEncString @"r-IPv4" @IpV4 @T.Text tstIp!UnsafeMkEnc Proxy () "128.1.1.10"JImplementation is a classic map reduce where reduce is done with help of "1let fn a b = if b == "" then a else a <> "." <> bDlet reduce = EnT.foldEncStr @'["r-IPv4"] @'["r-Word8-decimal"] () fn)displ . reduce . fmap toEncString $ tstIp&"Enc '[r-IPv4] () (String 128.1.1.10)"\Note lack of type safety here, the same code would work just fine if we added 5th field to 6 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. Gtyped-encoding*Provides easy to read encoding information./01324567;:98<=>?@ABC<67;:98=540132/.>?@ABC9Safe .=>?@AUV6Ptyped-encodingStarting exampleQtyped-encodingwith either removedRtyped-encoding- 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)5Right (UnsafeMkEnc Proxy () "HELLO some extra stuff")Alternatively, [% type can be used in recreation, see Z`Styped-encodingThe issue with  is that it may be expensive.This apprach uses RaB to perform (in general risky) operation on the internal payload. exAsciiTE$Right (UnsafeMkEnc Proxy () "HELLO")7exAsciiTE >>= pure . Unsafe.withUnsafe (fmap T.toLower)$Right (UnsafeMkEnc 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 thisTtyped-encoding-Similar example uses applicative instance of let Right hELLO = exAsciiTElet Right hello = toLowerAsciiOdispl $ Unsafe.runUnsafe ((<>) <$> Unsafe.Unsafe hELLO <*> Unsafe.Unsafe hello)%"Enc '[r-ASCII] () (Text HELLOhello)"PQRSTPQRSTZSafeB      !"#$%&'()*+./0123456789:;<=>?@ABCPQRSTbSafe`abcdefghcdefghijklmdfenopqrstuvwxyyzz{{|}~           = ? @ B C ;  aa   G  < !"#$%&D'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUI[VWXYZ[\]^_`abcdefghijklmnopqrstuvwxyzY{|}~      !!!!!!!!!!""""""""""""#######$$$$$$$$$$$$$$$$%M%N%%&M&N&&&&'M'N'O'P(M(O(N(P))))*************++++++++++++++++,,-----------.....///////00001111111111111 1 1 1 1 111111111111111112W22 2!2"2#2$2%2&2'2(2)2*2+2,2-2.2/20212223242526273S3T4S4T58595:5;5<5=5>5?5@5A5B5C5D6E6F6G6H6I6J6K6L6M7N7N7O7P7Q7R7S7T7U7V7W7X7Y7Z7[7\7]7^7_7`7a7b8c8d8e8e8f8g8h8i8j8j8k8l8m8n8o8p8q8r8s8t8u8v8w8x8y8z8{8|8}8~888899999Lbbbbbbbb-typed-encoding-0.4.2.0-9XLXwnl1bzT3act4TSOozF)Data.TypedEncoding.Common.Class.IsStringR6Data.TypedEncoding.Common.Class.Util.StringConstraints*Data.TypedEncoding.Common.Types.Exceptions'Data.TypedEncoding.Common.Util.TypeLits&Data.TypedEncoding.Common.Types.Common$Data.TypedEncoding.Common.Class.Util,Data.TypedEncoding.Common.Types.UncheckedEnc#Data.TypedEncoding.Common.Types.Enc*Data.TypedEncoding.Common.Types.Validation(Data.TypedEncoding.Common.Types.Decoding&Data.TypedEncoding.Common.Class.Encode%Data.TypedEncoding.Combinators.Unsafe*Data.TypedEncoding.Common.Types.CheckedEnc&Data.TypedEncoding.Common.Types.Unsafe(Data.TypedEncoding.Common.Class.Validate&Data.TypedEncoding.Common.Class.Decode%Data.TypedEncoding.Combinators.Common'Data.TypedEncoding.Combinators.Validate%Data.TypedEncoding.Combinators.Encode%Data.TypedEncoding.Combinators.Decode2Data.TypedEncoding.Combinators.Encode.Experimental(Data.TypedEncoding.Common.Class.SupersetData.TypedEncoding.Common.Class'Data.TypedEncoding.Combinators.ToEncStr(Data.TypedEncoding.Combinators.Promotion)Data.TypedEncoding.Instances.Support.Bool,Data.TypedEncoding.Instances.Support.Helpers+Data.TypedEncoding.Instances.Support.Unsafe+Data.TypedEncoding.Instances.Support.Encode+Data.TypedEncoding.Instances.Support.Decode+Data.TypedEncoding.Instances.Support.Common-Data.TypedEncoding.Instances.Support.Validate-Data.TypedEncoding.Instances.Restriction.UTF8-Data.TypedEncoding.Instances.Restriction.Misc9Data.TypedEncoding.Instances.Restriction.BoundedAlphaNums&Data.TypedEncoding.Instances.Do.Sample!Data.TypedEncoding.Conv.Text.LazyData.TypedEncoding.Conv.Text-Data.TypedEncoding.Conv.ByteString.Lazy.Char8(Data.TypedEncoding.Conv.ByteString.Char8 Data.TypedEncoding.Internal.Util,Data.TypedEncoding.Instances.Restriction.D760Data.TypedEncoding.Instances.Restriction.ByteRep.Data.TypedEncoding.Instances.Restriction.CHAR8.Data.TypedEncoding.Instances.Restriction.ASCII.Data.TypedEncoding.Common.Types.SomeAnnotation'Data.TypedEncoding.Common.Types.SomeEncData.TypedEncoding-Data.TypedEncoding.Instances.Restriction.Bool'Data.TypedEncoding.Instances.Enc.Base64*Data.TypedEncoding.Conv.Text.Lazy.Encoding%Data.TypedEncoding.Conv.Text.Encoding"Examples.TypedEncoding.Conversions&Examples.TypedEncoding.DiySignEncodingExamples.TypedEncoding.Overview"Examples.TypedEncoding.ToEncStringExamples.TypedEncoding.UnsafeData.TypedEncoding.Common.Types CheckedEnccheck EncodeAll0Data.TypedEncoding.Common.Class.Encode.EncodeAll encodingsEncode-Data.TypedEncoding.Common.Class.Encode.EncodeencodingunsafeSetPayloadencodeF'*Data.TypedValidation.Internal.Class.Encode(Data.TypedDecoding.Internal.Class.Decode DecodeAllData.TypedEncoding.ConvfromEncF$Data.TypedEncoding.Instances.SupportTTextpackunpackpack''unpack''Data.ByteString.Char8Data.TypedEncoding.Unsafe decodeUtf8 encodeUtf8Data.Text.EncodingEnB64acceptLenientSEnT implTranPExamples.TypedEncoding ToEncStringData.TypedEncoding.Instances.DoSample Data.WordWord8OverviewUnsafePaths_typed_encoding IsStringRtoStringprop_fromStringToStringprop_toStringFromString $fIsStringR[]$fIsStringRText$fIsStringRText0 Char8FindfindToStrIsoToStrInj$fToStrInj[][]$fToStrInj[]Text$fToStrInj[]Text0$fToStrIso[][]$fToStrIso[]Text$fToStrIso[]Text0$fChar8FindByteString$fChar8FindByteString0$fChar8FindText$fChar8FindText0 $fChar8Find[]UnexpectedDecodeExEncodeEx RecreateExRecreateExUnkSteprecreateErrUnknown asEncodeEx encToRecrEx mergeEncodeEx emptyEncErr mergeErrs$fShowRecreateEx$fShowEncodeEx$fShowUnexpectedDecodeEx UnSnocHelperUnSnocSnocLLastLLenghLengthLTakeUntilHelper LTakeUntil TakeUntilLTakeTakeLDropDropConcatDuplFstRepeatIfOrAndOrdBoolAcceptEqIsEncRemoveRs IsROrEmptyIsRAlgNmMapAlgNm Algorithm EncodingAnn RestrictionEncAnnHasAhasAppendDispldispl SymbolList symbolVals symbolVals_ $fSymbolList:$fSymbolList[] $fDisplProxy $fDispl[]$fDisplByteString$fDisplByteString0 $fDisplText $fDisplText0 $fDispl[]0 $fHasA()c UncheckedEncMkUncheckedEnctoUncheckedEncgetUncheckedEncAnngetUncheckedPayload verifyAnn$fDisplUncheckedEnc$fShowUncheckedEnc$fEqUncheckedEnc EncodingsZeroEConsEEncodingUnsafeMkEncodingEnc UnsafeMkEnc toEncoding fromEncoding getPayload _mkEncoding runEncoding' _runEncoding runEncodings' _runEncodings $fDisplEnc $fShowEnc$fEqEnc ValidationsZeroVConsV ValidationUnsafeMkValidation mkValidation runValidationrunValidation'_runValidationrunValidationChecks DecodingsZeroDConsDDecodingUnsafeMkDecoding mkDecoding runDecoding runDecoding' _runDecoding runDecodings runDecodings' _runDecodings$fEncodeAllf::confstr$fEncodeAllf[][]confstrwithUnsafeCoercewithUnsafeCoerceFunsafeChangePayloadUnsafeMkCheckedEncunsafeCheckedEncgetCheckedPayloadgetCheckedEncPayload toCheckedEncfromCheckedEncproc_toCheckedEncFromCheckedEncproc_fromCheckedEncToCheckedEnc$fDisplCheckedEnc$fShowCheckedEnc$fEqCheckedEnc runUnsafe withUnsafe $fMonadUnsafe$fApplicativeUnsafe$fFunctorUnsafe $fShowUnsafe RecreateErr recoveryErr ValidateAll validationsValidate validationasRecreateErr_ asRecreateErr$fValidateAllf::confstr$fValidateAllf[][]confstr$fRecreateErrTYPEEitherUnexpectedDecodeErrunexpectedDecodeErr decodingsDecodedecoding asUnexpected_ asUnexpected$fDecodeAllf::confstr$fDecodeAllf[][]confstr$fUnexpectedDecodeErrTYPEEither!$fUnexpectedDecodeErrTYPEIdentityaboveFabove getTransformFcheckWithValidationscheck'recreateWithValidations recreateFAll recreateAll recreateFPart recreateFAll' recreateAll'recreateFPart' recreatePart'encodeF encodeFAll encodeAll encodeFPart encodePart encodeFAll' encodeAll' encodeFPart' encodePart'decodeF decodeFAll decodeAll decodeFPart decodePartdecodeF' decodeFAll' decodeAll' decodeFPart' decodePart'_encodeF _encodeFAll _encodeAll _encodeFPart _encodePart AllEncodeIntoEncodingSuperset EncSuperset implEncIntoSupersetIsSupersetOpen IsSuperset injectInto propSuperset' propSuperset_propSupersetCheck _encodesIntopropEncodesInto'propEncodesInto_propEncodesIntoCheckpropCompEncodingtstChar8EncodabletstD76EncodabletstUTF8Encodable$fAllEncodeInto"r-UTF8":$fAllEncodeInto"r-UTF8"[]$fAllEncodeInto"r-UNICODE.D76": $fAllEncodeInto"r-UNICODE.D76"[]$fAllEncodeInto"r-CHAR8":$fAllEncodeInto"r-CHAR8"[] FlattenAs flattenAs FromEncStringtoEncF toEncStringF toEncStringF' toEncString toEncString'fromEncStringFfromEncStringF' fromEncStringfromEncString'demoteFlattenToppromoteUnFlattenTopdemoteRemoveTop promoteAddTopdemoteRemoveBot promoteAddBotdemoteFlattenBotpromoteUnFlattenBot implEncOr' implEncOr _implEncOr implEncAnd' implEncAnd _implEncAnd implEncNot' implEncNot _implEncNot _implREncNotfoldEnc foldEncStrfoldCheckedEncfoldCheckedEncStr splitPayloadsplitSomePayloadverifyWithRead verifyDynEnc implTranF implTranF' implTranP' implChangeAnn_implEncFromString_implEncodingP_implEncodingConfP_implEncodingEx_implEncodingEncodeEx_implEncodingConfEx implEncodingPimplEncodingEximplEncodingEx'implEncodingEncodeEx'_implDecodingF_implDecodingConfF implDecodingFimplDecodingF'decAnyRdecAnyR'decAnyR_ validFromDec validFromDec'validRvalidR' validFromEnc'validRFromEnc'prxyUtf8encUTF8B encUTF8BL verEncoding implVerifyR&$fValidatef"r-UTF8""r-UTF8"cByteString'$fValidatef"r-UTF8""r-UTF8"cByteString0$fDecodef"r-UTF8""r-UTF8"cstr)$fEncodeEither"r-UTF8""r-UTF8"cByteString*$fEncodeEither"r-UTF8""r-UTF8"cByteString0 encWord8Dec encIntDec9$fToEncStringIdentity"r-Int-decimal""r-Int-decimal"Intstr2$fValidateEither"r-Int-decimal""r-Int-decimal"cstr+$fDecodef"r-Int-decimal""r-Int-decimal"cstr0$fEncodeEither"r-Int-decimal""r-Int-decimal"cstr>$fFromEncStringTYPEf"r-Word8-decimal""r-Word8-decimal"Word8str?$fToEncStringIdentity"r-Word8-decimal""r-Word8-decimal"Word8str6$fValidateEither"r-Word8-decimal""r-Word8-decimal"cstr/$fDecodef"r-Word8-decimal""r-Word8-decimal"cstr4$fEncodeEither"r-Word8-decimal""r-Word8-decimal"cstr&$fToEncStringIdentity"r-()""r-()"()strBanIsBanencFBanverifyBoundedAlphaNum$fDecodefs"r-ban"cstr$fValidatefs"r-ban"cstr$fEncodeEithers"r-ban"cstr SizeLimit unSizeLimit&$fEncodef"do-reverse""do-reverse"cText'$fEncodef"do-reverse""do-reverse"cText0"$fEncodef"do-Title""do-Title"cText#$fEncodef"do-Title""do-Title"cText0"$fEncodef"do-lower""do-lower"cText#$fEncodef"do-lower""do-lower"cText0"$fEncodef"do-UPPER""do-UPPER"cText$$fValidatef"do-UPPER""do-UPPER"cText#$fEncodef"do-UPPER""do-UPPER"cText02$fEncodef"do-size-limit""do-size-limit"cByteString,$fEncodef"do-size-limit""do-size-limit"cText $fEqSizeLimit$fShowSizeLimit utf8Promote utf8Demote d76Promote d76Demote explainBool proxiedId extractEitherwithSomeSymbol NonTextChar encD76CharencD76trustMe nonTextCharencImpl-$fValidatef"r-UNICODE.D76""r-UNICODE.D76"()[]+$fDecodef"r-UNICODE.D76""r-UNICODE.D76"cstr/$fEncodeEither"r-UNICODE.D76""r-UNICODE.D76"c[]1$fEncodeEither"r-UNICODE.D76""r-UNICODE.D76"cChar$fEqNonTextChar$fShowNonTextCharCharOutOfRange encByteChar encByteRepB encByteRepBL encByteRepS%$fValidatef"r-ByteRep""r-ByteRep"()[]-$fValidatef"r-ByteRep""r-ByteRep"()ByteString.$fValidatef"r-ByteRep""r-ByteRep"()ByteString0'$fEncodeEither"r-ByteRep""r-ByteRep"c[]/$fEncodeEither"r-ByteRep""r-ByteRep"cByteString0$fEncodeEither"r-ByteRep""r-ByteRep"cByteString0)$fEncodeEither"r-ByteRep""r-ByteRep"cChar$fEqCharOutOfRange$fShowCharOutOfRangetestEncChar8Char testEncCHAR8 NonAsciiChar encASCIICharencASCII"$fValidatef"r-ASCII""r-ASCII"()str$fDecodef"r-ASCII""r-ASCII"cstr$$fEncodeEither"r-ASCII""r-ASCII"cstr%$fEncodeEither"r-ASCII""r-ASCII"cChar$fEqNonAsciiChar$fShowNonAsciiCharSomeAnnotationMkSomeAnnotationwithSomeAnnotation someAnnValue proxyConsSomeEnc MkSomeEnc withSomeEnctoSome someToChecked checkedToSome$fDisplSomeEncpropSafeDecoding'_propSafeDecodingpropSafeValidatedDecoding'_propSafeValidatedDecoding LTakeSndParen LTakeFstParenLParenCntHelper AdjHelperAdjustIncrDecrNoChng LParenCnt LDropLast RightTermLeftTerm SecondTerm FirstTermNestedRIsBool BoolOpHelperBoolOpBoolOpIs encBoolOrLeftencBoolOrLeft'encBoolOrLeft''encBoolOrRightencBoolOrRight'encBoolOrRight'' encBoolAnd encBoolAnd' encBoolAnd'' encBoolNot encBoolNot' encBoolNot''decBoolRrecWithEncBoolRunsafeRecWithEncRacceptLenientLencB64BencB64BLendB64TdecB64BdecB64BLdecB64TdecB64TL0$fValidatef"enc-B64-len""enc-B64-len"cByteString1$fValidatef"enc-B64-len""enc-B64-len"cByteString0"$fValidatef"enc-B64""enc-B64"cText#$fValidatef"enc-B64""enc-B64"cText0($fValidatef"enc-B64""enc-B64"cByteString)$fValidatef"enc-B64""enc-B64"cByteString0 $fDecodef"enc-B64""enc-B64"cText!$fDecodef"enc-B64""enc-B64"cText0&$fDecodef"enc-B64""enc-B64"cByteString'$fDecodef"enc-B64""enc-B64"cByteString0 $fEncodef"enc-B64""enc-B64"cText&$fEncodef"enc-B64""enc-B64"cByteString'$fEncodef"enc-B64""enc-B64"cByteString0$fEncodingSuperset"enc-B64-len"$fEncodingSuperset"enc-B64"$fFlattenAs"r-ASCII""enc-B64"%$fFlattenAs"r-ASCII""enc-B64-nontext" eHelloAsciiB helloAsciiB helloAsciiT helloZerohelloRestrictedbyteRep helloUtf8B64B helloUtf8B64TnotTextB helloUtf8BnotTextBB64AsciilenientSomething b64IsAscii encodeSign decodeSign helloSigned propEncDechacker decMySign"$fValidatef"my-sign""my-sign"cText $fDecodef"my-sign""my-sign"cText $fEncodef"my-sign""my-sign"cTextConfig sizeLimithelloB64 helloB64B64helloB64DecodedhelloB64RecoveredhelloB64B64PartDecodehelloB64B64DecodedhelloB64B64RecoveredErrhelloUPP helloTitleRev exampleConf helloTitle helloRevLimit helloLimitB64helloRevLimitParDec helloAscii helloAsciiB64helloAsciiB64PartDec$fHasASizeLimitConfig $fShowConfigSimplifiedEmailEncBSimplifiedEmailSimplifiedEmailF emailHeaderparts EmailHeader PartHeaderIpV4Foct1oct2oct3oct4IpV4tstIptstEmailrecreateEncodingdecodeB64ForTextOnlyrunAlternatives'runAlternatives alternatives $fDisplIpV4F-$fFromEncStringTYPEf"r-IPv4""r-IPv4"IpV4FText.$fToEncStringIdentity"r-IPv4""r-IPv4"IpV4FText$fDisplSimplifiedEmailF $fShowIpV4F$fFunctorIpV4F$fFoldableIpV4F$fShowSimplifiedEmailF$fEqSimplifiedEmailF$fFunctorSimplifiedEmailF$fFoldableSimplifiedEmailF$fTraversableSimplifiedEmailF exAsciiTEexAsciiTmodifiedAsciiT toLowerAscii appendAsciibase Data.StringIsStringGHC.BaseStringGHC.ShowShow text-1.2.3.1Data.Text.Internalidghc-prim GHC.TypesCharbytestring-0.10.8.2Data.ByteString.Internal ByteString Alternative<|>Data.Traversable Traversable Data.TexttoLowerversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName