Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,22 @@

<!-- dotnet msbuild -target:AllDocs build.proj -->
<Target Name="AllDocs">
<Exec Command='dotnet tool restore' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
<Exec Command='dotnet build FSharpPlus.sln -c Release' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
<Exec Command='./docsrc/tools/download_nugets.cmd' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" Condition=" '$(OS)' == 'Windows_NT' " />
<Exec Command='./docsrc/tools/download_nugets.sh' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" Condition=" '$(OS)' != 'Windows_NT' " />
<Exec Command='dotnet run -c Release --project ./docsrc/tools' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
</Target>

<Target Name="ReleaseDocs">
<Exec Command='dotnet tool restore' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
<Exec Command='dotnet build FSharpPlus.sln -c Release' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
<Exec Command='./docsrc/tools/download_nugets.cmd' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" Condition=" '$(OS)' == 'Windows_NT' " />
<Exec Command='./docsrc/tools/download_nugets.sh' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" Condition=" '$(OS)' != 'Windows_NT' " />
<Exec Command='dotnet run -c Release --project ./docsrc/tools ReleaseDocs' WorkingDirectory="$(RepoRootDir)" IgnoreStandardErrorWarningFormat="true" />
</Target>


<Target Name="VSTest" DependsOnTargets="Test" />

</Project>
3 changes: 1 addition & 2 deletions docsrc/tools/download_nugets.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@ECHO OFF
PowerShell.exe -Command "& '%~dpn0.ps1'"
@%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"
17 changes: 14 additions & 3 deletions src/FSharpPlus/Control/Applicative.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -155,9 +158,17 @@ type IsLeftZero =
static member IsLeftZero (t: ref<Choice<_,_>> , _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<IsLeftZero>, x)

let ty = typeof<IsLeftZero>
let mi = ty.GetMethod ("IsLeftZero", [|typeof<ref<'``Applicative<'T>``>>; 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)
Expand Down