Skip to content

Commit c525bcb

Browse files
authored
Fix zero of voption
1 parent 94a2c99 commit c525bcb

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#### 1.3.3 - February 4 2023
2+
- Fix missing zero overload for voption
3+
14
#### 1.3.2 - December 2 2022
25
- Applicative Computation Expressions
36
- Support for ValueOption, ValueTask and ValueTuple

RELEASE_NOTES.txt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
Release Notes for FSharpPlus 1.3.2 - December 2 2022
1+
Release Notes for FSharpPlus 1.3.3 - February 4 2023
22
-----------------------------------------------------
33

4-
Applicative Computation Expressions
5-
Support for ValueOption, ValueTask and ValueTuple
6-
Possibility to use explicit type parameters (plus, Seq.sum, guard, ofBytes, ofBytesWithOptions, ofBytesBE, parse, tryParse)
7-
Use InlineIfLambda attribute in CEs
8-
Small fixes (add lift3 for tuples, fix join for ref tuple and Free.map3)
9-
Small improvements in type inference
10-
Use F# Core 6.0.6
11-
Speed up List and Array extensions using Collectors
12-
Use FSharp.Core implementations for old functions that were adopted there
13-
Add some missing Option, Result zip functions
14-
Add explicit type parameters
15-
Speed up by using InlineIfLambda attribute in CEs
16-
Some missing Option, Result zip functions
17-
Add NonEmptyList.sequence
18-
Improve null handling for Array extensions
4+
Fix missing zero overload for voption

src/FSharpPlus/Control/Numeric.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ type Zero =
136136
static member Zero (_: DmStruct , _: Zero ) = Unchecked.defaultof<DmStruct>
137137
static member Zero (_: list<'a> , _: Zero ) = [] : list<'a>
138138
static member Zero (_: option<'a> , _: Zero ) = None : option<'a>
139+
static member Zero (_: voption<'a> , _: Zero ) = ValueNone : voption<'a>
139140
static member Zero (_: array<'a> , _: Zero ) = [||] : array<'a>
140141
static member Zero (_: string , _: Zero ) = ""
141142
static member Zero (_: StringBuilder , _: Zero ) = new StringBuilder ()

tests/FSharpPlus.Tests/General.fs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,20 @@ module Numerics =
17041704

17051705
Assert.AreEqual (argBigRational, r09 * r19)
17061706

1707+
[<Struct>]
1708+
type GuidId<'t> =
1709+
| Id of Guid
1710+
1711+
[<Test>]
1712+
let zeroOfDifferentTypes () =
1713+
let _01 = zero<int option>
1714+
areEqual None _01
1715+
let _02 = zero<GuidId<int> option>
1716+
areEqual None _02
1717+
let _03 = zero<int voption>
1718+
areEqual ValueNone _03
1719+
let _04 = zero<GuidId<int> voption>
1720+
areEqual ValueNone _04
17071721

17081722

17091723

0 commit comments

Comments
 (0)