Skip to content

Commit

Permalink
v1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
wallymathieu committed May 28, 2021
1 parent 1e386dd commit 0217a21
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/FSharpPlus/Lens.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ module Lens =
/// <param name="prism">The prism.</param>
/// <param name="source">The object.</param>
/// <returns>The value (if any) the prism is targeting.</returns>
#if FABLE_COMPILER
let preview (optic: ('a -> Const<_,'b>) -> _ -> Const<_,'t>) (source: 's) : 'a option = source |> optic (fun x -> Const (First (Some x))) |> Const.run |> First.run
#else
let preview prism = First.run << Const.run << prism (fun x -> Const (FSharpPlus.Data.First (Some x)))
#endif

/// <summary>Build a 'Lens' from a getter and a setter.</summary>
/// <remarks>The lens should be assigned as an inline function of the free parameter, not a value, otherwise compiler will fail with a type constraint mismatch.</remarks>
Expand Down

0 comments on commit 0217a21

Please sign in to comment.