ruby-marshal-0.1.2: Parse a subset of Ruby objects serialised with Marshal.dump.

Copyright(c) Philip Cunningham, 2015
LicenseMIT
Maintainerhello@filib.io
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Ruby.Marshal.Monad

Description

Marshal monad provides an object cache over the Get monad.

Synopsis

Documentation

newtype Marshal a Source

Marshal monad endows the underlying Get monad with State.

Constructors

Marshal 

Fields

runMarshal :: StateT Cache Get a
 

liftMarshal :: Get a -> Marshal a Source

Lift Get monad into Marshal monad.

data Cache Source

State that we must carry around during deserialisation.

Constructors

Cache 

Fields

objects :: !(Vector RubyObject)

object cache.

symbols :: !(Vector RubyObject)

symbol cache.

Instances

Show Cache 
MonadState Cache Marshal 

emptyCache :: Cache Source

Constructs an empty cache to store symbols and objects.

readCache :: Int -> (Cache -> Vector RubyObject) -> Marshal (Maybe RubyObject) Source

Look up value in cache.

readObject :: Int -> Marshal (Maybe RubyObject) Source

Look up object in object cache.

readSymbol :: Int -> Marshal (Maybe RubyObject) Source

Look up a symbol in symbol cache.

writeCache :: RubyObject -> Marshal () Source

Write an object to the appropriate cache.