Can parse a feed
This commit is contained in:
parent
1e661fe3ca
commit
21520d987f
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
dist-newstyle
|
dist-newstyle
|
||||||
.envrc
|
.envrc
|
||||||
/FeedMonad/state/
|
/FeedMonad/state/
|
||||||
|
/state/
|
||||||
|
@ -54,6 +54,7 @@ library
|
|||||||
, safecopy
|
, safecopy
|
||||||
, xdg-basedir
|
, xdg-basedir
|
||||||
, free
|
, free
|
||||||
|
, feed
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
{ mkDerivation, acid-state, base, bytestring, containers
|
{ mkDerivation, acid-state, base, bytestring, containers, feed
|
||||||
, http-client, http-client-tls, lens, lib, mtl, safecopy, servant
|
, free, http-client, http-client-tls, lens, lib, mtl, safecopy
|
||||||
, servant-server, text, xdg-basedir
|
, servant, servant-server, text, xdg-basedir
|
||||||
}:
|
}:
|
||||||
mkDerivation {
|
mkDerivation {
|
||||||
pname = "FeedMonad";
|
pname = "FeedMonad";
|
||||||
version = "0.1.0.0";
|
version = "0.1.0.0";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
libraryHaskellDepends = [
|
libraryHaskellDepends = [
|
||||||
acid-state base bytestring containers http-client http-client-tls
|
acid-state base bytestring containers feed free http-client
|
||||||
lens mtl safecopy servant servant-server text xdg-basedir
|
http-client-tls lens mtl safecopy servant servant-server text
|
||||||
|
xdg-basedir
|
||||||
];
|
];
|
||||||
license = "unknown";
|
license = "unknown";
|
||||||
hydraPlatforms = lib.platforms.none;
|
hydraPlatforms = lib.platforms.none;
|
||||||
|
@ -14,6 +14,9 @@ import Control.Monad.App (runApp)
|
|||||||
import Data.Environment
|
import Data.Environment
|
||||||
import Control.Monad.Trans (liftIO)
|
import Control.Monad.Trans (liftIO)
|
||||||
import Data.URL (URL)
|
import Data.URL (URL)
|
||||||
|
import Data.Foldable (for_)
|
||||||
|
import Control.Monad.HTTP (fetch, execute)
|
||||||
|
import Text.Feed.Import (parseFeedSource)
|
||||||
|
|
||||||
|
|
||||||
newtype Minutes = Minutes Natural
|
newtype Minutes = Minutes Natural
|
||||||
@ -44,4 +47,6 @@ defaultMain f =
|
|||||||
bracket (openLocalState emptyFeedMonadState) closeAcidState $ \st -> do
|
bracket (openLocalState emptyFeedMonadState) closeAcidState $ \st -> do
|
||||||
mgr <- newTlsManager
|
mgr <- newTlsManager
|
||||||
runApp (Environment mgr st) $
|
runApp (Environment mgr st) $
|
||||||
liftIO $ print $ feeds f
|
for_ (feeds f) $ \c -> for_ c $ \url -> do
|
||||||
|
feed <- parseFeedSource <$> liftIO (execute mgr (fetch url))
|
||||||
|
liftIO $ print feed
|
||||||
|
Loading…
Reference in New Issue
Block a user