~jack/jackkelly-name

d582cf265683ac2f3682c5bc0a6e351af286a3f1 — Jack Kelly 1 year, 7 days ago 8de6f15
Use newer monoidal-containers
2 files changed, 5 insertions(+), 11 deletions(-)

M jackkelly-name.cabal
M src/Blog/Archives.hs
M jackkelly-name.cabal => jackkelly-name.cabal +1 -1
@@ 43,7 43,7 @@ library
                    , formatting >= 6.3.6 && < 6.4
                    , hakyll >= 4.12.3 && < 4.13
                    , lens >= 4.16.1 && < 4.18
                    , monoidal-containers >= 0.3.1 && < 0.5
                    , monoidal-containers >= 0.4 && < 0.5
                    , pandoc >= 2.2.1 && < 2.8
                    , text >= 1.2.3 && < 1.3
                    , time >= 1.8.0 && < 1.9

M src/Blog/Archives.hs => src/Blog/Archives.hs +4 -10
@@ 10,7 10,6 @@ import           Data.Foldable (for_)
import           Data.Functor ((<&>))
import           Data.HashMap.Lazy ((!))
import           Data.List (sortBy)
import qualified Data.Map as M
import           Data.Map.Monoidal (MonoidalMap)
import qualified Data.Map.Monoidal as MM
import           Data.Ord (comparing)


@@ 74,7 73,7 @@ archiveIndex postsByDay tags = create ["blog/archives/index.html"] $ do
        , y == year
        ]

      postsByMonth = foldMap collectMonthYear $ toAscList postsByDay
      postsByMonth = foldMap collectMonthYear $ MM.toAscList postsByDay

      yearContext :: Context (Integer, Url)
      yearContext = mconcat


@@ 101,7 100,7 @@ archiveIndex postsByDay tags = create ["blog/archives/index.html"] $ do

yearArchives :: PostsByDay -> Tags -> Rules ()
yearArchives postsByDay tags =
  for_ (toAscList postsByYear) $ \(year, posts) ->
  for_ (MM.toAscList postsByYear) $ \(year, posts) ->
    create [fromFilePath $ yearArchiveUrl year] $ do
      route idRoute
      compile $ do


@@ 153,7 152,7 @@ monthArchives postsByDay tags = do
          >>= relativizeUrls

  where
    postsByMonth = foldMap collectMonthYear $ toAscList postsByDay
    postsByMonth = foldMap collectMonthYear $ MM.toAscList postsByDay

monthName :: Int -> String
monthName month = fst $ months defaultTimeLocale !! (month - 1)


@@ 172,9 171,4 @@ collectMonthYear (year, postsForYear) =
  let collectMonth :: (Int, MonoidalMap Int [Post]) -> (Integer, Int, [Post])
      collectMonth (month, postsForMonth) =
        (year, month, mconcat $ MM.elems postsForMonth)
  in collectMonth <$> toAscList postsForYear

-- Not present in monoidal-containers-0.3.1.0, which is what
-- nixos-18.09 provides.
toAscList :: MonoidalMap k a -> [(k, a)]
toAscList = M.toAscList . MM.getMonoidalMap
  in collectMonth <$> MM.toAscList postsForYear