aboutsummaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
authorRaúl Benencia <rul@kalgan.cc>2013-09-05 19:36:33 -0300
committerRaúl Benencia <rul@kalgan.cc>2013-09-05 19:36:33 -0300
commit41b53ca04b6d52457f331930e8fea68416498882 (patch)
treeee63ce86ab4d9a4fc09637a0d5d4015e9f3c9956 /Main.hs
parent84fa12fef1736d04ee79e40cebaadadda262f063 (diff)
New project tree structure
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs19
1 files changed, 14 insertions, 5 deletions
diff --git a/Main.hs b/Main.hs
index 416b65a..2144d9c 100644
--- a/Main.hs
+++ b/Main.hs
@@ -8,15 +8,18 @@
module Main (main) where
+import Control.Monad.Reader(runReaderT)
+import Control.Monad.State(runStateT)
import System.Environment
import System.Exit
import System.FilePath(takeDirectory)
-import Lazymail
-import Email
-import Maildir
-import Screen
-import State
+import Lazymail.Config(customConfig)
+import Lazymail.Email
+import Lazymail.Maildir
+import Lazymail.Screen
+import Lazymail.State
+import Lazymail.Types
parse ["-h"] = usage >> exit
parse ["--help"] = usage >> exit
@@ -24,6 +27,12 @@ parse ["-v"] = version >> exit
parse ["--version"] = version >> exit
parse _ = run entryPoint
+run :: Lazymail a -> IO (a, LazymailState)
+run k =
+ let config = customConfig
+ state = initialState { basePath = initialPath config }
+ in runStateT (runReaderT k config) state
+
usage = putStrLn . unlines $ usageText where
usageText = ["Usage: ./Main [-vh] <maildirs>"
," where <maildirs> is a directory with Maildirs, or a Maildir itself."
nihil fit ex nihilo