From d2ee5b2b0eb2afb970ab8d4feed84434dc8236e0 Mon Sep 17 00:00:00 2001 From: Veronika Romashkina Date: Wed, 26 Feb 2020 10:49:03 +0000 Subject: Support GHC-8.8 Add MonadFail instances and constraints. --- lib/Hakyll/Web/Template/Context.hs | 2 +- lib/Hakyll/Web/Template/List.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/Hakyll/Web') diff --git a/lib/Hakyll/Web/Template/Context.hs b/lib/Hakyll/Web/Template/Context.hs index 8627d5b..a5049c2 100644 --- a/lib/Hakyll/Web/Template/Context.hs +++ b/lib/Hakyll/Web/Template/Context.hs @@ -365,7 +365,7 @@ dateFieldWith locale key format = field key $ \i -> do -- | Parser to try to extract and parse the time from the @published@ -- field or from the filename. See 'dateField' for more information. -- Exported for user convenience. -getItemUTC :: MonadMetadata m +getItemUTC :: (MonadMetadata m, MonadFail m) => TimeLocale -- ^ Output time locale -> Identifier -- ^ Input page -> m UTCTime -- ^ Parsed UTCTime diff --git a/lib/Hakyll/Web/Template/List.hs b/lib/Hakyll/Web/Template/List.hs index 4d769fc..db3fff1 100644 --- a/lib/Hakyll/Web/Template/List.hs +++ b/lib/Hakyll/Web/Template/List.hs @@ -60,7 +60,7 @@ applyJoinTemplateList delimiter tpl context items = do -------------------------------------------------------------------------------- -- | Sort pages chronologically. Uses the same method as 'dateField' for -- extracting the date. -chronological :: MonadMetadata m => [Item a] -> m [Item a] +chronological :: (MonadMetadata m, MonadFail m) => [Item a] -> m [Item a] chronological = sortByM $ getItemUTC defaultTimeLocale . itemIdentifier where @@ -71,14 +71,14 @@ chronological = -------------------------------------------------------------------------------- -- | The reverse of 'chronological' -recentFirst :: MonadMetadata m => [Item a] -> m [Item a] +recentFirst :: (MonadMetadata m, MonadFail m) => [Item a] -> m [Item a] recentFirst = liftM reverse . chronological -------------------------------------------------------------------------------- -- | Version of 'chronological' which doesn't need the actual items. sortChronological - :: MonadMetadata m => [Identifier] -> m [Identifier] + :: (MonadMetadata m, MonadFail m) => [Identifier] -> m [Identifier] sortChronological ids = liftM (map itemIdentifier) $ chronological [Item i () | i <- ids] @@ -86,6 +86,6 @@ sortChronological ids = -------------------------------------------------------------------------------- -- | Version of 'recentFirst' which doesn't need the actual items. sortRecentFirst - :: MonadMetadata m => [Identifier] -> m [Identifier] + :: (MonadMetadata m, MonadFail m) => [Identifier] -> m [Identifier] sortRecentFirst ids = liftM (map itemIdentifier) $ recentFirst [Item i () | i <- ids] -- cgit v1.2.3