Organise my mutual recursive types
-
29-09-2019 - |
Pergunta
Is it possible to have mutual recursive types ([<Struct>]
) spread across different files? The types are directly under a namespace.
My solution is to put them in one big file and use type ... and ... and ... etc
construction. Is it the only way?
Solução
You can use a technique called untying the recursive knot where you parameterize one over the other.
So this:
type a = B of b
and b = A of a
becomes:
type 'b a = B of 'b
type b = A of b a
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow