Safe Haskell | None |
---|---|
Language | Haskell2010 |
Storage.Notmuch
Synopsis
- getThreads :: (MonadError Error m, MonadIO m) => Text -> NotmuchSettings FilePath -> m (V (Toggleable NotmuchThread))
- getThreadMessages :: (MonadError Error m, MonadIO m, Traversable t) => FilePath -> t NotmuchThread -> m (Vector (Toggleable NotmuchMail))
- countThreads :: (MonadError Error m, MonadIO m) => Text -> FilePath -> m Int
- messageTagModify :: (Traversable t, MonadError Error m, MonadIO m) => FilePath -> [TagOp] -> t NotmuchMail -> m (t NotmuchMail)
- mailFilepath :: (MonadError Error m, MonadIO m) => NotmuchMail -> FilePath -> m FilePath
- indexFilePath :: (MonadError Error m, MonadIO m) => FilePath -> FilePath -> [Tag] -> m ()
- unindexFilePath :: (MonadError Error m, MonadIO m) => FilePath -> FilePath -> m ()
- class ManageTags a where
- hasTag :: ManageTags a => Tag -> a -> Bool
- tagItem :: ManageTags a => [TagOp] -> a -> a
- addTags :: ManageTags a => [Tag] -> a -> a
- removeTags :: ManageTags a => [Tag] -> a -> a
- getDatabasePath :: IO FilePath
- withDatabase :: (AsNotmuchError e, Mode a, MonadError e m, MonadIO m) => FilePath -> (Database a -> ExceptT e IO c) -> m c
Synopsis
The purpose of this module is to provide a bridge between the
low-level API of notmuch and the higher level functionality in
Purebred. It propagates errors picked up by callers in order to be set
in the AppState
. The module also serves as a translation between
notmuch data types and Purebreds. The latter are used in the UI.
API
Threads
getThreads :: (MonadError Error m, MonadIO m) => Text -> NotmuchSettings FilePath -> m (V (Toggleable NotmuchThread)) Source #
creates a vector of threads from a notmuch search
getThreadMessages :: (MonadError Error m, MonadIO m, Traversable t) => FilePath -> t NotmuchThread -> m (Vector (Toggleable NotmuchMail)) Source #
Returns a vector of *all* messages belonging to the list of threads
countThreads :: (MonadError Error m, MonadIO m) => Text -> FilePath -> m Int Source #
Return the number of threads for the given query
Messages
Arguments
:: (Traversable t, MonadError Error m, MonadIO m) | |
=> FilePath | database |
-> [TagOp] | |
-> t NotmuchMail | |
-> m (t NotmuchMail) |
apply tag operations on all given mails and write the resulting tags to the database
mailFilepath :: (MonadError Error m, MonadIO m) => NotmuchMail -> FilePath -> m FilePath Source #
Returns the absolute path to the email. Typically used by the email parser.
Arguments
:: (MonadError Error m, MonadIO m) | |
=> FilePath | database |
-> FilePath | |
-> m () |
Tagging (Labels)
class ManageTags a where Source #
Instances
ManageTags NotmuchThread Source # | |
Defined in Storage.Notmuch Methods tags :: Lens' NotmuchThread [Tag] Source # | |
ManageTags NotmuchMail Source # | |
Defined in Storage.Notmuch Methods tags :: Lens' NotmuchMail [Tag] Source # |
hasTag :: ManageTags a => Tag -> a -> Bool Source #
tagItem :: ManageTags a => [TagOp] -> a -> a Source #
Tag either a NotmuchMail
or a NotmuchThread
addTags :: ManageTags a => [Tag] -> a -> a Source #
removeTags :: ManageTags a => [Tag] -> a -> a Source #
Database
getDatabasePath :: IO FilePath Source #
Returns the notmuch database path by executing 'notmuch config get database.path' in a separate process
withDatabase :: (AsNotmuchError e, Mode a, MonadError e m, MonadIO m) => FilePath -> (Database a -> ExceptT e IO c) -> m c Source #
A helper function for opening and performing work on a database. The database is not explicitly closed (GC will take care of that).