diff options
Diffstat (limited to 'src/Hakyll')
26 files changed, 46 insertions, 78 deletions
diff --git a/src/Hakyll/Check.hs b/src/Hakyll/Check.hs index 8e808ba..8bfc2aa 100644 --- a/src/Hakyll/Check.hs +++ b/src/Hakyll/Check.hs @@ -8,42 +8,44 @@ module Hakyll.Check -------------------------------------------------------------------------------- -import Control.Applicative ((<$>)) -import Control.Monad (forM_) -import Control.Monad.Reader (ask) -import Control.Monad.RWS (RWST, runRWST) -import Control.Monad.Trans (liftIO) -import Control.Monad.Writer (tell) -import Data.List (isPrefixOf) -import Data.Monoid (Monoid (..)) -import Data.Set (Set) -import qualified Data.Set as S -import Network.URI (unEscapeString) -import System.Directory (doesDirectoryExist, doesFileExist) -import System.Exit (ExitCode (..)) -import System.FilePath (takeDirectory, takeExtension, (</>)) -import qualified Text.HTML.TagSoup as TS +import Control.Monad (forM_) +import Control.Monad.Reader (ask) +import Control.Monad.RWS (RWST, runRWST) +import Control.Monad.Trans (liftIO) +import Control.Monad.Trans.Resource (runResourceT) +import Control.Monad.Writer (tell) +import Data.List (isPrefixOf) +import Data.Set (Set) +import qualified Data.Set as S +import Network.URI (unEscapeString) +import System.Directory (doesDirectoryExist, + doesFileExist) +import System.Exit (ExitCode (..)) +import System.FilePath (takeDirectory, takeExtension, + (</>)) +import qualified Text.HTML.TagSoup as TS -------------------------------------------------------------------------------- #ifdef CHECK_EXTERNAL -import Control.Exception (AsyncException (..), - SomeException (..), handle, throw) -import Control.Monad.State (get, modify) -import Data.List (intercalate) -import Data.Typeable (cast) -import Data.Version (versionBranch) -import GHC.Exts (fromString) -import qualified Network.HTTP.Conduit as Http -import qualified Network.HTTP.Types as Http -import qualified Paths_hakyll as Paths_hakyll +import Control.Exception (AsyncException (..), + SomeException (..), handle, + throw) +import Control.Monad.State (get, modify) +import Data.List (intercalate) +import Data.Typeable (cast) +import Data.Version (versionBranch) +import GHC.Exts (fromString) +import qualified Network.HTTP.Conduit as Http +import qualified Network.HTTP.Types as Http +import qualified Paths_hakyll as Paths_hakyll #endif -------------------------------------------------------------------------------- import Hakyll.Core.Configuration -import Hakyll.Core.Logger (Logger) -import qualified Hakyll.Core.Logger as Logger +import Hakyll.Core.Logger (Logger) +import qualified Hakyll.Core.Logger as Logger import Hakyll.Core.Util.File import Hakyll.Web.Html @@ -196,8 +198,9 @@ checkExternalUrl url = do if not needsCheck || checked then Logger.debug logger "Already checked, skipping" else do - isOk <- liftIO $ handle (failure logger) $ - Http.withManager $ \mgr -> do + isOk <- liftIO $ handle (failure logger) $ do + mgr <- Http.newManager Http.tlsManagerSettings + runResourceT $ do request <- Http.parseUrl urlToCheck response <- Http.http (settings request) mgr let code = Http.statusCode (Http.responseStatus response) diff --git a/src/Hakyll/Commands.hs b/src/Hakyll/Commands.hs index 6f81080..5906247 100644 --- a/src/Hakyll/Commands.hs +++ b/src/Hakyll/Commands.hs @@ -14,11 +14,8 @@ module Hakyll.Commands -------------------------------------------------------------------------------- -import Control.Applicative import Control.Concurrent -import Control.Monad (void) import System.Exit (ExitCode, exitWith) -import System.IO.Error (catchIOError) -------------------------------------------------------------------------------- import qualified Hakyll.Check as Check diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index f99f93b..ae9fbf1 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -28,7 +28,6 @@ module Hakyll.Core.Compiler -------------------------------------------------------------------------------- -import Control.Applicative ((<$>)) import Control.Monad (when) import Data.Binary (Binary) import Data.ByteString.Lazy (ByteString) diff --git a/src/Hakyll/Core/Compiler/Internal.hs b/src/Hakyll/Core/Compiler/Internal.hs index 61fb640..7b1df83 100644 --- a/src/Hakyll/Core/Compiler/Internal.hs +++ b/src/Hakyll/Core/Compiler/Internal.hs @@ -28,12 +28,10 @@ module Hakyll.Core.Compiler.Internal -------------------------------------------------------------------------------- -import Control.Applicative (Alternative (..), - Applicative (..), (<$>)) +import Control.Applicative (Alternative (..)) import Control.Exception (SomeException, handle) import Control.Monad (forM_) -import Control.Monad.Error (MonadError (..)) -import Data.Monoid (Monoid (..)) +import Control.Monad.Except (MonadError (..)) import Data.Set (Set) import qualified Data.Set as S diff --git a/src/Hakyll/Core/Compiler/Require.hs b/src/Hakyll/Core/Compiler/Require.hs index d7635a9..c9373bf 100644 --- a/src/Hakyll/Core/Compiler/Require.hs +++ b/src/Hakyll/Core/Compiler/Require.hs @@ -13,7 +13,6 @@ module Hakyll.Core.Compiler.Require -------------------------------------------------------------------------------- -import Control.Applicative ((<$>)) import Control.Monad (when) import Data.Binary (Binary) import qualified Data.Set as S diff --git a/src/Hakyll/Core/Dependencies.hs b/src/Hakyll/Core/Dependencies.hs index ebb6fd0..4a51b9c 100644 --- a/src/Hakyll/Core/Dependencies.hs +++ b/src/Hakyll/Core/Dependencies.hs @@ -8,7 +8,6 @@ module Hakyll.Core.Dependencies -------------------------------------------------------------------------------- -import Control.Applicative ((<$>), (<*>)) import Control.Monad (foldM, forM_, unless, when) import Control.Monad.Reader (ask) import Control.Monad.RWS (RWS, runRWS) diff --git a/src/Hakyll/Core/File.hs b/src/Hakyll/Core/File.hs index 26724e1..1c3a9df 100644 --- a/src/Hakyll/Core/File.hs +++ b/src/Hakyll/Core/File.hs @@ -11,7 +11,6 @@ module Hakyll.Core.File -------------------------------------------------------------------------------- -import Control.Applicative ((<$>)) import Data.Binary (Binary (..)) import Data.Typeable (Typeable) import System.Directory (copyFile, doesFileExist, diff --git a/src/Hakyll/Core/Identifier.hs b/src/Hakyll/Core/Identifier.hs index 7ac06d8..777811c 100644 --- a/src/Hakyll/Core/Identifier.hs +++ b/src/Hakyll/Core/Identifier.hs @@ -19,7 +19,6 @@ module Hakyll.Core.Identifier -------------------------------------------------------------------------------- -import Control.Applicative ((<$>), (<*>)) import Control.DeepSeq (NFData (..)) import Data.List (intercalate) import System.FilePath (dropTrailingPathSeparator, splitPath) diff --git a/src/Hakyll/Core/Identifier/Pattern.hs b/src/Hakyll/Core/Identifier/Pattern.hs index 92d7705..47ad21b 100644 --- a/src/Hakyll/Core/Identifier/Pattern.hs +++ b/src/Hakyll/Core/Identifier/Pattern.hs @@ -57,13 +57,11 @@ module Hakyll.Core.Identifier.Pattern -------------------------------------------------------------------------------- -import Control.Applicative (pure, (<$>), (<*>)) import Control.Arrow ((&&&), (>>>)) import Control.Monad (msum) import Data.Binary (Binary (..), getWord8, putWord8) import Data.List (inits, isPrefixOf, tails) import Data.Maybe (isJust) -import Data.Monoid (Monoid, mappend, mempty) import Data.Set (Set) import qualified Data.Set as S diff --git a/src/Hakyll/Core/Item.hs b/src/Hakyll/Core/Item.hs index 840b6a8..e05df42 100644 --- a/src/Hakyll/Core/Item.hs +++ b/src/Hakyll/Core/Item.hs @@ -10,10 +10,8 @@ module Hakyll.Core.Item -------------------------------------------------------------------------------- -import Control.Applicative ((<$>), (<*>)) import Data.Binary (Binary (..)) import Data.Foldable (Foldable (..)) -import Data.Traversable (Traversable (..)) import Data.Typeable (Typeable) import Prelude hiding (foldr) diff --git a/src/Hakyll/Core/Logger.hs b/src/Hakyll/Core/Logger.hs index 4731c20..6f950a6 100644 --- a/src/Hakyll/Core/Logger.hs +++ b/src/Hakyll/Core/Logger.hs @@ -13,7 +13,6 @@ module Hakyll.Core.Logger -------------------------------------------------------------------------------- -import Control.Applicative (pure, (<$>), (<*>)) import Control.Concurrent (forkIO) import Control.Concurrent.Chan (Chan, newChan, readChan, writeChan) import Control.Concurrent.MVar (MVar, newEmptyMVar, putMVar, takeMVar) diff --git a/src/Hakyll/Core/Provider/Internal.hs b/src/Hakyll/Core/Provider/Internal.hs index 34400fd..c298653 100644 --- a/src/Hakyll/Core/Provider/Internal.hs +++ b/src/Hakyll/Core/Provider/Internal.hs @@ -20,7 +20,6 @@ module Hakyll.Core.Provider.Internal -------------------------------------------------------------------------------- -import Control.Applicative ((<$>), (<*>)) import Control.DeepSeq (NFData (..), deepseq) import Control.Monad (forM) import Data.Binary (Binary (..)) @@ -28,7 +27,6 @@ import qualified Data.ByteString.Lazy as BL import Data.Map (Map) import qualified Data.Map as M import Data.Maybe (fromMaybe) -import Data.Monoid (mempty) import Data.Set (Set) import qualified Data.Set as S import Data.Time (Day (..), UTCTime (..)) diff --git a/src/Hakyll/Core/Provider/Metadata.hs b/src/Hakyll/Core/Provider/Metadata.hs index ca1cc6c..0b0291c 100644 --- a/src/Hakyll/Core/Provider/Metadata.hs +++ b/src/Hakyll/Core/Provider/Metadata.hs @@ -11,13 +11,10 @@ module Hakyll.Core.Provider.Metadata -------------------------------------------------------------------------------- -import Control.Applicative import Control.Arrow (second) import Control.Exception (Exception, throwIO) import Control.Monad (guard) import qualified Data.ByteString.Char8 as BC -import qualified Data.HashMap.Strict as HMS -import Data.List (intercalate) import Data.List.Extended (breakWhen) import qualified Data.Map as M import Data.Maybe (fromMaybe) @@ -28,8 +25,6 @@ import qualified Data.Yaml as Yaml import Hakyll.Core.Identifier import Hakyll.Core.Metadata import Hakyll.Core.Provider.Internal -import Hakyll.Core.Util.Parser -import Hakyll.Core.Util.String import System.IO as IO diff --git a/src/Hakyll/Core/Rules.hs b/src/Hakyll/Core/Rules.hs index 14befde..41b9a73 100644 --- a/src/Hakyll/Core/Rules.hs +++ b/src/Hakyll/Core/Rules.hs @@ -33,13 +33,11 @@ module Hakyll.Core.Rules -------------------------------------------------------------------------------- -import Control.Applicative ((<$>)) import Control.Monad.Reader (ask, local) import Control.Monad.State (get, modify, put) import Control.Monad.Trans (liftIO) import Control.Monad.Writer (censor, tell) import Data.Maybe (fromMaybe) -import Data.Monoid (mempty) import qualified Data.Set as S diff --git a/src/Hakyll/Core/Rules/Internal.hs b/src/Hakyll/Core/Rules/Internal.hs index a7c2059..0641dcf 100644 --- a/src/Hakyll/Core/Rules/Internal.hs +++ b/src/Hakyll/Core/Rules/Internal.hs @@ -12,12 +12,10 @@ module Hakyll.Core.Rules.Internal -------------------------------------------------------------------------------- -import Control.Applicative (Applicative, (<$>)) import Control.Monad.Reader (ask) import Control.Monad.RWS (RWST, runRWST) import Control.Monad.Trans (liftIO) import qualified Data.Map as M -import Data.Monoid (Monoid, mappend, mempty) import Data.Set (Set) diff --git a/src/Hakyll/Core/Runtime.hs b/src/Hakyll/Core/Runtime.hs index bdcd66c..16a5d9e 100644 --- a/src/Hakyll/Core/Runtime.hs +++ b/src/Hakyll/Core/Runtime.hs @@ -6,7 +6,7 @@ module Hakyll.Core.Runtime -------------------------------------------------------------------------------- import Control.Monad (unless) -import Control.Monad.Error (ErrorT, runErrorT, throwError) +import Control.Monad.Except (ExceptT, runExceptT, throwError) import Control.Monad.Reader (ask) import Control.Monad.RWS (RWST, runRWST) import Control.Monad.State (get, modify) @@ -75,7 +75,7 @@ run config logger rules = do } -- Run the program and fetch the resulting state - result <- runErrorT $ runRWST build read' state + result <- runExceptT $ runRWST build read' state case result of Left e -> do Logger.error logger e @@ -115,7 +115,7 @@ data RuntimeState = RuntimeState -------------------------------------------------------------------------------- -type Runtime a = RWST RuntimeRead () RuntimeState (ErrorT String IO) a +type Runtime a = RWST RuntimeRead () RuntimeState (ExceptT String IO) a -------------------------------------------------------------------------------- diff --git a/src/Hakyll/Core/Store.hs b/src/Hakyll/Core/Store.hs index 5c3667d..fdbcf11 100644 --- a/src/Hakyll/Core/Store.hs +++ b/src/Hakyll/Core/Store.hs @@ -16,7 +16,6 @@ module Hakyll.Core.Store -------------------------------------------------------------------------------- -import Control.Applicative ((<$>)) import Control.Exception (IOException, handle) import qualified Crypto.Hash.MD5 as MD5 import Data.Binary (Binary, decode, encodeFile) diff --git a/src/Hakyll/Core/UnixFilter.hs b/src/Hakyll/Core/UnixFilter.hs index 0f88c77..734d8d8 100644 --- a/src/Hakyll/Core/UnixFilter.hs +++ b/src/Hakyll/Core/UnixFilter.hs @@ -16,7 +16,6 @@ import Control.Monad (forM_) import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as LB import Data.IORef (newIORef, readIORef, writeIORef) -import Data.Monoid (Monoid, mempty) import System.Exit (ExitCode (..)) import System.IO (Handle, hClose, hFlush, hGetContents, hPutStr, hSetEncoding, localeEncoding) diff --git a/src/Hakyll/Core/Util/File.hs b/src/Hakyll/Core/Util/File.hs index b20576f..9db6b11 100644 --- a/src/Hakyll/Core/Util/File.hs +++ b/src/Hakyll/Core/Util/File.hs @@ -8,7 +8,6 @@ module Hakyll.Core.Util.File -------------------------------------------------------------------------------- -import Control.Applicative ((<$>)) import Control.Monad (filterM, forM, when) import System.Directory (createDirectoryIfMissing, doesDirectoryExist, getDirectoryContents, diff --git a/src/Hakyll/Core/Util/Parser.hs b/src/Hakyll/Core/Util/Parser.hs index c5789ed..e958b76 100644 --- a/src/Hakyll/Core/Util/Parser.hs +++ b/src/Hakyll/Core/Util/Parser.hs @@ -7,7 +7,7 @@ module Hakyll.Core.Util.Parser -------------------------------------------------------------------------------- -import Control.Applicative ((<$>), (<*>), (<|>)) +import Control.Applicative ((<|>)) import Control.Monad (mzero) import qualified Text.Parsec as P import Text.Parsec.String (Parser) diff --git a/src/Hakyll/Web/CompressCss.hs b/src/Hakyll/Web/CompressCss.hs index f3290f3..0534b9f 100644 --- a/src/Hakyll/Web/CompressCss.hs +++ b/src/Hakyll/Web/CompressCss.hs @@ -8,7 +8,6 @@ module Hakyll.Web.CompressCss -------------------------------------------------------------------------------- -import Control.Applicative ((<$>)) import Data.Char (isSpace) import Data.List (isPrefixOf) diff --git a/src/Hakyll/Web/Feed.hs b/src/Hakyll/Web/Feed.hs index 1d18430..8598f8a 100644 --- a/src/Hakyll/Web/Feed.hs +++ b/src/Hakyll/Web/Feed.hs @@ -25,7 +25,6 @@ module Hakyll.Web.Feed -------------------------------------------------------------------------------- import Control.Monad ((<=<)) -import Data.Monoid (mconcat) -------------------------------------------------------------------------------- diff --git a/src/Hakyll/Web/Paginate.hs b/src/Hakyll/Web/Paginate.hs index cd35a2d..65b4525 100644 --- a/src/Hakyll/Web/Paginate.hs +++ b/src/Hakyll/Web/Paginate.hs @@ -13,7 +13,6 @@ module Hakyll.Web.Paginate -------------------------------------------------------------------------------- import Control.Monad (forM_) import qualified Data.Map as M -import Data.Monoid (mconcat) import qualified Data.Set as S diff --git a/src/Hakyll/Web/Pandoc.hs b/src/Hakyll/Web/Pandoc.hs index f6e9ff1..eec0a8a 100644 --- a/src/Hakyll/Web/Pandoc.hs +++ b/src/Hakyll/Web/Pandoc.hs @@ -22,9 +22,7 @@ module Hakyll.Web.Pandoc -------------------------------------------------------------------------------- -import Control.Applicative ((<$>)) import qualified Data.Set as S -import Data.Traversable (traverse) import Text.Pandoc import Text.Pandoc.Error (PandocError (..)) diff --git a/src/Hakyll/Web/Template.hs b/src/Hakyll/Web/Template.hs index 194949d..65c4ac9 100644 --- a/src/Hakyll/Web/Template.hs +++ b/src/Hakyll/Web/Template.hs @@ -54,7 +54,7 @@ -- The @for@ macro is used for enumerating 'Context' elements that are -- lists, i.e. constructed using the 'listField' function. Assume that -- in a context we have an element @listField \"key\" c itms@. Then --- the snippet +-- the snippet -- -- > $for(key)$ -- > $x$ @@ -70,21 +70,21 @@ -- -- > listField "things" (field "thing" (return . itemBody)) -- > (sequence [makeItem "fruits", makeItem "vegetables"]) --- +-- -- and a template -- -- > I like -- > $for(things)$ --- > fresh $thing$$sep$, and +-- > fresh $thing$$sep$, and -- > $endfor$ -- -- the resulting page would look like -- -- > <p> -- > I like --- > --- > fresh fruits, and --- > +-- > +-- > fresh fruits, and +-- > -- > fresh vegetables -- > </p> -- @@ -129,9 +129,8 @@ module Hakyll.Web.Template -------------------------------------------------------------------------------- import Control.Monad (liftM) -import Control.Monad.Error (MonadError (..)) +import Control.Monad.Except (MonadError (..)) import Data.List (intercalate) -import Data.Monoid (mappend) import Prelude hiding (id) diff --git a/src/Hakyll/Web/Template/Internal.hs b/src/Hakyll/Web/Template/Internal.hs index 2d9de5e..45db2e4 100644 --- a/src/Hakyll/Web/Template/Internal.hs +++ b/src/Hakyll/Web/Template/Internal.hs @@ -12,7 +12,7 @@ module Hakyll.Web.Template.Internal -------------------------------------------------------------------------------- -import Control.Applicative (pure, (<$), (<$>), (<*>), (<|>)) +import Control.Applicative ((<|>)) import Control.Monad (void) import Data.Binary (Binary, get, getWord8, put, putWord8) import Data.Typeable (Typeable) |