Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document CE constructors in a way that circumvents the warnings #137

Merged
merged 1 commit into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Flips/Domain.fs
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,12 @@ module Builders =
|> String.concat "_"
|> (sprintf "%s_%s" prefix)

// note: the param for this constructor argument is correct, to the best of my knowledge, but the validation logic inside the compiler doesn't recognize it

/// <summary>A Computation Expression for creating constraints with a predefined naming convention</summary>
/// <param name="constraintSetPrefix">The string which will be the prefix for all of the constraints</param>
/// <returns>A sequence of Constraints whith the given prefix and a unique name for each constraint</returns>
type ConstraintBuilder (constraintSetPrefix:string) =
type ConstraintBuilder
/// <summary>A Computation Expression for creating constraints with a predefined naming convention</summary>
/// <param name="constraintSetPrefix">The string which will be the prefix for all of the constraints</param>
/// <returns>A sequence of Constraints whith the given prefix and a unique name for each constraint</returns>
(constraintSetPrefix:string) =

member this.Yield (cExpr:ConstraintExpression) =
cExpr
Expand All @@ -298,12 +298,12 @@ module Builders =
member this.Run(source:seq<'a * ConstraintExpression>) =
source |> Seq.map (fun (n, c) -> Constraint.create (namer constraintSetPrefix n) c)

// note: the param for this constructor argument is correct, to the best of my knowledge, but the validation logic inside the compiler doesn't recognize it

/// <summary>A Computation Expression for creating tuples of type ('Key * Decision)</summary>
/// <param name="decisionSetPrefix">The prefix used for naming the Decisions</param>
/// <returns>A seq of type ('Key * Decision). The result is typically used to create a Map or SliceMap</returns>
type DecisionBuilder (decisionSetPrefix:string) =
type DecisionBuilder
/// <summary>A Computation Expression for creating tuples of type ('Key * Decision)</summary>
/// <param name="decisionSetPrefix">The prefix used for naming the Decisions</param>
/// <returns>A seq of type ('Key * Decision). The result is typically used to create a Map or SliceMap</returns>
(decisionSetPrefix:string) =

let createDecision indices decisionType =
let name = namer decisionSetPrefix indices
Expand Down
12 changes: 7 additions & 5 deletions Flips/UnitsOfMeasure.Domain.fs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ module Solution =

[<AutoOpen>]
module Builders =
// Note: this warning is because the compiler's detection for parameters is off for constructors. This is ok until that logic is fixed.

/// <summary>A Computation Expression for creating tuples of type (<typeparamref name="'Key"/> * Decision&lt;<typeparamref name="'Measure" />&gt;)</summary>
/// <summary>A Computation Expression for creating tuples of type (<typeparamref name="'Key"/> * <c>Decision</c>&lt;<typeparamref name="'Measure" />&gt;)</summary>
/// <typeparam name="'Measure">The Unit of Measure for the Decisions</typeparam>
/// <param name="decisionSetPrefix">The prefix used for naming the Decisions</param>
/// <returns>A seq of type (<typeparamref name="'Key"/> * Decision&lt;<typeparamref name="'Measure" />&gt;). The result is typically used to create a Map or SliceMap</returns>
type DecisionBuilder<[<Measure>] 'Measure> (decisionSetPrefix:string) =
type DecisionBuilder<[<Measure>] 'Measure>
/// <summary>A Computation Expression for creating tuples of type (<typeparamref name="'Key"/> * Decision&lt;<typeparamref name="'Measure" />&gt;)</summary>
/// <typeparam name="'Measure">The Unit of Measure for the Decisions</typeparam>
/// <param name="decisionSetPrefix">The prefix used for naming the Decisions</param>
/// <returns>A seq of type (<typeparamref name="'Key"/> * Decision&lt;<typeparamref name="'Measure" />&gt;). The result is typically used to create a Map or SliceMap</returns>
(decisionSetPrefix:string) =

let createDecision indices decisionType =
let name = namer decisionSetPrefix indices
Expand Down