How to have two mutually recursive struct types in F#?

.net, f#

Solution

Move the attribute definition after the `and` token

and [<Struct>] Edge(target:Point, cost:int) =

Problem

The following code does not compile: ``` [<Struct>] type Point(x:int, y:int) = member __.X = x member __.Y = y member __.Edges = ArrayList<Edge>() [<Struct>] and Edge(target:Point, cost:int) = member __.Target = target member __.Cost = cost ``` The problem resides on the `[<Struct>]` attributes, that seem to collide with the "and" construct. How should I go about doing this? I know I could alternatively accomplish the task with ``` type Point(x:int, y:int) = struct member __.X = x member __.Y = y member __.Edges = new ArrayList<Edge>() end and Edge(target:Point, cost:int) = struct member __.Target = target member __.Cost = cost end ``` but I like the `[<Struct>]` succinctness. Thanks

Original source