You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type HtmlAttribute =
private | HtmlAttribute of name:string * value:string
What's the effect that private should have? I see that in C# projects, I no longer have the NewHtmlAttribute constructor, but I can keep doing pattern matching and create new values with HtmlAttribute("a", "b") in F#. Is that the intended behaviour? I was expecting to not be able to create new values using the union case constructor, and force people to use a static method that normalizes the arguments
The text was updated successfully, but these errors were encountered:
Just thinking out loud, it would be nice if we could expose an API over DUs for consumption from C# so that if we want to change the representation somehow (like support for GADTs) it wouldn't be as much of an issue.
The meaning is "private to the enclosing module or namespace fragment and internal to the assembly". So this correctly gives an error:
module M =
type HtmlAttribute =
private | HtmlAttribute of name:string * value:string
let x = M.HtmlAttribute("","")
let f x =
match x with
| M.HtmlAttribute(a,b) -> a + b
For example, in this type:
What's the effect that
private
should have? I see that in C# projects, I no longer have theNewHtmlAttribute
constructor, but I can keep doing pattern matching and create new values withHtmlAttribute("a", "b")
in F#. Is that the intended behaviour? I was expecting to not be able to create new values using the union case constructor, and force people to use a static method that normalizes the argumentsThe text was updated successfully, but these errors were encountered: