forM -> traverse

This commit is contained in:
Pagwin 2025-12-11 15:52:46 -05:00
parent 667477e01d
commit 35e55b0e43
No known key found for this signature in database
GPG key ID: 81137023740CA260

View file

@ -8,11 +8,12 @@
module Psb.Main where module Psb.Main where
import Config import Config
import Control.Monad (forM, when) import Control.Monad (when)
import qualified Data.HashMap.Strict as HM import qualified Data.HashMap.Strict as HM
import Data.List (sortOn) import Data.List (sortOn)
import qualified Data.Ord as Ord import qualified Data.Ord as Ord
import qualified Data.Text as T import qualified Data.Text as T
import Data.Traversable (traverse)
import Deriving.Aeson import Deriving.Aeson
import Deriving.Aeson.Stock (Vanilla) import Deriving.Aeson.Stock (Vanilla)
import Development.Shake (Action, Rules, (%>), (|%>), (~>)) import Development.Shake (Action, Rules, (%>), (|%>), (~>))
@ -121,7 +122,7 @@ home =
postPaths <- getPublishedPosts isDraft postPaths <- getPublishedPosts isDraft
posts <- posts <-
sortOn (Ord.Down . postDate) sortOn (Ord.Down . postDate)
<$> forM postPaths readPost <$> traverse readPost postPaths
let posts' = map fromPost posts let posts' = map fromPost posts
html <- applyTemplate "home.html" $ HM.singleton "posts" posts' html <- applyTemplate "home.html" $ HM.singleton "posts" posts'
time <- Utilities.Action.now time <- Utilities.Action.now