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
|
||||
.envrc
|
||||
/FeedMonad/state/
|
||||
/state/
|
||||
|
@ -54,6 +54,7 @@ library
|
||||
, safecopy
|
||||
, xdg-basedir
|
||||
, free
|
||||
, feed
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
ghc-options: -Wall
|
||||
|
@ -1,14 +1,15 @@
|
||||
{ mkDerivation, acid-state, base, bytestring, containers
|
||||
, http-client, http-client-tls, lens, lib, mtl, safecopy, servant
|
||||
, servant-server, text, xdg-basedir
|
||||
{ mkDerivation, acid-state, base, bytestring, containers, feed
|
||||
, free, http-client, http-client-tls, lens, lib, mtl, safecopy
|
||||
, servant, servant-server, text, xdg-basedir
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "FeedMonad";
|
||||
version = "0.1.0.0";
|
||||
src = ./.;
|
||||
libraryHaskellDepends = [
|
||||
acid-state base bytestring containers http-client http-client-tls
|
||||
lens mtl safecopy servant servant-server text xdg-basedir
|
||||
acid-state base bytestring containers feed free http-client
|
||||
http-client-tls lens mtl safecopy servant servant-server text
|
||||
xdg-basedir
|
||||
];
|
||||
license = "unknown";
|
||||
hydraPlatforms = lib.platforms.none;
|
||||
|
@ -14,6 +14,9 @@ import Control.Monad.App (runApp)
|
||||
import Data.Environment
|
||||
import Control.Monad.Trans (liftIO)
|
||||
import Data.URL (URL)
|
||||
import Data.Foldable (for_)
|
||||
import Control.Monad.HTTP (fetch, execute)
|
||||
import Text.Feed.Import (parseFeedSource)
|
||||
|
||||
|
||||
newtype Minutes = Minutes Natural
|
||||
@ -44,4 +47,6 @@ defaultMain f =
|
||||
bracket (openLocalState emptyFeedMonadState) closeAcidState $ \st -> do
|
||||
mgr <- newTlsManager
|
||||
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