-
Notifications
You must be signed in to change notification settings - Fork 11
Add UOM for all basic types. #29
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
base: master
Are you sure you want to change the base?
Conversation
[<MeasureAnnotatedAbbreviation>] type string<[<Measure>] 'm> = string | ||
[<MeasureAnnotatedAbbreviation>] type TimeSpan<[<Measure>] 'm> = TimeSpan | ||
[<MeasureAnnotatedAbbreviation>] type DateTime<[<Measure>] 'm> = DateTime | ||
[<MeasureAnnotatedAbbreviation>] type DateTimeOffset<[<Measure>] 'm> = DateTimeOffset | ||
#if NET6_0_OR_GREATER | ||
[<MeasureAnnotatedAbbreviation>] type DateOnly<[<Measure>] 'm> = DateOnly | ||
[<MeasureAnnotatedAbbreviation>] type TimeOnly<[<Measure>] 'm> = TimeOnly | ||
#else | ||
[<MeasureAnnotatedAbbreviation>] type uint32<[<Measure>] 'm> = uint32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the uint
alias and the ability to support for UOM in FSharp.Core
wasn't added until around F# 5. To work around this I think we need to use conditional compilation to add support for uint32
prior to this point in time hence the #else
in the preprocessor directive.
I feel like this might not be the most accurate preprocessor directive to use though. So if anyone knows of a more F# language version specific one that we could use please let me know. I kinda wanted to use FSHARP5_OR_GREATER
but couldn't find a reference for any commonly defined F# specific directives.
@@ -28,6 +28,7 @@ | |||
|
|||
<ItemGroup> | |||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" /> | |||
<PackageReference Include="FSharp.Core" Version="4.3.4" /> | |||
<PackageReference Condition=" '$(TargetFramework)' == 'netstandard2.0' " Include="FSharp.Core" Version="4.3.4" /> | |||
<PackageReference Condition=" '$(TargetFramework)' == 'net6.0' " Include="FSharp.Core" Version="6.0.7" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to target a newer version of FSharp.Core
to pick up the uint
alias. Again, I chose to do this when compiling for net6.0
as it felt like it was then safe to assume we could use this later version. If that's not acceptable or if there's a better condition to target than just net6.0
let me know.
eb61d74
to
896598c
Compare
896598c
to
89b68a5
Compare
Based on #28 and the desire to support UOM for
uint32
I've added UOM for all missing basic CLR types (exceptnativeint
andunativeint
).