diff --git a/build.proj b/build.proj index 9ee435d44..2f1f16eee 100644 --- a/build.proj +++ b/build.proj @@ -20,12 +20,22 @@ + + + + + + + + + + diff --git a/docsrc/tools/download_nugets.cmd b/docsrc/tools/download_nugets.cmd index 76f0948f9..6b4bff1c0 100644 --- a/docsrc/tools/download_nugets.cmd +++ b/docsrc/tools/download_nugets.cmd @@ -1,2 +1 @@ -@ECHO OFF -PowerShell.exe -Command "& '%~dpn0.ps1'" \ No newline at end of file +@%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -Command "try { & '%~dpn0.ps1' %*; $err = -not $? } catch { Write-Host $_; $err = $true; $LastExitCode = 1 }; if ($err) { $ppid = (gwmi Win32_Process -Filter processid=$pid).ParentProcessId; $cl = (gwmi Win32_Process -Filter processid=$ppid).CommandLine; if ($cl -like '*cmd.exe /c*') { $gppid = (gwmi Win32_Process -Filter processid=$ppid).ParentProcessId; $pn = (gps -id $gppid).ProcessName; if ($pn -eq 'explorer') { pause } } }; exit $LastExitCode" \ No newline at end of file diff --git a/src/FSharpPlus/Control/Applicative.fs b/src/FSharpPlus/Control/Applicative.fs index 400a3cef6..b3eb2150a 100644 --- a/src/FSharpPlus/Control/Applicative.fs +++ b/src/FSharpPlus/Control/Applicative.fs @@ -143,6 +143,9 @@ type Lift3 with static member inline Lift3 (_, (_:'t when 't: null and 't: struct, _: ^u when ^u : null and ^u: struct, _: ^v when ^v : null and ^v: struct), _mthd: Default1) = id static member inline Lift3 (f: 'T -> 'U -> 'V -> 'W, (x: '``Applicative<'T>``, y: '``Applicative<'U>``, z: '``Applicative<'V>``) , _mthd: Default1) = ((^``Applicative<'T>`` or ^``Applicative<'U>`` or ^``Applicative<'V>`` ) : (static member Lift3 : _*_*_*_ -> _) f, x, y, z) + +open System.Reflection + type IsLeftZero = inherit Default1 @@ -155,9 +158,17 @@ type IsLeftZero = static member IsLeftZero (t: ref> , _mthd: IsLeftZero) = match t.Value with Choice2Of2 _ -> true | _ -> false static member inline Invoke (x: '``Applicative<'T>``) : bool = - let inline call (mthd : ^M, input: ^I) = - ((^M or ^I) : (static member IsLeftZero : _*_ -> _) ref input, mthd) - call(Unchecked.defaultof, x) + + let ty = typeof + let mi = ty.GetMethod ("IsLeftZero", [|typeof``>>; ty|]) + if not (isNull mi) then mi.Invoke (null, [|box x|]) |> FSharpPlus.Internals.Prelude.retype + else + let ty = typeof<'``Applicative<'T>``> + let mi = ty.GetMethod ("IsLeftZero", [|ty|]) + if isNull mi then false + else + mi.Invoke (null, [|box x|]) + |> FSharpPlus.Internals.Prelude.retype static member inline InvokeOnInstance (x: '``Applicative<'T>``) : bool = ((^``Applicative<'T>``) : (static member IsLeftZero : _ -> _) x)