Safe Haskell | None |
---|---|
Language | Haskell98 |
Meta-module that reexports many Imm sub-modules.
To get started, please consult Imm.Boot.
Synopsis
- data LogLevel
- log :: Handle m -> LogLevel -> Doc AnsiStyle -> m ()
- getLogLevel :: Handle m -> m LogLevel
- setLogLevel :: Handle m -> LogLevel -> m ()
- setColorizeLogs :: Handle m -> Bool -> m ()
- flushLogs :: Handle m -> m ()
- httpGet :: Handle m -> URI -> m LByteString
- get :: Monad m => Handle m -> Handle m -> URI -> m LByteString
- data FeedElement
- data Feed
- = Rss (RssDocument '[ContentModule, DublinCoreModule])
- | Atom AtomFeed
- data FeedRef
- getFeedTitle :: Feed -> Text
- getElements :: Feed -> [FeedElement]
- getDate :: FeedElement -> Maybe UTCTime
- getTitle :: FeedElement -> Text
- getContent :: FeedElement -> Text
- getHashes :: FeedElement -> [Int]
- prettyElement :: FeedElement -> Doc a
- processNewElement :: Handle m -> Feed -> FeedElement -> m ()
- onNewElement :: Monad m => Handle m -> Handle m -> Feed -> FeedElement -> m ()
- data DatabaseException t
- = NotCommitted t
- | NotDeleted t [Key t]
- | NotFound t [Key t]
- | NotInserted t [(Key t, Entry t)]
- | NotPurged t
- | NotUpdated t (Key t)
- | UnableFetchAll t
- _describeDatabase :: Handle m t -> forall a. m (Doc a)
- _fetchList :: Handle m t -> [Key t] -> m (Map (Key t) (Entry t))
- _fetchAll :: Handle m t -> m (Map (Key t) (Entry t))
- _update :: Handle m t -> Key t -> (Entry t -> Entry t) -> m ()
- _insertList :: Handle m t -> [(Key t, Entry t)] -> m ()
- _deleteList :: Handle m t -> [Key t] -> m ()
- _purge :: Handle m t -> m ()
- _commit :: Handle m t -> m ()
- class (Ord (Key t), Show (Key t), Show (Entry t), Typeable t, Show t, Pretty t, Pretty (Key t)) => Table t where
- fetch :: Monad m => Table t => MonadThrow m => Handle m t -> Key t -> m (Entry t)
- fetchList :: Monad m => Handle m t -> [Key t] -> m (Map (Key t) (Entry t))
- fetchAll :: Monad m => Handle m t -> m (Map (Key t) (Entry t))
- update :: Monad m => Handle m t -> Key t -> (Entry t -> Entry t) -> m ()
- insert :: Monad m => Handle m -> Handle m t -> Key t -> Entry t -> m ()
- insertList :: Monad m => Handle m -> Handle m t -> [(Key t, Entry t)] -> m ()
- delete :: Monad m => Handle m -> Handle m t -> Key t -> m ()
- deleteList :: Monad m => Handle m -> Handle m t -> [Key t] -> m ()
- purge :: Monad m => Handle m -> Handle m t -> m ()
- commit :: Monad m => Handle m -> Handle m t -> m ()
- table :: Table t => Handle m t -> t
- printVersions :: MonadBase IO m => m ()
- showFeed :: MonadThrow m => Handle m -> Handle m FeedTable -> [FeedID] -> m ()
- subscribe :: MonadCatch m => Handle m -> Handle m FeedTable -> URI -> Set Text -> m ()
- check :: (MonadAsync m, MonadCatch m) => Handle m -> Handle m FeedTable -> Handle m -> Handle m -> [FeedID] -> m ()
- run :: (MonadTime m, MonadAsync m, MonadCatch m) => Handle m -> Handle m FeedTable -> Handle m -> Handle m -> Handle m -> [FeedID] -> m ()
- importOPML :: MonadCatch m => Handle m -> Handle m FeedTable -> ConduitT () ByteString m () -> m ()
- imm :: Handle IO -> Handle IO FeedTable -> Handle IO -> Handle IO -> Handle IO -> IO ()
Documentation
getLogLevel :: Handle m -> m LogLevel Source #
setLogLevel :: Handle m -> LogLevel -> m () Source #
setColorizeLogs :: Handle m -> Bool -> m () Source #
get :: Monad m => Handle m -> Handle m -> URI -> m LByteString Source #
Simple wrapper around httpGet
that also logs the requested URI.
data FeedElement Source #
Instances
Eq FeedElement Source # | |
Defined in Imm.Feed (==) :: FeedElement -> FeedElement -> Bool # (/=) :: FeedElement -> FeedElement -> Bool # | |
Show FeedElement Source # | |
Defined in Imm.Feed showsPrec :: Int -> FeedElement -> ShowS # show :: FeedElement -> String # showList :: [FeedElement] -> ShowS # |
Feed reference: either its URI, or its UID from database
getFeedTitle :: Feed -> Text Source #
getElements :: Feed -> [FeedElement] Source #
getTitle :: FeedElement -> Text Source #
getContent :: FeedElement -> Text Source #
getHashes :: FeedElement -> [Int] Source #
prettyElement :: FeedElement -> Doc a Source #
processNewElement :: Handle m -> Feed -> FeedElement -> m () Source #
Action triggered for each unread feed element
onNewElement :: Monad m => Handle m -> Handle m -> Feed -> FeedElement -> m () Source #
data DatabaseException t Source #
NotCommitted t | |
NotDeleted t [Key t] | |
NotFound t [Key t] | |
NotInserted t [(Key t, Entry t)] | |
NotPurged t | |
NotUpdated t (Key t) | |
UnableFetchAll t |
Instances
(Eq t, Eq (Key t), Eq (Entry t)) => Eq (DatabaseException t) Source # | |
Defined in Imm.Database (==) :: DatabaseException t -> DatabaseException t -> Bool # (/=) :: DatabaseException t -> DatabaseException t -> Bool # | |
(Show t, Show (Key t), Show (Entry t)) => Show (DatabaseException t) Source # | |
Defined in Imm.Database showsPrec :: Int -> DatabaseException t -> ShowS # show :: DatabaseException t -> String # showList :: [DatabaseException t] -> ShowS # | |
(Table t, Show (Key t), Show (Entry t), Pretty (Key t), Typeable t) => Exception (DatabaseException t) Source # | |
Defined in Imm.Database toException :: DatabaseException t -> SomeException # fromException :: SomeException -> Maybe (DatabaseException t) # displayException :: DatabaseException t -> String # | |
(Pretty t, Pretty (Key t)) => Pretty (DatabaseException t) Source # | |
Defined in Imm.Database pretty :: DatabaseException t -> Doc ann # prettyList :: [DatabaseException t] -> Doc ann # |
_describeDatabase :: Handle m t -> forall a. m (Doc a) Source #
_deleteList :: Handle m t -> [Key t] -> m () Source #
class (Ord (Key t), Show (Key t), Show (Entry t), Typeable t, Show t, Pretty t, Pretty (Key t)) => Table t where Source #
Generic database table
printVersions :: MonadBase IO m => m () Source #
showFeed :: MonadThrow m => Handle m -> Handle m FeedTable -> [FeedID] -> m () Source #
Print database status for given feed(s)
subscribe :: MonadCatch m => Handle m -> Handle m FeedTable -> URI -> Set Text -> m () Source #
Register the given feed URI in database
check :: (MonadAsync m, MonadCatch m) => Handle m -> Handle m FeedTable -> Handle m -> Handle m -> [FeedID] -> m () Source #
Check for unread elements without processing them
run :: (MonadTime m, MonadAsync m, MonadCatch m) => Handle m -> Handle m FeedTable -> Handle m -> Handle m -> Handle m -> [FeedID] -> m () Source #
importOPML :: MonadCatch m => Handle m -> Handle m FeedTable -> ConduitT () ByteString m () -> m () Source #
subscribe
to all feeds described by the OPML document provided in input
imm :: Handle IO -> Handle IO FeedTable -> Handle IO -> Handle IO -> Handle IO -> IO () Source #
Main function, meant to be used in your personal configuration file.
Here is an example:
import Imm.Boot import Imm.Database.JsonFile as Database import Imm.Feed import Imm.Hooks.SendMail as Hooks import Imm.HTTP.Simple as HTTP import Imm.Logger.Simple as Logger import Imm.XML.Conduit as XML main :: IO () main = do logger <- Logger.mkHandle <$> defaultLogger database <- Database.mkHandle <$> defaultDatabase httpClient <- HTTP.mkHandle <$> defaultManager imm logger database httpClient hooks xmlParser xmlParser :: XML.Handle IO xmlParser = XML.mkHandle defaultXmlParser hooks :: Hooks.Handle IO hooks = Hooks.mkHandle $ SendMailSettings smtpServer formatMail formatMail :: FormatMail formatMail = FormatMail (\a b -> (defaultFormatFrom a b) { addressEmail = "user@host" } ) defaultFormatSubject defaultFormatBody (\_ _ -> [Address Nothing "user@host"]) smtpServer :: Feed -> FeedElement -> SMTPServer smtpServer _ _ = SMTPServer (Just $ Authentication PLAIN "user" "password") (StartTls "smtp.host" defaultSettingsSMTPSTARTTLS)