Originally opened at CodePlex by ashtonkj
The default syntax highlighter will highlight a computation expression without a generic type parameter, but once a generic type parameter is provided then the syntax highlighter will not colour the computation expression. See the following code for example (In the default Visual Studio dark theme ceBoolBuilder is coloured blue, but ceBuilder<System.DateTimeKind> is not):
typeTestCE<'T>()=memberthis.ReturnFrom(value)=if System.String.IsNullOrEmpty(value)then
None
elselettypeT= typeof<'T>if typeT.IsEnum then
box (System.Enum.Parse(typeT, value))|> Some
elseif typeT = typeof<bool>then
box (bool.Parse(value))|> Some
else None
letceBuilder<'T>= TestCE<'T>()letceBoolBuilder= TestCE<bool>()letexampleIncorrect= ceBuilder<System.DateTimeKind>{return! System.DateTimeKind.Local.ToString()}letexampleCorrect= ceBoolBuilder {return!"true"}
Imagecomments
coza99 wrote Sep 3, 2014 at 3:54 AM [x]
This is also true if the builder function is parameterized. Taking the case from above an example
typeTextCE<'T>(name:string)=..........letceBuilder<'T>name = TestCE<'T>(name)
Originally opened at CodePlex by ashtonkj
The default syntax highlighter will highlight a computation expression without a generic type parameter, but once a generic type parameter is provided then the syntax highlighter will not colour the computation expression. See the following code for example (In the default Visual Studio dark theme ceBoolBuilder is coloured blue, but ceBuilder<System.DateTimeKind> is not):