From 067c9c10e08bc48678687996945b35fa921229f4 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 26 Jan 2017 22:10:29 +0100 Subject: Basic concepts --- src/Main.hs | 4 ---- src/Simple.hs | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) delete mode 100644 src/Main.hs create mode 100644 src/Simple.hs (limited to 'src') diff --git a/src/Main.hs b/src/Main.hs deleted file mode 100644 index 65ae4a0..0000000 --- a/src/Main.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Main where - -main :: IO () -main = putStrLn "Hello, Haskell!" diff --git a/src/Simple.hs b/src/Simple.hs new file mode 100644 index 0000000..f461766 --- /dev/null +++ b/src/Simple.hs @@ -0,0 +1,24 @@ +module Main (main) where + +import Postdelay.Scan + +import Control.Monad.IO.Class +import Control.Monad.Trans.Except + + +main :: MonadIO m => m () +main = do + mailStr <- liftIO getContents + delay <- runExceptT $ scan mailStr + case delay of + Left err -> do + liftIO . putStrLn $ show err + sendNow mailStr + Right Nothing -> sendNow mailStr + Right (Just d) -> sendLater mailStr d + +sendNow :: MonadIO m => String -> m () +sendNow = undefined + +sendLater :: MonadIO m => String -> Delay -> m () +sendLater = undefined -- cgit v1.2.3