I often find myself using the |> operator when constructing functions to pass as parameters to methods like List.find. For example, I have this code snippet:
let parse_test_header (header : string list) : string * (string list) =
let is_attr (line : string) : bool = ':' == get line 0 in
let test_name = List.find (fun line -> line |> is_attr |> not) header in
let test_attrs = List.filter is_attr header in
(test_name, test_attrs)
For simplicity I would like to use |> without having to wrap it in a fun ... -> ... first, something like:
let parse_test_header (header : string list) : string * (string list) =
let is_attr (line : string) : bool = ':' == get line 0 in
let test_name = List.find (is_attr |> not) header in
let test_attrs = List.filter is_attr header in
(test_name, test_attrs)
However, this gives
31 | let test_name = List.find (is_attr |> not) header in
^^^^^^^
Error: This expression has type string -> bool
but an expression was expected of type bool
Is there some way to accomplish this?