我試圖用Happstack實現一個簡單的請求處理程序:結合GET和POST部分在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
]
只有將 「落空」 爲默認的一部分。
好極了!謝謝。 – yesthisisuser