IDynamic-0.1: Indexable, serializable form of Data.DynamicSource codeContentsIndex
class IResource a where
keyResource :: a -> String
serialize :: a -> String
deserialize :: String -> a
defPath :: a -> String
readResource :: a -> IO (Maybe a)
writeResource :: a -> IO ()
delResource :: a -> IO ()
type AccessTime = Integer
type ModifTime = Integer
data Resources a b
= Retry
| Resources {
toAdd :: [a]
toDelete :: [a]
toReturn :: b
resources :: Resources a ()
class IResource a whereSource

A general interface for indexable, serializable and input-output objects. readResource and writeResource are implemented by default as read-write to files with its key as filename serialize and deserialize are specified just to allow these defaults. If you define your own persistence, then serialize and deserialize are not needed. The package Workflow need them anyway.

minimal definition: keyResource, serialize, deserialize

While serialize and deserialize are agnostic about the way of converison to strings, either binary or textual, treadp and tshowp use the monad defined in the RefSerialize package. Both ways of serialization are alternative. one is defined by default in terms of the other. the RefSerialize monad has been introduced to permit IResource objects to be serialized as part of larger structures that embody them. This is necessary for the Workdlow package.

The keyResource string must be a unique since this is used to index it in the hash table. when accessing a resource, the user must provide a partial object for wich the key can be obtained. for example:

data Person= Person{name, surname:: String, account :: Int ....)

keyResource Person n s ...= n++s

the data being accesed must have the fields used by keyResource filled. For example

  readResource Person {name=John, surname= Adams}

leaving the rest of the fields undefined

IResource has defaults definitions for all the methods except keyResource Either one or other serializer must be defiened for default witeResource, readResource and delResource

:: a
-> Stringmust be defined
:: a
-> Stringmust be defined by the user
:: String
-> amust be defined by the user
:: a
-> Stringadditional extension for default file paths or key prefixes
readResource :: a -> IO (Maybe a)Source
writeResource :: a -> IO ()Source
delResource :: a -> IO ()Source
show/hide Instances
type AccessTime = IntegerSource
type ModifTime = IntegerSource
data Resources a b Source
Resources returned by withSTMResources'
Retryforces a retry
toAdd :: [a]resources to be inserted back in the cache
toDelete :: [a]resources to be deleted from the cache and from permanent storage
toReturn :: bresult to be returned
resources :: Resources a ()Source
resources= Resources  [] [] ()
Produced by Haddock version 2.4.2