Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wallymathieu committed Feb 5, 2023
2 parents b7529ff + 50dbb7b commit 25158ad
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
5 changes: 4 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#### 1.3.3 - February 4 2023
#### 1.3.3 - February 5 2023
- Fix missing zero overload for voption
- Add (>>=) and (>=>) to ReaderT
- Add ValueOption.toOption
- Deprecate (<**>)

#### 1.3.2 - December 2 2022
- Applicative Computation Expressions
Expand Down
7 changes: 5 additions & 2 deletions RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Release Notes for FSharpPlus 1.3.3 - February 4 2023
Release Notes for FSharpPlus 1.3.3 - February 5 2023
-----------------------------------------------------

Fix missing zero overload for voption
Fix missing zero overload for voption
Add (>>=) and (>=>) to ReaderT
Add ValueOption.toOption
Deprecate (<**>)
12 changes: 11 additions & 1 deletion src/FSharpPlus/Data/Reader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,18 @@ type ReaderT<'r,'``monad<'t>``> with
/// <category index="2">Applicative</category>
static member inline (<* ) (x: ReaderT<'R, '``Monad<'U>``>, y: ReaderT<'R, '``Monad<'T>``>) : ReaderT<'R, '``Monad<'U>``> = ((fun (k: 'U) (_: 'T) -> k ) </ReaderT.map/> x : ReaderT<'R, '``Monad<'T->'U>``>) </ReaderT.apply/> y

/// <summary>
/// Takes a Reader value and a function from a plain type to a Reader value, and returns a new Reader value.
/// </summary>
/// <category index="2">Monad</category>
static member inline (>>=) (x: ReaderT<_,'``Monad<'T>``>, f: 'T->ReaderT<'R,'``Monad<'U>``>) = ReaderT.bind f x : ReaderT<'R, '``Monad<'U>``>


/// <summary>
/// Composes left-to-right two Reader functions (Kleisli composition).
/// </summary>
/// <category index="2">Monad</category>
static member inline (>=>) (f: 'T -> ReaderT<_,'``Monad<'U>``>, g: 'U -> ReaderT<'R,'``Monad<'V>``>) : 'T -> ReaderT<'R,'``Monad<'V>``> = fun x -> ReaderT.bind g (f x)

static member inline get_Empty () = ReaderT (fun _ -> getEmpty ()) : ReaderT<'R, '``MonadPlus<'T>``>
static member inline (<|>) (ReaderT m, ReaderT n) = ReaderT (fun r -> m r <|> n r) : ReaderT<'R, '``MonadPlus<'T>``>

Expand Down
1 change: 1 addition & 0 deletions src/FSharpPlus/Extensions/Result.fs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ module Result =
/// <remarks><c>flatten</c> is equivalent to <c>bind id</c>.</remarks>
let flatten source : Result<'T,'Error> = match source with Ok (Ok v) -> Ok v | Ok (Error e) | Error e -> Error e

// Note: To be fixed in F#+ 2. Arguments should be flipped in order to match the generic catch.
[<System.Obsolete("Use Result.bindError instead.")>]
let inline catch f = function Ok v -> Ok v | Error e -> (f: 't->_) e : Result<'v,'e>

Expand Down
5 changes: 5 additions & 0 deletions src/FSharpPlus/Extensions/ValueOption.fs
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,8 @@ module ValueOption =
match pair with
| true, x -> ValueSome x
| false, _ -> ValueNone

let toOption x =
match x with
| ValueSome x -> Some x
| ValueNone -> None
4 changes: 1 addition & 3 deletions src/FSharpPlus/Operators.fs
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ module Operators =
/// <category index="2">Applicative</category>
let inline (<* ) (x: '``Applicative<'U>``) (y: '``Applicative<'T>``) : '``Applicative<'U>`` = ((fun (k: 'U) (_: 'T) -> k ) <!> x : '``Applicative<'T->'U>``) <*> y

/// <summary>
/// Apply a lifted argument to a lifted function (flipped): arg &lt;**&gt; f
/// </summary>
[<System.Obsolete("Use flip (<*>) instead.")>]
/// <category index="2">Applicative</category>
let inline (<**>) (x: '``Applicative<'T>``) : '``Applicative<'T -> 'U>``->'``Applicative<'U>`` = flip (<*>) x

Expand Down

0 comments on commit 25158ad

Please sign in to comment.