From 0217a2129512149f793c809c495ef50597fd2add Mon Sep 17 00:00:00 2001 From: Oskar Gewalli Date: Fri, 28 May 2021 08:26:42 +0200 Subject: [PATCH] v1 compatibility --- src/FSharpPlus/Lens.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/FSharpPlus/Lens.fs b/src/FSharpPlus/Lens.fs index 18d442a9e..c95387cdb 100644 --- a/src/FSharpPlus/Lens.fs +++ b/src/FSharpPlus/Lens.fs @@ -52,7 +52,11 @@ module Lens = /// The prism. /// The object. /// The value (if any) the prism is targeting. + #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 /// Build a 'Lens' from a getter and a setter. /// 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.