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

View file

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