diff options
author | Yuchen Pei <hi@ypei.me> | 2022-05-27 18:57:24 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-05-27 18:57:24 +1000 |
commit | caf354c7e5bcb5142d8b4358824d22d3de122f34 (patch) | |
tree | 7e19673f611424f4b6c44ee5316aad94aab2371a /src/Main.hs | |
parent | 44a5cd797d72003f580f18871d9e70c06afeb13b (diff) |
break apart the code, timestamp read imp.
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs new file mode 100644 index 0000000..f3f8a5a --- /dev/null +++ b/src/Main.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE OverloadedStrings #-} + +import System.Directory +import Control.Monad.Extra +import F2Md.Types +import F2Md.Import +import F2Md.Export +import F2Md.Config +import System.FilePath + +main :: IO () +main = do + (feeds, maildir) <- getUserdata "./.f2m.json" + whenJust maildir $ \root -> do + mapM_ (createDirectoryIfMissing True) + [root </> "new", root </> "cur", root </> "tmp"] + messages <- (fmap concat . sequence) $ + (\feed -> toMessagesFromUrl (url feed) (lastUpdated feed)) <$> feeds + mapM_ (writeMessage root) messages |