getPages :: FilePath -> Action (Set Page)
getPages pageDir = do
  pageDirs <- fmap (pageDir </>) <$> getDirectoryDirs pageDir
  pageList <- traverse getSinglePage pageDirs
  foldM add mempty pageList
  where
    add :: Set Page -> Page -> Action (Set Page)
    add acc page = do
      when (Set.member page acc)
        $ panic ("Multiple pages with id " <> _metaId (_pageMeta page))
      pure (Set.insert page acc)
getPages :: FilePath -> Action (Set Page)
getPages pageDir = do
  pageDirs <- fmap (pageDir </>) <$> getDirectoryDirs pageDir
  pageList <- traverse getSinglePage pageDirs
  foldM add mempty pageList
  where
    add :: Set Page -> Page -> Action (Set Page)
    add acc page = do
      when (Set.member page acc)
        $ panic ("Multiple pages with id " <> _metaId (_pageMeta page))
      pure (Set.insert page acc)
getPages pageDir = do
  pageDirs <- fmap (pageDir </>) <$> getDirectoryDirs pageDir
  pageList <- traverse getSinglePage pageDirs
  foldM add mempty pageList
  where
    add :: Set Page -> Page -> Action (Set Page)
    add acc page = do
      when (Set.member page acc)
        $ panic ("Multiple pages with id " <> _metaId (_pageMeta page))
      pure (Set.insert page acc)