38 lines
972 B
Haskell
38 lines
972 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
{-# LANGUAGE DeriveFunctor #-}
|
|
module FeedMonad where
|
|
|
|
import Data.Text (Text)
|
|
import Data.Entry (URL)
|
|
import Middleware (Middleware)
|
|
import Numeric.Natural (Natural)
|
|
import Data.Category (Category)
|
|
|
|
|
|
newtype Minutes = Minutes Natural
|
|
|
|
data FeedMonad = FeedMonad
|
|
{ feeds :: [Category URL]
|
|
-- ^ The forest of urls for the feeds. It's a forest because of the categories
|
|
, filters :: Middleware
|
|
-- ^ The middleware. Modifies the scoring, tags and content
|
|
, refreshTime :: Minutes
|
|
-- ^ How often to refresh the feeds
|
|
, secretToken :: Text
|
|
-- ^ Used for authenticating the UI. This is a single user app
|
|
-- served over http, so we can get around with hardcoded
|
|
-- authentication token
|
|
}
|
|
|
|
defaultConfig :: FeedMonad
|
|
defaultConfig = FeedMonad
|
|
{ feeds = []
|
|
, filters = id
|
|
, refreshTime = Minutes 30
|
|
, secretToken = "i am a secret"
|
|
}
|
|
|
|
defaultMain :: FeedMonad -> IO ()
|
|
defaultMain f =
|
|
print $ feeds f
|