Skip to content

Commit bae59f0

Browse files
committed
+ HashSet as Monoid
1 parent d7bef8c commit bae59f0

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/FSharpPlus/Control/Monoid.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type Plus =
2929
static member ``+`` (x: Set<_> , y , [<Optional>]_mthd: Plus ) = Set.union x y
3030

3131
#if !FABLE_COMPILER
32+
static member ``+`` (x: HashSet<_> , y , [<Optional>]_mthd: Plus ) = HashSet.union x y
3233
static member ``+`` (x: StringBuilder , y: StringBuilder , [<Optional>]_mthd: Plus ) = StringBuilder().Append(x).Append(y)
3334
static member ``+`` (_: Id0 , _: Id0 , [<Optional>]_mthd: Plus ) = Id0 ""
3435
static member ``+`` (x: AggregateException, y: AggregateException, [<Optional>]_mthd: Plus ) = Exception.add x y

src/FSharpPlus/Control/Numeric.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace FSharpPlus.Control
66

77
open System.Runtime.InteropServices
88
open FSharpPlus.Internals
9+
open FSharpPlus
910
#if FABLE_COMPILER
1011
/// NOTE
1112
type OptionalAttribute ()=
@@ -206,14 +207,15 @@ type Zero with
206207
static member inline Zero (_: Lazy<'a> , _: Zero) = let (v: 'a) = Zero.Invoke () in lazy v
207208
static member Zero (_: Dictionary<'a,'b> , _: Zero) = Dictionary<'a,'b> ()
208209
static member Zero (_: ResizeArray<'a> , _: Zero) = ResizeArray () : ResizeArray<'a>
210+
static member Zero (_: HashSet<'a> , _: Zero ) = HashSet.empty : HashSet<'a>
209211

210212
type Zero with
211213
static member inline Zero (_: ^R , _: Default6) = FromInt64.Invoke 0L : ^R
212214

213215
static member inline Zero (_: ^R , _: Default5) = Implicit.Invoke 0 : ^R
214216

215217
static member Zero (_: seq<'a> , _: Default4) = Seq.empty : seq<'a>
216-
static member Zero (_: IEnumerator<'a> , _: Default4) = FSharpPlus.Enumerator.Empty () : IEnumerator<'a>
218+
static member Zero (_: IEnumerator<'a> , _: Default4) = Enumerator.Empty () : IEnumerator<'a>
217219
static member Zero (_: IDictionary<'a,'b> , _: Default4) = Dictionary<'a,'b> () :> IDictionary<'a,'b>
218220
static member Zero (_: IReadOnlyDictionary<'a,'b> , _: Default4) = Dictionary<'a,'b> () :> IReadOnlyDictionary<'a,'b>
219221
static member inline Zero (_: 't , _: Default3) = (^t : (static member Empty: ^t) ()) : 't

0 commit comments

Comments
 (0)