From eb3fa03b15734c044bc026d7a98772d1cf473787 Mon Sep 17 00:00:00 2001 From: Smaug123 Date: Thu, 21 Dec 2023 15:16:49 +0000 Subject: [PATCH] compiles --- .gitignore | 12 +++++++ WoofWorkflows.sln | 16 +++++++++ WoofWorkflows/Pipeline.fs | 54 ++++++++++++++++++++++++++++++ WoofWorkflows/Program.fs | 8 +++++ WoofWorkflows/StepDag.fs | 21 ++++++++++++ WoofWorkflows/WoofWorkflows.fsproj | 14 ++++++++ 6 files changed, 125 insertions(+) create mode 100644 .gitignore create mode 100644 WoofWorkflows.sln create mode 100644 WoofWorkflows/Pipeline.fs create mode 100644 WoofWorkflows/Program.fs create mode 100644 WoofWorkflows/StepDag.fs create mode 100644 WoofWorkflows/WoofWorkflows.fsproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..104abff --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +bin/ +obj/ +riderModule.iml +_ReSharper.Caches/ +.idea/ +*.user +*.DotSettings +.DS_Store +result +.profile* + +inputs/ diff --git a/WoofWorkflows.sln b/WoofWorkflows.sln new file mode 100644 index 0000000..d821bc1 --- /dev/null +++ b/WoofWorkflows.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "WoofWorkflows", "WoofWorkflows\WoofWorkflows.fsproj", "{994687CC-F99A-4DFD-BDEE-C8226F245129}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {994687CC-F99A-4DFD-BDEE-C8226F245129}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {994687CC-F99A-4DFD-BDEE-C8226F245129}.Debug|Any CPU.Build.0 = Debug|Any CPU + {994687CC-F99A-4DFD-BDEE-C8226F245129}.Release|Any CPU.ActiveCfg = Release|Any CPU + {994687CC-F99A-4DFD-BDEE-C8226F245129}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/WoofWorkflows/Pipeline.fs b/WoofWorkflows/Pipeline.fs new file mode 100644 index 0000000..515f6b4 --- /dev/null +++ b/WoofWorkflows/Pipeline.fs @@ -0,0 +1,54 @@ +namespace WoofWorkflows + +open System.IO + +[] +type Declarative<'plat> (codeRoot : DirectoryInfo Comp) = + member _.Return (sd : StepDag<'a, 'plat>) = StepDag.seal sd + [] //, IsLikeZip = true + member _.RunShell + (command : StepDag<'prev, 'plat>, [] toRun : StepDag<'prev, 'plat> -> string) + : StepDag<'a, 'plat> + = + failwith "" + // For binding in other StepDags + member _.Bind<'a, 'b> (toRun : string, cont : StepDag<'a, 'plat> -> SealedStepDag<'b, 'plat>) : StepDag<'b, 'plat> = + failwith "" + // For binding in other StepDags + member _.Bind (prev : 'args, cont : unit -> SealedStepDag<_, 'plat>) : SealedStepDag<_, _> = + failwith "" + member _.Yield<'a> (x : 'a) = + StepDag.empty<_, 'plat> x + //member _.For (m, cont : 'b -> 'c) : 'e = + // failwith "" + +[] +module Pipeline = + let readOnlyPipeline<'plat> (codeRoot : DirectoryInfo Comp) = Declarative<'plat> codeRoot + + let foo<'a> : SealedStepDag<'a, unit> = + readOnlyPipeline (Comp.make (DirectoryInfo "code root here")) { + let! (foo : StepDag) = "sh script here" + sh "a shell script" + return (StepDag.empty 4) + } + + (* + declarative.Bind>( + declarative.RunShell( + declarative.Bind, object, string>( + "sh script here", + (FSharpFunc, SealedStepDag>) declarative.Return + ), + (FSharpFunc) (fun _ -> "a shell script") + ), + (FSharpFunc>) (fun _ -> + string message = "hi"; + if (true) + throw Operators.Failure(message); + StepDag sd = (StepDag) null; + return declarative.Return(sd); + ) + ); + *) + diff --git a/WoofWorkflows/Program.fs b/WoofWorkflows/Program.fs new file mode 100644 index 0000000..73165e1 --- /dev/null +++ b/WoofWorkflows/Program.fs @@ -0,0 +1,8 @@ +namespace WoofWorkflows + +module Program = + [] + let main argv = + Pipeline.foo + |> ignore + 0 \ No newline at end of file diff --git a/WoofWorkflows/StepDag.fs b/WoofWorkflows/StepDag.fs new file mode 100644 index 0000000..8af78fe --- /dev/null +++ b/WoofWorkflows/StepDag.fs @@ -0,0 +1,21 @@ +namespace WoofWorkflows + +type StepDag<'a, 'plat> = private | StepDag +type SealedStepDag<'a, 'plat> = private | SealedStepDag + +type Step<'a> = private | Step + +type Comp<'a> = private | Comp of (unit -> 'a) + +[] +module Comp = + let make (x : 'a) : Comp<'a> = Comp (fun () -> x) + +[] +module StepDag = + + let empty<'a, 'plat> (v : 'a) : StepDag<'a, 'plat> = StepDag + let addStep (name : string) (step : 'a Step) (cont : 'a -> StepDag<'b, 'plat>) : StepDag<'b, 'plat> = + failwith "" + let seal<'a, 'plat> (s : StepDag<'a, 'plat>) : SealedStepDag<'a, 'plat> = SealedStepDag + diff --git a/WoofWorkflows/WoofWorkflows.fsproj b/WoofWorkflows/WoofWorkflows.fsproj new file mode 100644 index 0000000..4904fe3 --- /dev/null +++ b/WoofWorkflows/WoofWorkflows.fsproj @@ -0,0 +1,14 @@ + + + + Exe + net8.0 + + + + + + + + +