8      !"#$%&'()*+,-./01234567portable experimental(Edward L. Blake <edwardlblake@gmail.com> Safe-Inferred2 are error types that can be returned if decoding + did not succeed. They are returned by the 8 versions of the decoding  functions.  5 is given if the decoder got an empty byte sequence.  # is given if the decoding does not M succeed while in the particular byte sequence for a class that implements  Serializable.  + is given if the decoding does not succeed A while in the particular byte sequence for a PHP object value.  + is given if the decoding does not succeed ; while in the particular byte sequence for a PHP string.  1 is given if the decoding does not succeed while ? decoding common byte sequences which are composed mainly of   forms.  , is given if the byte sequence is not fully  decoded to a  % when using decodePHPSessionValue or  decodePHPSessionValueEither.  , is given.if the byte sequence is not fully  decoded to a  when using decodePHPSession or  decodePHPSessionEither.  are values associated with   to inspect and ? generally re-encode the necessary information for that value.  8 Represents a PHP value, which may be a number, string, . array, object, boolean, null, or references.  2 represents an array as a list of key-value pairs  of values of type  .   is similar to  but also ! includes a class name of type .  * represent objects of which their classes D implement Serializeable to handle their own serialization and don't use > the normal serialization format for its contained objects.  , , ,  , and  represent basic types ; boolean, integer, floats, null and string respectively.  ( stores the number representation as an 8 9 : Q to preserve instances where the number representation is actually an integer. M It should be noted that the re-encoded value is usually rounded unlike PHP's  representation.   1 stores a few other types such as references and @ values which follow the general serialization format but aren' t recognized  by the decoder. A list of  provides the information for K reconstructing the serialized representation when re-encoding this type  of value. $Represents the name of a PHP class.  Holds the " top-level"- session variables and their value contents. " ;<=>?@ABC      ;<=>?@ABCportable experimental(Edward L. Blake <edwardlblake@gmail.com> Safe-Inferred8 is a convenience function that converts natively typed  values to  ), with the resulting PHP type determined  by the type cast or inferred.  & arrayOfPHPStrings :: PHPSessionValue  arrayOfPHPStrings = ' let str1 = "Hello" :: BS.ByteString  str2 = "World" , in convTo [(0 :: Int, str1), (1, str2)] In the above example code, the OverloadedStrings language extension is assumed.  and . are convenience functions that translate PHP  values stored as  - into appropriate Haskell types depending on N the desired type cast or inferred. Functions provided in this module provide N non-coerced type translations and so will either carry on the translation or J signal the fact that the attempted conversion will alter the type of the K value. For situations where altering value types is expected, alternative K conversion functions with similar type signatures are provided in modules  within Data.PHPSession.ImplicitConv. 2The example arrayOfPHPStrings definition given in  can be reverted back & to Haskell types, which evaluates to [(0,"Hello"),(1,"World")]. 4convFrom arrayOfPHPStrings :: [(Int,LBS.ByteString)][(0,"Hello"),(1,"World")]RHowever, if the desired type signature is changed to a completely different type, % then a runtime exception is thrown: )convFrom arrayOfPHPStrings :: [(Int,Int)]S*** Exception: Type mismatch converting from (PHPSessionValueString "Hello") to IntBWhere there is the possibility that the value being sought may be NULL, the  type should be (D a).  A version of  which returns a E with an error message instead  of throwing an exception. *FGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh(FGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghportable experimental(Edward L. Blake <edwardlblake@gmail.com> Safe-Inferred *Returns the value of a boolean value as a i", or returns False as the default  i value if the  ) is not a boolean type. This function is  similar to the "strict comparison" operator against the boolean TRUE value. !*Returns the value of a boolean value as a i!, or returns True as the default  i value if the   is not a boolean type. " Coerces a   to a i based on PHP's conversion rules to B convert arbitrary values to boolean for evaluation. This function' s behaviour  is also reminiscent of PHP's "loose comparison" operator against boolean  TRUE.   0http://php.net/manual/language.types.boolean.php Values that result in j are TRUE&, non-zero numbers, non-empty strings  other than "0"!, objects, and non-empty arrays. 4A conversion documented in the PHP manual involving  SimpleXML objects that  coerce to FALSE instead of TRUE% when created with empty tags is not R implemented by this function, as SimpleXML objects cannot be serialized directly  and so don'>t have a valid serializable form to convert from in any case. ,Because of the range of valid values of the "loose comparison" operator, this Q function and variations based on other dynamically typed languages is provided P mainly for circumstances where they may be the best fit to map particular data ) values to a boolean truth value system. $ P provides a significantly reduced subset of valid values to coerce from for the  purpose of determining a " confirmation") value, as opposed to simply determining  if a value exists or not. # A version of " where NULL returns k  and all other inputs returns l with the boolean result. $ Coerces a   to a i+ through a reduced subset of valid values.  $ and % are 9 functions intended for testing a variable for a boolean " confirmation" from a - limited number of probable representations. Values that result in j are TRUE, non-zero numbers, "1" and "-1". Values that result in m are FALSE, zero numbers, NULL, "0" and "". LValues such as arrays, objects and arbitrary strings, are invalid with this . function and return an error. In the case of $  this returns a E with the error message. % A version of $ that may throw exceptions. & A version of $ where NULL returns n k  and all other inputs returns n l% with the boolean result. May return E 0 with an error message if given invalid values. ' A version of % where NULL returns k  and all other inputs returns l' with the boolean result. May throw an  exception on invalid values. (,Alternative boolean coercion based on the JS/ES boolean conversion rules. N A particular distinction of the coercion behaviour of this function compared H to the behaviour of other functions is that floating point NaN returns  m instead of j. Values that return m are NAN, 0,  the empty string "", NULL and FALSE HPHP objects, arrays and objects implementing Serializable always return j. JS/ES'Ks boolean conversion is described in section 9.2 of the ECMA 262 standard. )DAlternative boolean coercion based on non-overloaded Perl 5 rules.  Values that return m are the empty string "", the string containing  "0", 0, NULL and FALSE. HPHP objects, arrays and objects implementing Serializable always return j. Perl'6s boolean coercion rules are described in the section "Truth and Falsehood"  of "perlsyn".   8http://perldoc.perl.org/perlsyn.html#Truth-and-Falsehood *DAlternative boolean coercion based on non-overloaded Python rules.  Values that return m are the empty array [], the empty string  "", 0, NULL and FALSE. @PHP objects and objects implementing Serializable always return j. Python',s boolean conversion rules are described in "Truth Value Testing"  in section 3.1 of Python 2.5's Library Reference.   4https://docs.python.org/release/2.5.2/lib/truth.html +@Alternative boolean coercion based on Lua rules, all values are j except  NULL and FALSE. For Lua':s conversion rules, refer to the passage in section 2.4.4 "Control  Structures" of Lua 5.1' s Manual.   )http://www.lua.org/manual/5.1/manual.html !"#$o%&'()*+ !"#$%&'()*+ !"#$%&'()*+ !"#$o%&'()*+portable experimental(Edward L. Blake <edwardlblake@gmail.com> Safe-Inferred.. and / are functions that convert  values stored as  - into appropriate Haskell types depending on / the desired type cast or inferred. Unlike the  and   functions provided in Data.PHPSession.Conv%, functions provided in this module L perform type coercion based on a significant number of conversion rules to $ satisfy the type cast or inferred.  The example arrayOfPHPStrings/ definition given in the example documented in  Data.PHPSession.Conv can be evaluated to [(0,"Hello"),(1,"World")]. ?convFromPHPImplicit arrayOfPHPStrings :: [(Int,LBS.ByteString)][(0,"Hello"),(1,"World")]3However, if the desired type signature is changed: JconvFromPHPImplicit arrayOfPHPStrings :: [(LBS.ByteString,LBS.ByteString)][("0","Hello"),("1","World")]BWhere there is the possibility that the value being sought may be NULL, the  type should be (D a). // is a version of . that returns a  EA with an error message instead of throwing a run time exception. ,-pqrstuvwxyz./{|}~,-././,-,-pqrstuvwxyz./{|}~portable experimental(Edward L. Blake <edwardlblake@gmail.com> Safe-Inferred0 Decodes a ; containing a serialization of a list of session variables  using the "php"% session serialization format into a  1 A version of 0 that returns a  when  decoding the  fails. 2 Decodes a 7 containing a session serialization of a value into a   @. The format being decoded is similar if not probably the same  format used by PHP' s serialize/unserialize functions.  kD is returned if the input bytestring could not be parsed correctly. 3 A version of 2 that returns   when decoding the  fails. 4Decodes as much of a  as needed into a   and returns S the rest of the string. Decoding ends at either the end of the string or when the T extent of the current nested structure is met when an extra closing curly brace is L encountered. The format being decoded is similar if not probably the same  format used by PHP' s serialize/unserialize functions.  kD is returned if the input bytestring could not be parsed correctly. 5 A version of 4' that uses Either, on decoding error a   is returned. 6 Encode a  into a  containing the serialization * of a list of session variables using the "php" session serialization format. 7 Encode a   into a # containing the serialization of a O PHP value. The format being encoded into is similar if not probably the same  format used by PHP' s serialize/unserialize functions. 01234567 0123456701236745   01234567      !"#$%&'()*+,-./0123456789:;<=>?@AB@ACDEFGHIJKL=MN=>OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr@As@At=Mu=Mv@Aw=>xRyz{|}~Rhs-php-session-0.0.9.3Data.PHPSession.TypesData.PHPSession.Conv%Data.PHPSession.ImplicitConv.ConvBool,Data.PHPSession.ImplicitConv.PHPTypeCoercionData.PHPSessionPHPSessionDecodingErrorPHPSessionNotFullyDecodedPHPSessionValueNotFullyDecodedPHPSessionCouldntDecodePast!PHPSessionCouldntDecodeStringPast!PHPSessionCouldntDecodeObjectPast'PHPSessionCouldntDecodeSerializablePastPHPSessionStringEmptyPHPSessionAttrPHPSessionAttrNestedPHPSessionAttrFloatPHPSessionAttrIntPHPSessionValuePHPSessionValueMiscPHPSessionValueString"PHPSessionValueObjectSerializeablePHPSessionValueObjectPHPSessionValueNullPHPSessionValueIntPHPSessionValueFloatPHPSessionValueBoolPHPSessionValueArrayPHPSessionClassNamePHPSessionVariableList ConversionFromPHPValueOrMismatch convFromOMConversionToPHPValueconvTo'convToconvFrom convFromSafeboolDefaultFalseFromboolDefaultTrueFrom"boolFromPHPLooseComparisonWithTrue*boolFromPHPLooseComparisonWithTrueNullable boolFromReducedLooseCoercionSafeboolFromReducedLooseCoercion(boolFromReducedLooseCoercionNullableSafe$boolFromReducedLooseCoercionNullableboolFromESBooleanCoercionRules boolFromPerlBooleanCoercionRules"boolFromPythonBooleanCoercionRulesboolFromLuaBooleanCoercionRules(ConversionFromPHPImplicitValueOrMismatchconvFromPHPImplicitOMconvFromPHPImplicitconvFromPHPImplicitSafedecodePHPSessiondecodePHPSessionEitherdecodePHPSessionValuedecodePHPSessionValueEitherdecodePartialPHPSessionValue"decodePartialPHPSessionValueEitherencodePHPSessionencodePHPSessionValuebase Data.EitherEitherghc-prim GHC.TypesIntDouble$fEqPHPSessionDecodingError$fShowPHPSessionDecodingError$fEqPHPSessionAttr$fShowPHPSessionAttr$fOrdPHPSessionValue$fEqPHPSessionValue$fShowPHPSessionValue$fEqPHPSessionClassName$fShowPHPSessionClassName Data.MaybeMaybeLeftconvArrayRightSideconvArrayBothSides mismatchError'$fConversionFromPHPValueOrMismatchMaybe,$fConversionFromPHPValueOrMismatchByteString-$fConversionFromPHPValueOrMismatchByteString0%$fConversionFromPHPValueOrMismatch(,)&$fConversionFromPHPValueOrMismatch(,)0($fConversionFromPHPValueOrMismatchEither)$fConversionFromPHPValueOrMismatchEither0)$fConversionFromPHPValueOrMismatchEither1)$fConversionFromPHPValueOrMismatchEither2)$fConversionFromPHPValueOrMismatchEither3'$fConversionFromPHPValueOrMismatchInt64'$fConversionFromPHPValueOrMismatchInt32%$fConversionFromPHPValueOrMismatchInt($fConversionFromPHPValueOrMismatchDouble&$fConversionFromPHPValueOrMismatchBool$$fConversionFromPHPValueOrMismatch[]%$fConversionFromPHPValueOrMismatch[]0%$fConversionFromPHPValueOrMismatch[]1%$fConversionFromPHPValueOrMismatch[]2 $fConversionToPHPValueByteString!$fConversionToPHPValueByteString0$fConversionToPHPValue(,)$fConversionToPHPValue(,)0$fConversionToPHPValueMaybe$fConversionToPHPValueInt64$fConversionToPHPValueInt32$fConversionToPHPValueInt$fConversionToPHPValueDouble$fConversionToPHPValueBool$fConversionToPHPValue[]$fConversionToPHPValue[]0%$fConversionToPHPValuePHPSessionValueBoolTrueNothingJustFalseRightisScalarForArrayarrayScalarAsValueconvArrayScalarLeftSideconvArrayListLeftSideconvArrayScalarRightSideconvArrayListRightSideconvArrayScalarBothSidesconvArrayListBothSides phpStdClassphpScalarMember/$fConversionFromPHPImplicitValueOrMismatchMaybe4$fConversionFromPHPImplicitValueOrMismatchByteString5$fConversionFromPHPImplicitValueOrMismatchByteString0-$fConversionFromPHPImplicitValueOrMismatch(,).$fConversionFromPHPImplicitValueOrMismatch(,)0/$fConversionFromPHPImplicitValueOrMismatchInt64/$fConversionFromPHPImplicitValueOrMismatchInt32-$fConversionFromPHPImplicitValueOrMismatchInt0$fConversionFromPHPImplicitValueOrMismatchDouble.$fConversionFromPHPImplicitValueOrMismatchBool,$fConversionFromPHPImplicitValueOrMismatch[]-$fConversionFromPHPImplicitValueOrMismatch[]0-$fConversionFromPHPImplicitValueOrMismatch[]1bytestring-0.10.0.2Data.ByteString.Lazy.Internal ByteString#decodePartialPHPSessionValuesNested"decodePartialPHPSessionValueCommonencodePHPSessionTop