diff --git a/.circleci/config.yml b/.circleci/config.yml
index 6ff228bc..a1da7d6a 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -3,7 +3,7 @@ jobs:
build:
# Ref: https://mmhaskell.com/blog/2018/4/25/dockerizing-our-haskell-app
docker:
- - image: haskell:8.6.3
+ - image: haskell:8.8.4
steps:
- run: apt update
- run: apt install -y zip jq curl
@@ -18,8 +18,9 @@ jobs:
- 'dependencies-'
# 下記のパッケージはビルド時にメモリが不足するため、一旦 -j1 でビルドしておく
# Ref: https://haskell.e-bigmoon.com/posts/2017/12-31-travis-out-of-memory.html
- - run: stack build --compiler=ghc-8.6.3 --no-terminal -j1 Cabal wai-logger
- - run: stack build --compiler=ghc-8.6.3 --no-terminal --only-dependencies
+ - run: stack build --compiler=ghc-8.8.4 --no-terminal -j1 Cabal wai-logger
+ - run: stack build --compiler=ghc-8.8.4 --no-terminal -j1 pandoc
+ - run: stack build --compiler=ghc-8.8.4 --no-terminal --only-dependencies
- save_cache:
key: 'dependencies-{{ checksum "stack.yaml" }}-{{ checksum "haskell-jp-blog.cabal" }}'
paths:
@@ -30,7 +31,7 @@ jobs:
keys:
- 'executable-{{ checksum "src/site.hs" }}'
- 'executable-'
- - run: stack --compiler=ghc-8.6.3 --local-bin-path='.' --no-terminal install --pedantic
+ - run: stack --compiler=ghc-8.8.4 --local-bin-path='.' --no-terminal install --pedantic
- save_cache:
key: 'executable-{{ checksum "src/site.hs" }}'
paths:
@@ -58,7 +59,7 @@ jobs:
deploy:
docker:
- - image: haskell:8.6.3
+ - image: haskell:8.8.4
steps:
- checkout:
path: ~/project
diff --git a/haskell-jp-blog.cabal b/haskell-jp-blog.cabal
index c6ceb682..e681d91c 100644
--- a/haskell-jp-blog.cabal
+++ b/haskell-jp-blog.cabal
@@ -15,6 +15,7 @@ executable site
, pandoc-types
, skylighting
, filepath
+ , text
ghc-options: -threaded -Wall
default-language: Haskell2010
diff --git a/src/site.hs b/src/site.hs
index 8896cf26..97a029f7 100644
--- a/src/site.hs
+++ b/src/site.hs
@@ -12,7 +12,8 @@ import Data.Data (Data)
import Data.Default (def)
import Data.List.NonEmpty (NonEmpty((:|)), groupBy, toList)
import Data.Maybe (fromMaybe)
-import Data.Monoid ((<>))
+import Data.Text (Text)
+import qualified Data.Text as Text
import qualified Data.Tree as Tree
import Data.Typeable (Typeable)
import Hakyll
@@ -184,12 +185,12 @@ createSubHeadingContentForPost item = do
tagsHtml = maybe "" (\tags -> "Tags: " ++ tags ++ "") mtags
return $ subHeadingHtml ++ postedByHtml ++ tagsHtml
-isDraftPost :: MonadMetadata m => Identifier -> m Bool
+isDraftPost :: (MonadMetadata m, MonadFail m) => Identifier -> m Bool
isDraftPost ident = do
isDraft <- fromMaybe "false" <$> getMetadataField ident "draft"
return $ isDraft == "true"
-postItemIdentifiers :: MonadMetadata m => m [Identifier]
+postItemIdentifiers :: (MonadMetadata m, MonadFail m) => m [Identifier]
postItemIdentifiers = do
idents <- getMatches "posts/**"
idents' <- filterM (fmap not . isDraftPost) idents
@@ -254,7 +255,7 @@ addSpaceAroundAsciiInlines = concatMap addSpaceInline
-- 'textLangToInline'. Blocks of Latin text will be placed in @\@ tags
-- with an @\"ascii\"@ class.
addSpaceInline :: Inline -> [Inline]
-addSpaceInline (Str string) = textLangToInline <$> splitOnLanguage string
+addSpaceInline (Str text) = textLangToInline <$> splitOnLanguage (Text.unpack text)
addSpaceInline inline = [inline]
-- | This is a tag around a 'String' representing whether the 'String' is Latin
@@ -287,8 +288,8 @@ data CharLang
-- >>> textLangToInline $ English "foobar"
-- Span ("",["ascii"],[]) [Str "foobar"]
textLangToInline :: TextLang -> Inline
-textLangToInline (Japanese string) = Str string
-textLangToInline (English string) = Span ("", ["ascii"], []) [Str string]
+textLangToInline (Japanese string) = Str (Text.pack string)
+textLangToInline (English string) = Span ("", ["ascii"], []) [Str (Text.pack string)]
-- | Split a 'String' into groups of 'TextLang'.
--
@@ -388,7 +389,7 @@ charLangToTextLang cs@(JapaneseChar{} :| _) =
charLangToTextLang cs@(EnglishChar{} :| _) =
English . toList $ charLangToChar <$> cs
-getFeedConfig :: MonadMetadata m => Identifier -> m FeedConfiguration
+getFeedConfig :: (MonadMetadata m, MonadFail m) => Identifier -> m FeedConfiguration
getFeedConfig ident = do
feedTitle <- getMetadataField' ident "title"
feedDescription <- getMetadataField' ident "description"
@@ -407,15 +408,15 @@ data PostSection = PostSection
} deriving Show
-- | Extract element ID from `Attr`.
-attrId :: Attr -> String
+attrId :: Attr -> Text
attrId (x, _, _) = x
-- | Construct `Attr` with ID.
-idAttr :: String -> Attr
+idAttr :: Text -> Attr
idAttr s = (s, [], [])
-- | Construct `Attr` with one class.
-classAttr :: String -> Attr
+classAttr :: Text -> Attr
classAttr s = ("", [s], [])
-- | Eliminate all links from `Block`s or `Inline`s.
@@ -469,7 +470,7 @@ makeTOCList xs0@(x0 : _) = PB.bulletList $ Tree.foldTree fld <$> unfoldTree_DF u
listItem :: PostSection -> PB.Blocks
listItem PostSection{..} =
- PB.plain $ PB.link ("#" ++ attrId psHeaderAttr)
+ PB.plain $ PB.link ("#" <> attrId psHeaderAttr)
(attrId psHeaderAttr)
(PB.fromList $ elimLink psHeaderInline)
@@ -482,7 +483,7 @@ makeSectionBlock PostSection{..} = hd <> PB.fromList psContent
<> PB.fromList psHeaderInline
anchor = PB.spanWith (classAttr "link-to-here-outer") $
- PB.link ("#" ++ attrId psHeaderAttr)
+ PB.link ("#" <> attrId psHeaderAttr)
(attrId psHeaderAttr) $
PB.spanWith (classAttr "link-to-here") $
PB.str "Link to" <> PB.linebreak <> PB.str "here"
@@ -505,4 +506,3 @@ postMakeTOC (Pandoc meta blk0) = Pandoc meta (PB.toList processed)
PB.divWith (classAttr "table-of-contents-title")
(PB.plain $ PB.str "Contents")
<> tocList
-
diff --git a/stack.yaml b/stack.yaml
index aa20e6da..e57795a8 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,7 +1,5 @@
flags: {}
packages:
- '.'
-extra-deps:
-- hakyll-4.12.5.1
-- lrucache-1.2.0.1
-resolver: lts-13.11
+extra-deps: []
+resolver: lts-16.25
diff --git a/stack.yaml.lock b/stack.yaml.lock
index a6567e8f..31befa1d 100644
--- a/stack.yaml.lock
+++ b/stack.yaml.lock
@@ -3,24 +3,10 @@
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
-packages:
-- completed:
- hackage: hakyll-4.12.5.1@sha256:d1948b265e6628bcb6875571212f9acefe23179c73ca4f87f417b290ff381ca6,8677
- pantry-tree:
- size: 7631
- sha256: ac35d6b2a3b6d87517ff5184430a283c378330ec5da6f7dce26416568bf134ee
- original:
- hackage: hakyll-4.12.5.1
-- completed:
- hackage: lrucache-1.2.0.1@sha256:18fc3d7052012c7ab3cd395160f34b53c5e1ec5379cc45185baf35b90ffadc2e,1254
- pantry-tree:
- size: 619
- sha256: 61b2a39a11873f2d8a577e1f6b5e848d2f465ea7f6837ce15436796d3a20eda0
- original:
- hackage: lrucache-1.2.0.1
+packages: []
snapshots:
- completed:
- size: 495801
- url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/13/11.yaml
- sha256: 835062158db2b3ebb8b9525d9662a02ebf9783e8f6a08a64684cd5546f847152
- original: lts-13.11
+ size: 533252
+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/25.yaml
+ sha256: 147598b98bdd95ec0409bac125a4f1bff3cd4f8d73334d283d098f66a4bcc053
+ original: lts-16.25