summaryrefslogtreecommitdiff
path: root/src/Simple.hs
blob: f4617661a9b7af7ffe13abf4d7c73b1f76f9362c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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