Skip to content

Commit b9eb9a9

Browse files
committed
Build with GHC 9.0.2
Could solve the problem found in #200
1 parent 9e43bd1 commit b9eb9a9

File tree

5 files changed

+26
-40
lines changed

5 files changed

+26
-40
lines changed

.circleci/config.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jobs:
33
build:
44
# Ref: https://mmhaskell.com/blog/2018/4/25/dockerizing-our-haskell-app
55
docker:
6-
- image: haskell:8.6.3
6+
- image: haskell:9.0.2-slim
77
steps:
88
- run: apt update
99
- run: apt install -y zip jq curl
@@ -18,8 +18,8 @@ jobs:
1818
- 'dependencies-'
1919
# 下記のパッケージはビルド時にメモリが不足するため、一旦 -j1 でビルドしておく
2020
# Ref: https://haskell.e-bigmoon.com/posts/2017/12-31-travis-out-of-memory.html
21-
- run: stack build --compiler=ghc-8.6.3 --no-terminal -j1 Cabal wai-logger
22-
- run: stack build --compiler=ghc-8.6.3 --no-terminal --only-dependencies
21+
#- run: stack build --compiler=ghc-9.0.2 --no-terminal -j1 Cabal wai-logger
22+
- run: stack build --compiler=ghc-9.0.2 --no-terminal --only-dependencies
2323
- save_cache:
2424
key: 'dependencies-{{ checksum "stack.yaml" }}-{{ checksum "haskell-jp-blog.cabal" }}'
2525
paths:
@@ -30,7 +30,7 @@ jobs:
3030
keys:
3131
- 'executable-{{ checksum "src/site.hs" }}'
3232
- 'executable-'
33-
- run: stack --compiler=ghc-8.6.3 --local-bin-path='.' --no-terminal install --pedantic
33+
- run: stack --compiler=ghc-9.0.2 --local-bin-path='.' --no-terminal install --pedantic
3434
- save_cache:
3535
key: 'executable-{{ checksum "src/site.hs" }}'
3636
paths:
@@ -58,7 +58,7 @@ jobs:
5858

5959
deploy:
6060
docker:
61-
- image: haskell:8.6.3
61+
- image: haskell:9.0.2-slim
6262
steps:
6363
- checkout:
6464
path: ~/project

haskell-jp-blog.cabal

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ executable site
1414
, hakyll
1515
, pandoc-types
1616
, skylighting
17+
, text
1718
, filepath
1819
ghc-options: -threaded -Wall
1920
default-language: Haskell2010

src/site.hs

+13-13
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Data.Data (Data)
1212
import Data.Default (def)
1313
import Data.List.NonEmpty (NonEmpty((:|)), groupBy, toList)
1414
import Data.Maybe (fromMaybe)
15-
import Data.Monoid ((<>))
15+
import qualified Data.Text as T
1616
import qualified Data.Tree as Tree
1717
import Data.Typeable (Typeable)
1818
import Hakyll
@@ -189,7 +189,7 @@ isDraftPost ident = do
189189
isDraft <- fromMaybe "false" <$> getMetadataField ident "draft"
190190
return $ isDraft == "true"
191191

192-
postItemIdentifiers :: MonadMetadata m => m [Identifier]
192+
postItemIdentifiers :: (MonadFail m, MonadMetadata m) => m [Identifier]
193193
postItemIdentifiers = do
194194
idents <- getMatches "posts/**"
195195
idents' <- filterM (fmap not . isDraftPost) idents
@@ -254,15 +254,15 @@ addSpaceAroundAsciiInlines = concatMap addSpaceInline
254254
-- 'textLangToInline'. Blocks of Latin text will be placed in @\<span\>@ tags
255255
-- with an @\"ascii\"@ class.
256256
addSpaceInline :: Inline -> [Inline]
257-
addSpaceInline (Str string) = textLangToInline <$> splitOnLanguage string
257+
addSpaceInline (Str string) = textLangToInline <$> splitOnLanguage (T.unpack string)
258258
addSpaceInline inline = [inline]
259259

260260
-- | This is a tag around a 'String' representing whether the 'String' is Latin
261261
-- ('English') or 'Japanese'. 'String's that are neither Latin or 'Japanese'
262262
-- are treated as 'Japanese'. See 'charLangToTextLang'.
263263
data TextLang
264-
= Japanese String
265-
| English String
264+
= Japanese T.Text
265+
| English T.Text
266266
deriving (Data, Eq, Read, Show, Typeable)
267267

