Skip to content

Commit 88bd6b9

Browse files
committed
+ Overloads for Return
1 parent bfa151d commit 88bd6b9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/FSharpPlus/Control/Monad.fs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,13 @@ type Return =
136136

137137

138138

139-
static member Return (_: seq<'a> , _: Default2) = fun x -> Seq.singleton x : seq<'a>
140-
static member Return (_: NonEmptySeq<'a>, _: Default2) = fun x -> NonEmptySeq.singleton x : NonEmptySeq<'a>
141-
static member Return (_: IEnumerator<'a>, _: Default2) = fun x -> Enumerator.upto None (fun _ -> x) : IEnumerator<'a>
139+
static member Return (_: seq<'a> , _: Default4) = fun x -> Seq.singleton x : seq<'a>
140+
static member Return (_: NonEmptySeq<'a>, _: Default3) = fun x -> NonEmptySeq.singleton x : NonEmptySeq<'a>
141+
static member Return (_: IEnumerator<'a>, _: Default3) = fun x -> Enumerator.upto None (fun _ -> x) : IEnumerator<'a>
142+
static member Return (_: IDictionary<'k,'t> , _: Default2) = fun x -> Dict.initInfinite x : IDictionary<'k,'t>
143+
#if (!FABLE_COMPILER_3) // TODO Dummy overload for now
144+
static member Return (_: IReadOnlyDictionary<'k,'t>, _: Default3) = fun x -> readOnlyDict [Unchecked.defaultof<'k>, x] : IReadOnlyDictionary<'k,'t>
145+
#endif
142146
static member inline Return (_: 'R , _: Default1) = fun (x: 'T) -> Return.InvokeOnInstance x : 'R
143147
static member Return (_: Lazy<'a> , _: Return ) = fun x -> Lazy<_>.CreateFromValue x : Lazy<'a>
144148
#if !FABLE_COMPILER
@@ -157,7 +161,6 @@ type Return =
157161
static member Return (_: 'a Async , _: Return ) = fun (x: 'a) -> async.Return x
158162
static member Return (_: Result<'a,'e> , _: Return ) = fun x -> Ok x : Result<'a,'e>
159163
static member Return (_: Choice<'a,'e> , _: Return ) = fun x -> Choice1Of2 x : Choice<'a,'e>
160-
static member Return (_: IDictionary<'k,'t>, _: Return) = fun x -> Dict.initInfinite x : IDictionary<'k,'t>
161164

162165
#if !FABLE_COMPILER
163166
static member Return (_: Expr<'a> , _: Return ) = fun x -> Expr.Cast<'a> (Expr.Value (x: 'a))

0 commit comments

Comments
 (0)