Skip to content

Commit 5b6f9a1

Browse files
authored
Add Map and Return methods to make it more F#+ friendly (#618)
1 parent 8163b32 commit 5b6f9a1

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/FsCheck/Gen.fs

+14-4
Original file line numberDiff line numberDiff line change
@@ -649,9 +649,19 @@ type Gen<'a> with
649649
/// Lifted function application = apply f to a, all in the Gen applicative functor.
650650
static member (<*>) (f, a) = apply f a
651651

652-
/// Like <*>, but puts f in a Gen first.
653-
static member (<!>) (f, a) = Gen.constant f <*> a
654-
652+
/// An alias for Map with arguments swapped.
653+
static member (<!>) (f, a) = Gen.map f a
654+
655655
/// Bind operator; runs the first generator, then feeds the result
656656
/// to the second generator function.
657-
static member (>>=) (m,k) = bind m k
657+
static member (>>=) (m, k) = bind m k
658+
659+
660+
// The reason for the following methods is that they are useful when
661+
// interacting with FSharpPlus, together with the above defined operators.
662+
663+
[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
664+
static member Return value = Gen.constant value
665+
666+
[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
667+
static member Map (value, f) = Gen.map f value

0 commit comments

Comments
 (0)