268268
-- | This is a tag around a 'Char' representing whether the 'Char' is Latin or
@@ -384,11 +384,11 @@ groupByCharLang = groupBy f
384384
-- Japanese "\20132\30058"
385385
charLangToTextLang :: NonEmpty CharLang -> TextLang
386386
charLangToTextLang cs@(JapaneseChar{} :| _) =
387-
Japanese . toList $ charLangToChar <$> cs
387+
Japanese . T.pack . toList $ charLangToChar <$> cs
388388
charLangToTextLang cs@(EnglishChar{} :| _) =
389-
English . toList $ charLangToChar <$> cs
389+
English . T.pack . toList $ charLangToChar <$> cs
390390

391-
getFeedConfig :: MonadMetadata m => Identifier -> m FeedConfiguration
391+
getFeedConfig :: (MonadFail m, MonadMetadata m) => Identifier -> m FeedConfiguration
392392
getFeedConfig ident = do
393393
feedTitle <- getMetadataField' ident "title"
394394
feedDescription <- getMetadataField' ident "description"
@@ -407,15 +407,15 @@ data PostSection = PostSection
407407
} deriving Show
408408

409409
-- | Extract element ID from `Attr`.
410-
attrId :: Attr -> String
410+
attrId :: Attr -> T.Text
411411
attrId (x, _, _) = x
412412

413413
-- | Construct `Attr` with ID.
414-
idAttr :: String -> Attr
414+
idAttr :: T.Text -> Attr
415415
idAttr s = (s, [], [])
416416

417417
-- | Construct `Attr` with one class.
418-
classAttr :: String -> Attr
418+
classAttr :: T.Text -> Attr
419419
classAttr s = ("", [s], [])
420420

421421
-- | Eliminate all links from `Block`s or `Inline`s.
@@ -469,7 +469,7 @@ makeTOCList xs0@(x0 : _) = PB.bulletList $ Tree.foldTree fld <$> unfoldTree_DF u
469469

470470
listItem :: PostSection -> PB.Blocks
471471
listItem PostSection{..} =
472-
PB.plain $ PB.link ("#" ++ attrId psHeaderAttr)
472+
PB.plain $ PB.link ("#" <> attrId psHeaderAttr)
473473
(attrId psHeaderAttr)
474474
(PB.fromList $ elimLink psHeaderInline)
475475

@@ -482,7 +482,7 @@ makeSectionBlock PostSection{..} = hd <> PB.fromList psContent
482482
<> PB.fromList psHeaderInline
483483

484484
anchor = PB.spanWith (classAttr "link-to-here-outer") $
485-
PB.link ("#" ++ attrId psHeaderAttr)
485+
PB.link ("#" <> attrId psHeaderAttr)
486486
(attrId psHeaderAttr) $
487487
PB.spanWith (classAttr "link-to-here") $
488488
PB.str "Link to" <> PB.linebreak <> PB.str "here"

stack.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ flags: {}
22
packages:
33
- '.'
44
extra-deps:
5-
- hakyll-4.12.5.1
6-
- lrucache-1.2.0.1
7-
resolver: lts-13.11
5+
[]
6+
resolver: lts-19.22

stack.yaml.lock

+5-19
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,10 @@
33
# For more information, please see the documentation at:
44
# https://docs.haskellstack.org/en/stable/lock_files
55

6-
packages:
7-
- completed:
8-
hackage: hakyll-4.12.5.1@sha256:d1948b265e6628bcb6875571212f9acefe23179c73ca4f87f417b290ff381ca6,8677
9-
pantry-tree:
10-
size: 7631
11-
sha256: ac35d6b2a3b6d87517ff5184430a283c378330ec5da6f7dce26416568bf134ee
12-
original:
13-
hackage: hakyll-4.12.5.1
14-
- completed:
15-
hackage: lrucache-1.2.0.1@sha256:18fc3d7052012c7ab3cd395160f34b53c5e1ec5379cc45185baf35b90ffadc2e,1254
16-
pantry-tree:
17-
size: 619
18-
sha256: 61b2a39a11873f2d8a577e1f6b5e848d2f465ea7f6837ce15436796d3a20eda0
19-
original:
20-
hackage: lrucache-1.2.0.1
6+
packages: []
217
snapshots:
228
- completed:
23-
size: 495801
24-
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/13/11.yaml
25-
sha256: 835062158db2b3ebb8b9525d9662a02ebf9783e8f6a08a64684cd5546f847152
26-
original: lts-13.11
9+
size: 619399
10+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/22.yaml
11+
sha256: 5098594e71bdefe0c13e9e6236f12e3414ef91a2b89b029fd30e8fc8087f3a07
12+
original: lts-19.22

0 commit comments

Comments
 (0)