This is pretty close:
app :: ServerPart Response app = msum [ dir "hello" $ do method GET >> helloGet method POST >> helloPost , okResponse home ]
You just need an extra nested msum :
app :: ServerPart Response app = msum [ dir "hello" $ msum [ method GET >> helloGet , method POST >> helloPost ] , okResponse home ]
Like someone else, you can also use <|> or mplus or other functions related to Alternative and MonadPlus .
source share