From: Michael Orlitzky Date: Sun, 15 Dec 2013 00:14:27 +0000 (-0500) Subject: Clean up imports. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=d7c6b5499c0969b6e488d9fc583f93bbb4e3d4c7;p=dead%2Fhalcyon.git Clean up imports. --- diff --git a/src/CommandLine.hs b/src/CommandLine.hs index 862f9cd..65054fe 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -1,6 +1,6 @@ module CommandLine ( get_args, - show_help) + show_help ) where import System.Console.CmdArgs ( @@ -15,14 +15,14 @@ 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 = diff --git a/src/Configuration.hs b/src/Configuration.hs index 095f539..7865865 100644 --- a/src/Configuration.hs +++ b/src/Configuration.hs @@ -6,12 +6,11 @@ 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, diff --git a/src/ExitCodes.hs b/src/ExitCodes.hs index 653b1c9..7597a54 100644 --- a/src/ExitCodes.hs +++ b/src/ExitCodes.hs @@ -1,17 +1,9 @@ --- |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 diff --git a/src/Html.hs b/src/Html.hs index 01004cf..f1671a8 100644 --- a/src/Html.hs +++ b/src/Html.hs @@ -1,13 +1,12 @@ 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 [] = [] diff --git a/src/Mail.hs b/src/Mail.hs index ecfa2af..3f519cc 100644 --- a/src/Mail.hs +++ b/src/Mail.hs @@ -5,19 +5,18 @@ module Mail ( 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 diff --git a/src/Main.hs b/src/Main.hs index 17442f4..b7d7f71 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,30 +1,35 @@ 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. diff --git a/src/OptionalConfiguration.hs b/src/OptionalConfiguration.hs index 0b5fd0a..607659e 100644 --- a/src/OptionalConfiguration.hs +++ b/src/OptionalConfiguration.hs @@ -11,18 +11,20 @@ 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 diff --git a/src/StringUtils.hs b/src/StringUtils.hs index 43e4264..210e230 100644 --- a/src/StringUtils.hs +++ b/src/StringUtils.hs @@ -1,13 +1,12 @@ -- | 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 diff --git a/src/Twitter/Http.hs b/src/Twitter/Http.hs index 14d1563..e3bb9fc 100644 --- a/src/Twitter/Http.hs +++ b/src/Twitter/Http.hs @@ -1,29 +1,27 @@ 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, -- diff --git a/src/Twitter/Status.hs b/src/Twitter/Status.hs index 92cf899..6238b68 100644 --- a/src/Twitter/Status.hs +++ b/src/Twitter/Status.hs @@ -7,29 +7,29 @@ module Twitter.Status ( 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, diff --git a/src/Twitter/User.hs b/src/Twitter/User.hs index 988cf3c..071b063 100644 --- a/src/Twitter/User.hs +++ b/src/Twitter/User.hs @@ -1,14 +1,13 @@ -- | 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. diff --git a/src/Usernames.hs b/src/Usernames.hs index 6f2fb28..92e5c43 100644 --- a/src/Usernames.hs +++ b/src/Usernames.hs @@ -4,15 +4,15 @@ -- 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 =