Please play code golf with my code

I’m new to F#. I wrote this function, but I suspect there’s a way to use some of F#'s operators to make it terser. What do you suggest?

let incrementHandler: HttpHandler =
    getAndStoreAntiforgeryTokens (fun tokens ->
        bindForm<IncrementForm> None (fun payload -> 
                htmlNodes (Views.counter payload.Count tokens)))

Full context: https://github.com/surferjeff/blazor-compared/blob/43b40f1a66794749ff961cfa9e785b9af83a25f2/GiraffeApp/Program.fs#L46

Fun! I strongly encourage you to stick with the code you have instead of what I wrote, but it was fun to try to reduce it down. Sometimes functions line up just right so that using partial application and compose can shorten it and stay readable, but in this case it needs enough contortions that I think it’s much less readable when you shorten it than your original code. My final form is

open FSharpx
let (<<+) f g x y = f (g x y)
let count p = p.Count 

let incrementHandler : HttpHandler =
  getAndStoreAntiforgeryTokens 
    (bindForm<IncrementForm> None << flip (htmlNodes <<+ Views.counter << count))

So I needed to define an extra operator <<+ for a compose with two arguments, which doesn’t exist in the standard library. I also needed flip from FSharpx.Extras. I defined a function count, but in a couple weeks when F#8 lands I can get rid of that and just have

open FSharpx
let (<<+) f g x y = f (g x y)

let incrementHandler : HttpHandler =
  getAndStoreAntiforgeryTokens 
    (bindForm<IncrementForm> None << flip (htmlNodes <<+ Views.counter << _.Count))

Here’s the steps I took to reduce it:

let incrementHandler =
  getAndStoreAntiforgeryTokens (fun tokens ->
    bindForm<IncrementForm> None (fun payload -> 
      htmlNodes (Views.counter payload.Count tokens)))

let incrementHandler' =
  getAndStoreAntiforgeryTokens (fun tokens ->
    bindForm<IncrementForm> None <| (fun tokens payload -> 
      htmlNodes (Views.counter payload.Count tokens)) tokens)

let incrementHandler'' =
  getAndStoreAntiforgeryTokens 
    (bindForm<IncrementForm> None << (fun tokens payload -> 
      htmlNodes (Views.counter payload.Count tokens)))

let incrementHandler''' =
  getAndStoreAntiforgeryTokens 
    (bindForm<IncrementForm> None << flip (fun payload tokens -> 
      htmlNodes (Views.counter payload.Count tokens)))

let incrementHandler'''' =
  getAndStoreAntiforgeryTokens 
    (bindForm<IncrementForm> None << flip (fun payload -> 
      htmlNodes << Views.counter payload.Count))

let incrementHandler''''' =
  getAndStoreAntiforgeryTokens 
    (bindForm<IncrementForm> None << flip ((fun c -> 
      htmlNodes << Views.counter c) << count))

let incrementHandler'''''' =
  getAndStoreAntiforgeryTokens 
    (bindForm<IncrementForm> None << flip (htmlNodes <<+ Views.counter << count))

Thank you ntwilson. This shows me the next things I need to learn in my F# journey: compose and flip.