type Author = String
newtype PostId = PostId { getPostId :: Integer }
deriving (PathPiece)
renderPostPage :: String -> Postid -> ActionT IO ()
get "/:author/blog/:postid" $ do
mauthor <- param "author"
mpostid <- param "postid"
case (,) <$> mauthor <*> mpostid of
Just (author, postid) -> renderPostPage author postid
Nothing -> renderErrorPage "this should not happen"