class (Storable a) <= MonadStorage m a where
store :: a -> m (Either StorageError Unit)
Writes a storable
ain a monad
Left NoStorageErrorrepresenting the lack of a storage on error or returning
Right Uniton success.
retrieve :: String -> m (Either StorageError a)
Reads a storable
awhen given a key in monad
m, returning either a
Leftcontaining an error representing unavailable storage, decoding error or no value matching the supplied' key.
class Storable a where
key :: a -> String
Produces a key from the given
a. This is most appropriately an
idor something like it.
prefix :: Proxy a -> String
When given a proxy of
areturns a prefix that all items with that type will be stored with.
serialize :: a -> String
aand (hopefully) reliably turns it into a string; this should be symmetric with
deserialize. This can be conveniently implemented using
deserialize :: String -> Either StorageError a
Takes a string and either successfully decodes it into a
Right aor returns a
DecodingErrorthat contains a
NonEmptyList ForeignError. This matches the error value that