-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Serialization/deserialization using Python Pickle format. -- -- This package implements serialization and deserialization of Python -- objects using the Pickle format. @package python-pickle @version 0.2.3 -- | Very partial implementation of the Python Pickle Virtual Machine -- (protocol 2): i.e. parses pickled data into opcodes, then executes the -- opcodes to construct a (Haskell representation of a) Python object. module Language.Python.Pickle -- | Parse a pickled object to a list of opcodes. parse :: ByteString -> Either String [OpCode] -- | Unpickle (i.e. deserialize) a Python object. Protocols 0, 1, and 2 are -- supported. unpickle :: ByteString -> Either String Value -- | Pickle (i.e. serialize) a Python object. Protocol 2 is used. pickle :: Value -> ByteString opcodes :: [Parser OpCode] int :: Parser OpCode binint :: Parser OpCode binint1 :: Parser OpCode binint2 :: Parser OpCode long :: Parser OpCode long1 :: Parser OpCode long4 :: Parser OpCode string' :: Parser OpCode binstring :: Parser OpCode short_binstring :: Parser OpCode none :: Parser OpCode true :: Parser OpCode false :: Parser OpCode newtrue :: Parser OpCode newfalse :: Parser OpCode unicode :: Parser OpCode binunicode :: Parser OpCode float :: Parser OpCode binfloat :: Parser OpCode empty_list :: Parser OpCode append :: Parser OpCode appends :: Parser OpCode list :: Parser OpCode empty_tuple :: Parser OpCode tuple :: Parser OpCode tuple1 :: Parser OpCode tuple2 :: Parser OpCode tuple3 :: Parser OpCode empty_dict :: Parser OpCode dict :: Parser OpCode setitem :: Parser OpCode setitems :: Parser OpCode pop :: Parser OpCode dup :: Parser OpCode mark :: Parser OpCode popmark :: Parser OpCode get' :: Parser OpCode binget :: Parser OpCode long_binget :: Parser OpCode put' :: Parser OpCode binput :: Parser OpCode long_binput :: Parser OpCode ext1 :: Parser OpCode ext2 :: Parser OpCode ext4 :: Parser OpCode global :: Parser OpCode reduce :: Parser OpCode build :: Parser OpCode inst :: Parser OpCode obj :: Parser OpCode newobj :: Parser OpCode proto :: Parser OpCode stop :: Parser OpCode persid :: Parser OpCode binpersid :: Parser OpCode decimalInt :: Parser Int doubleFloat :: Parser ByteString Double decimalLong :: Parser Int decodeLong1 :: Parser Int decodeLong4 :: a stringnl :: Parser ByteString ByteString float8 :: Parser Double int4 :: Parser Int uint2 :: Parser Int serialize :: OpCode -> Put putFloat8 :: Double -> Put putUint2 :: Int -> Put encodeLong1 :: Int -> Put data OpCode INT :: Int -> OpCode BININT :: Int -> OpCode BININT1 :: Int -> OpCode BININT2 :: Int -> OpCode LONG :: Int -> OpCode LONG1 :: Int -> OpCode LONG4 :: Int -> OpCode STRING :: ByteString -> OpCode BINSTRING :: ByteString -> OpCode SHORT_BINSTRING :: ByteString -> OpCode NONE :: OpCode NEWTRUE :: OpCode NEWFALSE :: OpCode UNICODE :: ByteString -> OpCode BINUNICODE :: ByteString -> OpCode FLOAT :: Double -> OpCode BINFLOAT :: Double -> OpCode EMPTY_LIST :: OpCode APPEND :: OpCode APPENDS :: OpCode LIST :: OpCode EMPTY_TUPLE :: OpCode TUPLE :: OpCode TUPLE1 :: OpCode TUPLE2 :: OpCode TUPLE3 :: OpCode EMPTY_DICT :: OpCode DICT :: OpCode SETITEM :: OpCode SETITEMS :: OpCode POP :: OpCode DUP :: OpCode MARK :: OpCode POP_MARK :: OpCode GET :: Int -> OpCode BINGET :: Int -> OpCode LONG_BINGET :: Int -> OpCode PUT :: Int -> OpCode BINPUT :: Int -> OpCode LONG_BINPUT :: Int -> OpCode EXT1 :: Int -> OpCode EXT2 :: Int -> OpCode EXT4 :: Int -> OpCode GLOBAL :: ByteString -> ByteString -> OpCode REDUCE :: OpCode BUILD :: OpCode INST :: ByteString -> ByteString -> OpCode OBJ :: OpCode NEWOBJ :: OpCode PROTO :: Int -> OpCode STOP :: OpCode PERSID :: ByteString -> OpCode BINPERSID :: OpCode data Value Dict :: (Map Value Value) -> Value List :: [Value] -> Value Tuple :: [Value] -> Value None :: Value Bool :: Bool -> Value BinInt :: Int -> Value BinLong :: Int -> Value BinFloat :: Double -> Value BinString :: ByteString -> Value MarkObject :: Value unpickle' :: [OpCode] -> Either String Value type Stack = [Value] type Memo = IntMap Value execute :: [OpCode] -> Stack -> Memo -> Either String Value executePartial :: [OpCode] -> Stack -> Memo -> (Stack, Memo, [OpCode]) executeOne :: OpCode -> Stack -> Memo -> Either String (Stack, Memo) executeLookup :: Int -> Stack -> Memo -> Either String (Stack, Memo) executeTuple :: Monad m => [Value] -> Stack -> Memo -> m ([Value], Memo) executeDict :: Monad m => [(Value, Value)] -> Stack -> Memo -> m ([Value], Memo) executeList :: Monad m => [Value] -> Stack -> Memo -> m ([Value], Memo) executeSetitem :: Monad m => Stack -> Memo -> m ([Value], Memo) executeSetitems :: Monad m => [(Value, Value)] -> Stack -> Memo -> m ([Value], Memo) executeAppend :: Monad m => Stack -> Memo -> m ([Value], Memo) executeAppends :: Monad m => [Value] -> Stack -> Memo -> m ([Value], Memo) addToDict :: [(Value, Value)] -> Value -> Value newtype Pickler a Pickler :: WriterT [OpCode] (State (Map Value Int)) a -> Pickler a [runP] :: Pickler a -> WriterT [OpCode] (State (Map Value Int)) a runPickler :: Pickler () -> [OpCode] pickle' :: Value -> Pickler () binput' :: Value -> Pickler () pickleDict :: Map Value Value -> Pickler () pickleList :: [Value] -> Pickler () pickleTuple :: [Value] -> Pickler () pickleBinInt :: Int -> Pickler () pickleBinLong :: Int -> Pickler () pickleBinFloat :: Double -> Pickler () pickleBinString :: ByteString -> Pickler () dictGet :: Value -> Value -> Either String (Maybe Value) dictGet' :: Value -> Value -> Either String Value dictGetString :: Value -> ByteString -> Either String ByteString instance Control.Monad.State.Class.MonadState (Data.Map.Base.Map Language.Python.Pickle.Value GHC.Types.Int) Language.Python.Pickle.Pickler instance Control.Monad.Writer.Class.MonadWriter [Language.Python.Pickle.OpCode] Language.Python.Pickle.Pickler instance GHC.Base.Monad Language.Python.Pickle.Pickler instance GHC.Base.Applicative Language.Python.Pickle.Pickler instance GHC.Base.Functor Language.Python.Pickle.Pickler instance GHC.Show.Show Language.Python.Pickle.Value instance GHC.Classes.Ord Language.Python.Pickle.Value instance GHC.Classes.Eq Language.Python.Pickle.Value instance GHC.Show.Show Language.Python.Pickle.OpCode