Suave.io: using pathScan and query together

I just get up and work with Suave.io. I am sure this will become clearer as I dig into Applicatives more, but from a high level I don’t see how to write a pathScan rule that applies the request application. All the examples I found only do one or the other. In both cases, they apply to a function that takes arguments, so the arguments are supposed to be combined as well.

+6
source share
1 answer

Both pathScan and request take a function that creates the web part, so they cannot be nicely chained using >>= . Instead, you can nest one inside the other (I think the order doesn't matter here):

 pathScan "/some/%d" (fun num -> request (fun r -> OK(sprintf "%d - %A" num r.url))) 
+10
source

All Articles