summaryrefslogtreecommitdiff
path: root/lib/Hakyll/Core
diff options
context:
space:
mode:
authorVeronika Romashkina <vrom911@gmail.com>2020-02-26 10:49:03 +0000
committerGitHub <noreply@github.com>2020-02-26 11:49:03 +0100
commitd2ee5b2b0eb2afb970ab8d4feed84434dc8236e0 (patch)
tree56a3be8e658dfc134259c61314cca00964f692d8 /lib/Hakyll/Core
parent7b924e7d6b98db7de64fa8fc5cae14a3ea35965c (diff)
downloadhakyll-d2ee5b2b0eb2afb970ab8d4feed84434dc8236e0.tar.gz
Support GHC-8.8
Add MonadFail instances and constraints.
Diffstat (limited to 'lib/Hakyll/Core')
-rw-r--r--lib/Hakyll/Core/Compiler/Internal.hs8
-rw-r--r--lib/Hakyll/Core/Metadata.hs2
-rw-r--r--lib/Hakyll/Core/Rules/Internal.hs2
3 files changed, 9 insertions, 3 deletions
diff --git a/lib/Hakyll/Core/Compiler/Internal.hs b/lib/Hakyll/Core/Compiler/Internal.hs
index 762630c..3b62e2d 100644
--- a/lib/Hakyll/Core/Compiler/Internal.hs
+++ b/lib/Hakyll/Core/Compiler/Internal.hs
@@ -40,6 +40,7 @@ module Hakyll.Core.Compiler.Internal
import Control.Applicative (Alternative (..))
import Control.Exception (SomeException, handle)
import Control.Monad (forM_)
+import qualified Control.Monad.Fail as Fail
import Control.Monad.Except (MonadError (..))
import Data.List.NonEmpty (NonEmpty (..))
import qualified Data.List.NonEmpty as NonEmpty
@@ -183,9 +184,14 @@ instance Monad Compiler where
CompilerError e -> return $ CompilerError e
{-# INLINE (>>=) #-}
- fail = compilerThrow . return
+#if !(MIN_VERSION_base(4,13,0))
+ fail = Fail.fail
{-# INLINE fail #-}
+#endif
+instance Fail.MonadFail Compiler where
+ fail = compilerThrow . return
+ {-# INLINE fail #-}
--------------------------------------------------------------------------------
instance Applicative Compiler where
diff --git a/lib/Hakyll/Core/Metadata.hs b/lib/Hakyll/Core/Metadata.hs
index 1cf536e..9d99857 100644
--- a/lib/Hakyll/Core/Metadata.hs
+++ b/lib/Hakyll/Core/Metadata.hs
@@ -66,7 +66,7 @@ getMetadataField identifier key = do
--------------------------------------------------------------------------------
-- | Version of 'getMetadataField' which throws an error if the field does not
-- exist.
-getMetadataField' :: MonadMetadata m => Identifier -> String -> m String
+getMetadataField' :: (MonadFail m, MonadMetadata m) => Identifier -> String -> m String
getMetadataField' identifier key = do
field <- getMetadataField identifier key
case field of
diff --git a/lib/Hakyll/Core/Rules/Internal.hs b/lib/Hakyll/Core/Rules/Internal.hs
index 647af74..2617798 100644
--- a/lib/Hakyll/Core/Rules/Internal.hs
+++ b/lib/Hakyll/Core/Rules/Internal.hs
@@ -88,7 +88,7 @@ emptyRulesState = RulesState Nothing Nothing
-- | The monad used to compose rules
newtype Rules a = Rules
{ unRules :: RWST RulesRead RuleSet RulesState IO a
- } deriving (Monad, Functor, Applicative)
+ } deriving (Monad, MonadFail, Functor, Applicative)
--------------------------------------------------------------------------------