module CommandLine (
get_args,
- show_help)
+ show_help )
where
import System.Console.CmdArgs (
program,
summary,
typ,
- versionArg)
+ versionArg )
import System.Environment (withArgs)
-- Get the version from Cabal.
import Paths_halcyon (version)
import Data.Version (showVersion)
-import OptionalConfiguration
+import OptionalConfiguration ( OptionalCfg(..) )
description :: String
description =
module Configuration (
Cfg(..),
default_config,
- merge_optional
-)
+ merge_optional )
where
-import qualified OptionalConfiguration as OC
-import Usernames
+import qualified OptionalConfiguration as OC ( OptionalCfg(..) )
+import Usernames ( Usernames(..) )
data Cfg =
Cfg { consumer_key :: String,
--- |All exit codes that the program can return (excepting
--- ExitSuccess). There's only one, since the program will try and fail
--- forever upon errors.
-module ExitCodes (
- exit_args_parse_failed,
- exit_no_usernames
- )
+-- | All exit codes that the program can return (excepting
+-- ExitSuccess).
+module ExitCodes ( exit_no_usernames )
where
--- |Indicates that the command-line arguments could not be parsed.
-exit_args_parse_failed :: Int
-exit_args_parse_failed = 1
-
-- | No usernames found on either the command-line or in a config
-- file.
exit_no_usernames :: Int
-exit_no_usernames = 2
+exit_no_usernames = 1
module Html (
html_tests,
- replace_entities
- )
+ replace_entities )
where
-import Test.Framework (Test, testGroup)
-import Test.Framework.Providers.HUnit (testCase)
-import Test.HUnit (Assertion, assertEqual)
-import Text.HTML.TagSoup.Entity (lookupEntity)
+import Test.Framework ( Test, testGroup )
+import Test.Framework.Providers.HUnit ( testCase )
+import Test.HUnit ( Assertion, assertEqual )
+import Text.HTML.TagSoup.Entity ( lookupEntity )
replace_entities :: String -> String
replace_entities [] = []
default_headers,
print_sendmail_result,
rfc822_now,
- sendmail
- )
+ sendmail )
where
-import Control.Concurrent
-import Control.Exception (evaluate)
-import Control.Monad (liftM)
-import Data.List (intercalate)
-import Data.Time (formatTime, getZonedTime)
-import System.Exit
-import System.Locale (defaultTimeLocale, rfc822DateFormat)
-import System.Process
-import System.IO (hClose, hGetContents, hPutStr)
+import Control.Concurrent ( forkIO, newEmptyMVar, putMVar, readMVar )
+import Control.Exception ( evaluate )
+import Control.Monad ( liftM )
+import Data.List ( intercalate )
+import Data.Time ( formatTime, getZonedTime )
+import System.Exit ( ExitCode(..) )
+import System.Locale ( defaultTimeLocale, rfc822DateFormat )
+import System.Process ( runInteractiveProcess, waitForProcess )
+import System.IO ( hClose, hGetContents, hPutStr )
type Header = String
module Main
where
-import Control.Concurrent (forkIO, threadDelay)
-import Control.Monad (forever, when)
-import Data.Aeson (decode)
-import Data.List ((\\))
-import Data.Maybe (fromMaybe, isNothing)
-import Data.Monoid ((<>))
-import Data.Time.LocalTime (TimeZone, getCurrentTimeZone)
-import System.Exit (ExitCode(..), exitWith)
-import System.IO (hPutStrLn, stderr)
-
-import CommandLine
-import Configuration (Cfg(..), default_config, merge_optional)
-import ExitCodes (exit_no_usernames)
-import qualified OptionalConfiguration as OC
+import Control.Concurrent ( forkIO, threadDelay )
+import Control.Monad ( forever, when )
+import Data.Aeson ( decode )
+import Data.List ( (\\) )
+import Data.Maybe ( fromMaybe, isNothing )
+import Data.Monoid ( (<>) )
+import Data.Time.LocalTime ( TimeZone, getCurrentTimeZone )
+import System.Exit ( ExitCode(..), exitWith )
+import System.IO ( hPutStrLn, stderr )
+
+import CommandLine ( get_args, show_help )
+import Configuration ( Cfg(..), default_config, merge_optional )
+import ExitCodes ( exit_no_usernames )
+import qualified OptionalConfiguration as OC ( from_rc )
import Mail (
Message(..),
default_headers,
print_sendmail_result,
rfc822_now,
- sendmail)
-import Twitter.Http
-import Twitter.Status
-import Twitter.User
-import Usernames (Usernames(..))
+ sendmail )
+import Twitter.Http ( get_user_new_statuses, get_user_timeline )
+import Twitter.Status (
+ Status(..),
+ Timeline,
+ get_max_status_id,
+ pretty_print,
+ utc_time_to_rfc822 )
+import Twitter.User ( User(..) )
+import Usernames ( Usernames(..) )
-- | A wrapper around threadDelay which takes seconds instead of
-- microseconds as its argument.
module OptionalConfiguration (
OptionalCfg(..),
- from_rc
- )
+ from_rc )
where
-import qualified Data.Configurator as DC
+import qualified Data.Configurator as DC (
+ Worth (Optional),
+ load,
+ lookup )
-import Data.Data (Data)
-import Data.Maybe (fromMaybe)
-import Data.Monoid (Monoid(..))
-import Data.Typeable (Typeable)
+import Data.Data ( Data )
+import Data.Maybe ( fromMaybe )
+import Data.Monoid ( Monoid(..) )
+import Data.Typeable ( Typeable )
-import Usernames
+import Usernames ( Usernames(..) )
-- | The same as Cfg, except everything is optional. It's easy to
-- | Miscellaneous functions for manipulating string.
module StringUtils (
listify,
- string_utils_tests
- )
+ string_utils_tests )
where
-import Test.Framework (Test, testGroup)
-import Test.Framework.Providers.HUnit (testCase)
-import Test.HUnit (Assertion, assertEqual)
+import Test.Framework ( Test, testGroup )
+import Test.Framework.Providers.HUnit ( testCase )
+import Test.HUnit ( Assertion, assertEqual )
-- | Takes a list of strings, call them string1, string2, etc. and
module Twitter.Http (
get_user_new_statuses,
get_user_timeline,
- http_get
- )
+ http_get )
where
-import qualified Data.ByteString.Lazy as B
-import qualified Data.ByteString.Char8 as BC
+import qualified Data.ByteString.Lazy as B ( ByteString )
+import qualified Data.ByteString.Char8 as BC ( pack )
import Network.HTTP.Client (
httpLbs,
newManager,
parseUrl,
- responseBody)
-import Network.HTTP.Client.TLS (
- tlsManagerSettings)
+ responseBody )
+import Network.HTTP.Client.TLS ( tlsManagerSettings )
import Web.Authenticate.OAuth (
OAuth(..),
Credential,
newCredential,
newOAuth,
- signOAuth)
+ signOAuth )
-import Configuration (Cfg(..))
+import Configuration ( Cfg(..) )
--- |The API URL of username's timeline.
+-- | The API URL of username's timeline.
--
-- See,
--
get_max_status_id,
pretty_print,
status_tests,
- utc_time_to_rfc822)
+ utc_time_to_rfc822 )
where
-import Control.Applicative ((<$>), (<*>))
-import Control.Monad (liftM)
-import Data.Aeson ((.:), FromJSON(..), Value(Object))
-import Data.Maybe (mapMaybe, isJust)
-import Data.Monoid (mempty)
-import Data.String.Utils (join, splitWs)
-import Data.Text (pack)
-import Data.Time (formatTime)
-import Data.Time.Clock (UTCTime)
-import Data.Time.Format (parseTime)
-import Data.Time.LocalTime (TimeZone, utcToZonedTime)
-import System.Locale (defaultTimeLocale, rfc822DateFormat)
-import Test.Framework (Test, testGroup)
-import Test.Framework.Providers.HUnit (testCase)
-import Test.HUnit (Assertion, assertEqual)
-import Text.Regex (matchRegex, mkRegex)
-
-import Html (replace_entities)
-import StringUtils (listify)
-import Twitter.User (User(..), screen_name_to_timeline_url)
+import Control.Applicative ( (<$>), (<*>) )
+import Control.Monad ( liftM )
+import Data.Aeson ( (.:), FromJSON(..), Value(Object) )
+import Data.Maybe ( mapMaybe, isJust )
+import Data.Monoid ( mempty )
+import Data.String.Utils ( join, splitWs )
+import Data.Text ( pack )
+import Data.Time ( formatTime )
+import Data.Time.Clock ( UTCTime )
+import Data.Time.Format ( parseTime )
+import Data.Time.LocalTime ( TimeZone, utcToZonedTime )
+import System.Locale ( defaultTimeLocale, rfc822DateFormat )
+import Test.Framework ( Test, testGroup )
+import Test.Framework.Providers.HUnit ( testCase )
+import Test.HUnit ( Assertion, assertEqual )
+import Text.Regex ( matchRegex, mkRegex )
+
+import Html ( replace_entities )
+import StringUtils ( listify )
+import Twitter.User ( User(..), screen_name_to_timeline_url )
data Status = Status {
created_at :: Maybe UTCTime,
-- | Functions and data for working with Twitter users.
module Twitter.User (
User(..),
- screen_name_to_timeline_url
- )
+ screen_name_to_timeline_url )
where
-import Control.Applicative ((<$>))
-import Data.Aeson ((.:), FromJSON(..), Value(Object))
-import Data.Text (pack)
-import Data.Monoid (mempty)
+import Control.Applicative ( (<$>) )
+import Data.Aeson ( (.:), FromJSON(..), Value(Object) )
+import Data.Text ( pack )
+import Data.Monoid ( mempty )
-- | Represents a Twitter user, and contains the only attribute
-- thereof that we care about: the screen (user) name.
-- to watch. This is all to avoid an orphan instance of Configured
-- for [String] if we had defined one in e.g. OptionalConfiguration.
--
-module Usernames
+module Usernames ( Usernames(..) )
where
-- DC is needed only for the DCT.Configured instance of String.
import qualified Data.Configurator as DC()
import qualified Data.Configurator.Types as DCT
-import Data.Data (Data)
-import System.Console.CmdArgs.Default (Default(..))
-import Data.Typeable (Typeable)
+import Data.Data ( Data )
+import System.Console.CmdArgs.Default ( Default(..) )
+import Data.Typeable ( Typeable )
newtype Usernames =