Skip to content

stack resolver のバージョンを lts-16.25 にします #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -58,7 +59,7 @@ jobs:

deploy:
docker:
- image: haskell:8.6.3
- image: haskell:8.8.4
steps:
- checkout:
path: ~/project
Expand Down
1 change: 1 addition & 0 deletions haskell-jp-blog.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ executable site
, pandoc-types
, skylighting
, filepath
, text
ghc-options: -threaded -Wall
default-language: Haskell2010

Expand Down
26 changes: 13 additions & 13 deletions src/site.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -184,12 +185,12 @@ createSubHeadingContentForPost item = do
tagsHtml = maybe "" (\tags -> "<span class=\"meta\">Tags: " ++ tags ++ "</span>") 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
Expand Down Expand Up @@ -254,7 +255,7 @@ addSpaceAroundAsciiInlines = concatMap addSpaceInline
-- 'textLangToInline'. Blocks of Latin text will be placed in @\<span\>@ 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
Expand Down Expand Up @@ -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'.
--
Expand Down Expand Up @@ -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"
Expand All @@ -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.
Expand Down Expand Up @@ -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)

Expand All @@ -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"
Expand All @@ -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

6 changes: 2 additions & 4 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -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
24 changes: 5 additions & 19 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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