我正在尝试使用 Happstack 实现一个简单的请求处理程序:
main :: IO ()
main = simpleHTTP nullConf app
app :: ServerPart Response
app = msum [
dir "hello" $ method GET >> helloGet
, dir "hello" $ method POST >> helloPost
]
如何在不重复的情况下实现类似的目标dir "hello"
?
这个,
app :: ServerPart Response
app = msum [
dir "hello" $ do
method GET >> helloGet
method POST >> helloPost
, okResponse home
]
只会“落入”默认部分。