I want to defined mutually recursive parser functions using Angstrom and

- it seems that built-in
`fix`

doesn’t help me - I can’t declare my own polyvariadic
`fix`

because parser type is abstract.

I also checked other parser-combinator libraries and they seems to have parser type to be concrete. How should I proceed? @seliopou ?

```
open Angstrom
let rec fix_comb f a = f (fix_comb f) a
let fix_poly :
(('a -> 'b) list -> 'a -> 'b) list -> ('a -> 'b) list =
fun l ->
fix_comb
(fun self l -> List.map (fun li x -> li (self l) x) l)
l
[@@@warning "-8-27"]
let [ even; odd ] =
let open_even [ even; odd ] n = n = 0 || odd (n - 1)
and open_odd [ even; odd ] n = n <> 0 && even (n - 1) in
fix_poly [ open_even; open_odd ]
[@@@warning "+8+27"]
let parens p =
char '(' >>= fun _ ->
p >>= fun x ->
char ')' >>= fun _ -> return x
let const =
char '0' >>= fun c -> return (Printf.sprintf "%c" c)
let [ sum; product ] =
let open_sum [ sum; product ] =
choice
[
parens sum;
( product >>= fun h ->
many (char '+' >>= fun _ -> product) >>= fun tl ->
return
(List.fold_left
(fun acc r -> Printf.sprintf "%s+%s" acc r)
h tl) );
]
and open_product [ sum; product ] =
choice
[
parens sum;
( const >>= fun h ->
many (char '*' >>= fun _ -> product) >>= fun tl ->
return
(List.fold_left
(fun acc r -> Printf.sprintf "%s*%s" acc r)
h tl) );
]
in
fix_poly [ open_sum; open_product ]
(*
81 | fix_poly [ open_sum; open_product ]
^^^^^^^^
Error: This expression has type string t list -> string t
but an expression was expected of type ('a -> 'b) list -> 'a -> 'b
Type string t is not compatible with type 'a -> 'b *)
```