Skip to content

Commit 0217a21

Browse files
committed
v1 compatibility
1 parent 1e386dd commit 0217a21

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/FSharpPlus/Lens.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ module Lens =
5252
/// <param name="prism">The prism.</param>
5353
/// <param name="source">The object.</param>
5454
/// <returns>The value (if any) the prism is targeting.</returns>
55+
#if FABLE_COMPILER
5556
let preview (optic: ('a -> Const<_,'b>) -> _ -> Const<_,'t>) (source: 's) : 'a option = source |> optic (fun x -> Const (First (Some x))) |> Const.run |> First.run
57+
#else
58+
let preview prism = First.run << Const.run << prism (fun x -> Const (FSharpPlus.Data.First (Some x)))
59+
#endif
5660

5761
/// <summary>Build a 'Lens' from a getter and a setter.</summary>
5862
/// <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>

0 commit comments

Comments
 (0)