BREAKING CHANGE: extend Option module for Maybe/FSharpOption interop
This commit is contained in:
parent
2fd6b01f6b
commit
a6bcd20a11
|
@ -1,16 +1,11 @@
|
|||
namespace FruityFoundation.FsBase
|
||||
|
||||
open System.Runtime.CompilerServices
|
||||
open FruityFoundation.Base.Structures
|
||||
|
||||
[<Extension>]
|
||||
type Extensions () =
|
||||
[<Extension>]
|
||||
static member ToMaybe (opt : 'a option) =
|
||||
match opt with
|
||||
module Option =
|
||||
let toMaybe : 'a option -> Maybe<'a> = function
|
||||
| Some x -> x |> Maybe.Create
|
||||
| None -> Maybe.Empty ()
|
||||
|
||||
[<Extension>]
|
||||
static member ToFSharpOption (opt : 'a Maybe) =
|
||||
if opt.HasValue then Some opt.Value else None
|
||||
let fromMaybe : Maybe<'a> -> 'a option = function
|
||||
| x when x.HasValue -> Some x.Value
|
||||
| _ -> None
|
||||
|
|
Loading…
Reference in New Issue
Block a user