aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2020-12-08 19:49:06 +0100
committerFélix Sipma <felix.sipma@no-log.org>2020-12-08 19:49:32 +0100
commit955c86b7e7558d20ab7adb79b71ef9cb44ced1f0 (patch)
tree367122b3e0d8ace3e1045eebf46df8cdb4575b80
parentafc39c4b62088c81e0c59411c54560cae033b322 (diff)
upgrade to lts-16.25
-rw-r--r--perfeed.cabal2
-rw-r--r--src/Atom.hs1
-rw-r--r--src/Config.hs1
-rw-r--r--src/DB.hs3
-rw-r--r--src/Filter.hs3
-rw-r--r--src/Parse.hs2
-rw-r--r--src/RSS.hs5
-rw-r--r--src/RSS1.hs12
-rw-r--r--stack-dev.yaml2
-rw-r--r--stack.yaml2
10 files changed, 14 insertions, 19 deletions
diff --git a/perfeed.cabal b/perfeed.cabal
index 84d92fe..8574720 100644
--- a/perfeed.cabal
+++ b/perfeed.cabal
@@ -1,5 +1,5 @@
name: perfeed
-version: 0.13.1
+version: 0.14.0
synopsis: Fetch Atom/RSS feeds and convert entries to emails
description: Please see README.md
homepage: http://git.gueux.org/perfeed.git
diff --git a/src/Atom.hs b/src/Atom.hs
index 611f265..d5dcdad 100644
--- a/src/Atom.hs
+++ b/src/Atom.hs
@@ -8,7 +8,6 @@ import Protolude
import Text.XML.Cursor
import Text.XML ( Name (..) )
import qualified Data.Text.Lazy as TL
-import Data.Maybe ( catMaybes, listToMaybe, isNothing )
import Data.Time.Clock ( UTCTime )
import Control.Monad.Logger ( MonadLogger, logWarn, logError )
import Text.Blaze ( toMarkup )
diff --git a/src/Config.hs b/src/Config.hs
index 241d37f..da38fa0 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -15,7 +15,6 @@ module Config
import Protolude
import Path
import System.Environment ( lookupEnv )
-import Data.Maybe ( fromMaybe )
import System.Directory ( doesFileExist
, doesDirectoryExist
, createDirectoryIfMissing
diff --git a/src/DB.hs b/src/DB.hs
index 9d72600..ba3611d 100644
--- a/src/DB.hs
+++ b/src/DB.hs
@@ -7,6 +7,9 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE UndecidableInstances #-}
module DB where
import Protolude
diff --git a/src/Filter.hs b/src/Filter.hs
index aba3bfd..94ddc9f 100644
--- a/src/Filter.hs
+++ b/src/Filter.hs
@@ -20,13 +20,10 @@ import Text.XML.Cursor ( Cursor )
import qualified Control.Exception as E
import System.Process ( createProcess, proc, std_in, std_out, std_err, StdStream (..), waitForProcess )
import System.IO ( hClose )
-import Control.Concurrent ( forkIO, putMVar, takeMVar, newEmptyMVar )
import qualified Data.ByteString.Lazy as LBS
import qualified Data.ByteString as B
import qualified Data.Text as T
-import System.Exit ( ExitCode (..) )
import Data.List ( partition )
-import Control.Monad.IO.Class ( MonadIO, liftIO )
import Control.Monad.Logger ( MonadLogger, logError )
import Types
diff --git a/src/Parse.hs b/src/Parse.hs
index 2a6786b..e0ac7af 100644
--- a/src/Parse.hs
+++ b/src/Parse.hs
@@ -13,14 +13,12 @@ module Parse
import Protolude hiding ( readFile )
import Control.Monad.Fail ( MonadFail )
-import Control.Monad.IO.Class ( MonadIO, liftIO )
import Text.XML
import Text.XML.Cursor
import Network.HTTP.Conduit ( parseRequest, httpLbs, Manager
, HttpException, responseBody )
import qualified Data.Text as T
import Control.Monad.Logger ( MonadLogger, logError )
-import Control.Exception ( try )
import Types
import Filter
diff --git a/src/RSS.hs b/src/RSS.hs
index a7f242c..b5fd490 100644
--- a/src/RSS.hs
+++ b/src/RSS.hs
@@ -8,9 +8,8 @@ import Protolude
import Text.XML.Cursor
import Text.XML ( Name (..) )
import qualified Data.Text.Lazy as TL
-import Data.Maybe ( catMaybes, listToMaybe, isNothing )
import Data.Time.Clock ( UTCTime (..) )
-import Data.Time.Format ( ParseTime (..), defaultTimeLocale )
+import Data.Time.Format ( defaultTimeLocale, parseTimeM )
import Control.Monad.Logger ( MonadLogger, logWarn, logError )
import Date
import Types
@@ -34,7 +33,7 @@ parseTitle c =
parseUpdated :: MonadLogger m => [Entry] -> Cursor -> m (Maybe UTCTime)
parseUpdated e c = case mconcat $ parseFieldContent "lastBuildDate" c of
"" -> case e of
- [] -> return (buildTime defaultTimeLocale [])
+ [] -> return $ parseTimeM True defaultTimeLocale "%Y-%m-%d" "1970-01-01"
-- ^ Just 1970-01-01 00:00:00 UTC
_ -> case map entryUpdated e of
[] -> return Nothing
diff --git a/src/RSS1.hs b/src/RSS1.hs
index 7974b7c..6dc583d 100644
--- a/src/RSS1.hs
+++ b/src/RSS1.hs
@@ -7,10 +7,10 @@ module RSS1
import Protolude
import Text.XML.Cursor
import Text.XML ( Name (..) )
+import Control.Monad.Fail ( MonadFail )
import qualified Data.Text.Lazy as TL
-import Data.Maybe ( catMaybes, listToMaybe, isNothing )
import Data.Time.Clock ( UTCTime )
-import Data.Time.Format ( ParseTime (..), defaultTimeLocale )
+import Data.Time.Format ( defaultTimeLocale, parseTimeM )
import Control.Monad.Logger ( MonadLogger, logWarn, logError )
import Date
import Types
@@ -31,10 +31,10 @@ parseTitle c =
mconcat (parseFieldContent "title" c)
`mappend` mconcat (c $/ element "{http://purl.org/dc/elements/1.1/}subject" &// content)
-parseUpdated :: MonadLogger m => [Entry] -> Cursor -> m (Maybe UTCTime)
+parseUpdated :: (MonadFail m, MonadLogger m) => [Entry] -> Cursor -> m (Maybe UTCTime)
parseUpdated e c = case mconcat $ parseFieldContent "lastBuildDate" c of
"" -> case e of
- [] -> return (buildTime defaultTimeLocale [])
+ [] -> return $ parseTimeM True defaultTimeLocale "%Y-%m-%d" "1970-01-01"
-- ^ Just 1970-01-01 00:00:00 UTC
_ -> case map entryUpdated e of
[] -> return Nothing
@@ -96,7 +96,7 @@ parseEntry c = do
parseEntries :: MonadLogger m => Cursor -> m [Entry]
parseEntries c = catMaybes <$> sequence (c $// localNameFilter "item" &| parseEntry)
-parseFeed' :: MonadLogger m => [Entry] -> Url -> Cursor -> m (Maybe Feed)
+parseFeed' :: (MonadFail m, MonadLogger m) => [Entry] -> Url -> Cursor -> m (Maybe Feed)
parseFeed' entries u c = do
let title = parseTitle c
links = parseLinks c
@@ -108,7 +108,7 @@ parseFeed' entries u c = do
$logError $ formatParseFeedUpdatedError i t
return Nothing
-parseRSS1Feed :: MonadLogger m => Url -> Cursor -> m (Maybe Feed)
+parseRSS1Feed :: (MonadFail m, MonadLogger m) => Url -> Cursor -> m (Maybe Feed)
parseRSS1Feed u c = do
entries <- concat <$> sequence (c $| localNameFilter "RDF" &| parseEntries)
mfeeds <- sequence (c $| localNameFilter "RDF" &// localNameFilter "channel" &| parseFeed' entries u)
diff --git a/stack-dev.yaml b/stack-dev.yaml
index 5785812..cb3132e 100644
--- a/stack-dev.yaml
+++ b/stack-dev.yaml
@@ -4,4 +4,4 @@ flags:
packages:
- '.'
extra-deps: []
-resolver: lts-14.0
+resolver: lts-16.25
diff --git a/stack.yaml b/stack.yaml
index da257ec..e57795a 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -2,4 +2,4 @@ flags: {}
packages:
- '.'
extra-deps: []
-resolver: lts-14.0
+resolver: lts-16.25