Compatibility with old containers lib

This commit is contained in:
Tissevert 2019-02-18 15:16:34 +01:00
parent 339a1e0d20
commit 11a1ab0f7b
2 changed files with 7 additions and 6 deletions

View file

@ -1,4 +1,4 @@
cabal-version: 2.4 cabal-version: >= 1.10
-- Initial package description 'hablo.cabal' generated by 'cabal init'. -- Initial package description 'hablo.cabal' generated by 'cabal init'.
-- For further documentation, see http://haskell.org/cabal/users-guide/ -- For further documentation, see http://haskell.org/cabal/users-guide/
@ -8,7 +8,7 @@ synopsis: A minimalist static blog generator
-- description: -- description:
homepage: https://git.marvid.fr/Tissevert/hablo homepage: https://git.marvid.fr/Tissevert/hablo
-- bug-reports: -- bug-reports:
license: BSD-3-Clause license: BSD3
license-file: LICENSE license-file: LICENSE
author: Tissevert author: Tissevert
maintainer: tissevert+devel@marvid.fr maintainer: tissevert+devel@marvid.fr
@ -38,7 +38,7 @@ executable hablo
, Pretty , Pretty
-- other-extensions: -- other-extensions:
build-depends: aeson build-depends: aeson
, base ^>=4.12.0.0 , base <4.12.0.0
, bytestring , bytestring
, containers , containers
, directory , directory
@ -51,6 +51,6 @@ executable hablo
, text , text
, time , time
, unix , unix
ghc-options: -Wall ghc-options: -Wall -dynamic
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010

View file

@ -22,11 +22,12 @@ import qualified Blog.Wording as Wording (build)
import Control.Monad ((>=>), filterM, forM) import Control.Monad ((>=>), filterM, forM)
import Control.Monad.Reader (MonadReader, ask) import Control.Monad.Reader (MonadReader, ask)
import Data.Either (rights) import Data.Either (rights)
import Data.Map (Map, (!?)) import Data.Map (Map, lookup)
import qualified Data.Map as Map (fromList) import qualified Data.Map as Map (fromList)
import Data.Set (Set) import Data.Set (Set)
import qualified Data.Set as Set (empty, null, singleton, union) import qualified Data.Set as Set (empty, null, singleton, union)
import qualified Files (find) import qualified Files (find)
import Prelude hiding (lookup)
import System.Directory (doesFileExist, withCurrentDirectory) import System.Directory (doesFileExist, withCurrentDirectory)
import System.FilePath ((</>), dropTrailingPathSeparator, takeExtension, takeFileName) import System.FilePath ((</>), dropTrailingPathSeparator, takeExtension, takeFileName)
@ -62,7 +63,7 @@ tagged collection path = do
fileExists <- doesFileExist link fileExists <- doesFileExist link
return $ if fileExists return $ if fileExists
then let articleKey = Article.getKey link in then let articleKey = Article.getKey link in
maybe Set.empty (\_ -> Set.singleton articleKey) (collection !? articleKey) maybe Set.empty (\_ -> Set.singleton articleKey) (lookup articleKey collection)
else Set.empty else Set.empty
return (takeFileName path, foldl Set.union Set.empty keys) return (takeFileName path, foldl Set.union Set.empty keys)