Computation expression custom operation with multiple parameters

316 Views Asked by At

I am creating a DSL for C4 model diagrams. 1st stab at it is here I decided it would make more sense to separate software concepts and diagram. What this means is the position on the canvas only need be assigned when creating the diagram.

So when I tried adding position to the custom operation arguments I cannot figure out how to use it in the computation expression.

The new builder looks like this:

type SystemLandscapeDiagramBuilder internal (scope, desc, size) =
    member __.Yield(_) : SystemLandscapeDiagram = 
        SystemLandscapeDiagram.init scope desc size

    [<CustomOperation("user")>]
    member __.User(diagram, user, pos) : SystemLandscapeDiagram =
        diagram |> SystemLandscapeDiagram.addPerson user pos

The compiler error is This control construct may only be used if the computation expression builder defines a 'For' method

Is it possible to have multiple arguments? Ideas on what I am doing wrong?

0

There are 0 best solutions below