| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Ribosome.Interpreter.Persist
Description
Interpreters for Persist
Synopsis
- persistBase :: Members [PersistPath !! PersistPathError, Stop PersistError] r => Sem r (Path Abs Dir)
- loadFile :: FromJSON a => Members [Stop PersistError, Log, Embed IO] r => Path Abs File -> Sem r a
- filepath :: Members [PersistPath !! PersistPathError, Stop PersistError] r => Path Rel File -> Path Rel Dir -> Maybe (Path Rel File) -> Sem r (Path Abs File)
- interpretPersist :: ToJSON a => FromJSON a => Members [PersistPath !! PersistPathError, Error BootError, Log, Embed IO] r => Text -> InterpreterFor (Persist a !! PersistError) r
- interpretPersistNull :: forall a err r. InterpreterFor (Persist a !! err) r
Documentation
persistBase :: Members [PersistPath !! PersistPathError, Stop PersistError] r => Sem r (Path Abs Dir) Source #
Obtain the root directory or stop.
loadFile :: FromJSON a => Members [Stop PersistError, Log, Embed IO] r => Path Abs File -> Sem r a Source #
Load a file and JSON-decode it.
filepath :: Members [PersistPath !! PersistPathError, Stop PersistError] r => Path Rel File -> Path Rel Dir -> Maybe (Path Rel File) -> Sem r (Path Abs File) Source #
Determine the path to use for a Persist action.
If a subpath is given, append it to dir, otherwise use singleFile.
Append the result of the first step to the root dir given by PersistPath.
interpretPersist :: ToJSON a => FromJSON a => Members [PersistPath !! PersistPathError, Error BootError, Log, Embed IO] r => Text -> InterpreterFor (Persist a !! PersistError) r Source #
Interpret Persist by writing to the file system.
Paths are determined as follows:
PersistPathdefines the root directory for allPersisteffects, which might be specific to a plugin, or additionally to entities like the currently edited project (e.g. by directory).- The value in the
nameargument is appended to the root depending on the arguments to the effect constructors. - When
storeorloadare invoked withNothingfor thesubpathargument, a file namedname.jsonis used. - When invoked with
Justa subpath, a file namedname/subpath.jsonis used.
interpretPersistNull :: forall a err r. InterpreterFor (Persist a !! err) r Source #
Interpret Persist by storing nothing.