ribosome-0.9.9.9: Neovim plugin framework for Polysemy
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ribosome.Interpreter.Persist

Description

Interpreters for Persist

Synopsis

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:

  • PersistPath defines the root directory for all Persist effects, which might be specific to a plugin, or additionally to entities like the currently edited project (e.g. by directory).
  • The value in the name argument is appended to the root depending on the arguments to the effect constructors.
  • When store or load are invoked with Nothing for the subpath argument, a file named name.json is used.
  • When invoked with Just a subpath, a file named name/subpath.json is used.

This uses Resumable, see Errors.

interpretPersistNull :: forall a err r. InterpreterFor (Persist a !! err) r Source #

Interpret Persist by storing nothing.