forM -> traverse
This commit is contained in:
parent
667477e01d
commit
35e55b0e43
1 changed files with 3 additions and 2 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue