aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2019-01-23 14:14:13 +0100
committerFélix Sipma <felix.sipma@no-log.org>2019-01-23 14:14:38 +0100
commit2b89d301e4010f45914527e5cc61ef1ab5f9cc12 (patch)
tree08517add3028291ea553c7d30393560f12462662
parent37660ba66fd7023d450d6246807de4991d79d004 (diff)
upgrade to lts-13.4: add MonadFail constraints
-rw-r--r--src/Filter.hs5
-rw-r--r--src/Parse.hs3
-rw-r--r--src/Run.hs5
-rw-r--r--stack-dev.yaml2
-rw-r--r--stack.yaml2
5 files changed, 10 insertions, 7 deletions
diff --git a/src/Filter.hs b/src/Filter.hs
index 7af7eac..ad31f65 100644
--- a/src/Filter.hs
+++ b/src/Filter.hs
@@ -13,6 +13,7 @@ module Filter
import Protolude
import Control.Monad ( fail )
+import Control.Monad.Fail ( MonadFail )
import Data.Aeson
import Data.Aeson.Types
import Data.String ( words, unwords )
@@ -86,13 +87,13 @@ applyCursorFilters fs c = foldr applyCursorFilter c fs
applyCursorFilter (CursorFilter _ f) c' = f c'
applyCursorFilter _ c' = c'
-applyExternalFilters :: (MonadIO m, MonadLogger m) => [FeedFilter] -> LBS.ByteString -> m (Maybe LBS.ByteString)
+applyExternalFilters :: (MonadIO m, MonadLogger m, MonadFail m) => [FeedFilter] -> LBS.ByteString -> m (Maybe LBS.ByteString)
applyExternalFilters fs lbs = foldM (\ms f -> maybe (return Nothing) (applyExternalFilter f) ms) (Just lbs) fs
where
applyExternalFilter (ExternalFilter fp opts) lbs' = applyExternalFilter' fp opts lbs'
applyExternalFilter (CursorFilter _ _) lbs' = return $ Just lbs'
-applyExternalFilter' :: (MonadIO m, MonadLogger m) => FilePath -> [[Char]] -> LBS.ByteString -> m (Maybe LBS.ByteString)
+applyExternalFilter' :: (MonadIO m, MonadLogger m, MonadFail m) => FilePath -> [[Char]] -> LBS.ByteString -> m (Maybe LBS.ByteString)
applyExternalFilter' fp opts lbs = do
(Just hin, mHOut, mHErr, phandle) <- liftIO $ createProcess (proc fp opts)
{ std_in = CreatePipe
diff --git a/src/Parse.hs b/src/Parse.hs
index 72df6ae..2a6786b 100644
--- a/src/Parse.hs
+++ b/src/Parse.hs
@@ -12,6 +12,7 @@ module Parse
) where
import Protolude hiding ( readFile )
+import Control.Monad.Fail ( MonadFail )
import Control.Monad.IO.Class ( MonadIO, liftIO )
import Text.XML
import Text.XML.Cursor
@@ -32,7 +33,7 @@ cursorFromFile file = do
doc <- liftIO $ readFile parseSettings file
return $ fromDocument doc
-cursorFromUrl :: (MonadIO m, MonadLogger m) => Manager -> Url -> [FeedFilter] -> m (Maybe Cursor)
+cursorFromUrl :: (MonadIO m, MonadLogger m, MonadFail m) => Manager -> Url -> [FeedFilter] -> m (Maybe Cursor)
cursorFromUrl manager u filters = do
let (cursorfilters, externalfilters) = partitionFilters filters
request <- liftIO $ parseRequest $ toS u
diff --git a/src/Run.hs b/src/Run.hs
index e83a9a8..eb2a41a 100644
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -16,6 +16,7 @@ import System.Directory ( doesFileExist
, doesDirectoryExist
, createDirectoryIfMissing
)
+import Control.Monad.Fail ( MonadFail )
import Control.Monad.Logger ( MonadLogger, logError,
runStderrLoggingT,
filterLogger, logDebug
@@ -33,12 +34,12 @@ import RSS1
import Filter
-checkFeeds :: (MonadIO m, MonadUnliftIO m, MonadLogger m) => Maybe Database -> (Feed -> [Entry] -> m ()) -> [FeedInfo] -> m ()
+checkFeeds :: (MonadIO m, MonadUnliftIO m, MonadLogger m, MonadFail m) => Maybe Database -> (Feed -> [Entry] -> m ()) -> [FeedInfo] -> m ()
checkFeeds mdb manageEntries infos = do
manager <- liftIO $ newManager tlsManagerSettings
mapM_ (\i -> checkFeed manager mdb manageEntries (feedInfoUrl i) (feedInfoFilter i)) infos
-checkFeed :: (MonadIO m, MonadUnliftIO m, MonadLogger m) => Manager -> Maybe Database -> (Feed -> [Entry] -> m ()) -> Url -> [FeedFilter] -> m ()
+checkFeed :: (MonadIO m, MonadUnliftIO m, MonadLogger m, MonadFail m) => Manager -> Maybe Database -> (Feed -> [Entry] -> m ()) -> Url -> [FeedFilter] -> m ()
checkFeed manager mdb manageEntries url filters = do
mcursor <- cursorFromUrl manager url filters
case mcursor of
diff --git a/stack-dev.yaml b/stack-dev.yaml
index 6a4abb5..6d2e8be 100644
--- a/stack-dev.yaml
+++ b/stack-dev.yaml
@@ -4,4 +4,4 @@ flags:
packages:
- '.'
extra-deps: []
-resolver: lts-10.5
+resolver: lts-13.4
diff --git a/stack.yaml b/stack.yaml
index eeec6d2..1f959f5 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -2,4 +2,4 @@ flags: {}
packages:
- '.'
extra-deps: []
-resolver: lts-12.22
+resolver: lts-13.4