This commit is contained in:
Smaug123
2023-12-21 15:16:49 +00:00
commit eb3fa03b15
6 changed files with 125 additions and 0 deletions

12
.gitignore vendored Normal file
View File

@@ -0,0 +1,12 @@
bin/
obj/
riderModule.iml
_ReSharper.Caches/
.idea/
*.user
*.DotSettings
.DS_Store
result
.profile*
inputs/

16
WoofWorkflows.sln Normal file
View File

@@ -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

54
WoofWorkflows/Pipeline.fs Normal file
View File

@@ -0,0 +1,54 @@
namespace WoofWorkflows
open System.IO
[<Sealed ; Class>]
type Declarative<'plat> (codeRoot : DirectoryInfo Comp) =
member _.Return (sd : StepDag<'a, 'plat>) = StepDag.seal sd
[<CustomOperation ("sh", MaintainsVariableSpaceUsingBind = true)>] //, IsLikeZip = true
member _.RunShell
(command : StepDag<'prev, 'plat>, [<ProjectionParameter>] 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 ""
[<AutoOpen>]
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<int, string>) = "sh script here"
sh "a shell script"
return (StepDag.empty 4)
}
(*
declarative.Bind<object, a, SealedStepDag<a, Unit>>(
declarative.RunShell<object, string, string>(
declarative.Bind<StepDag<object, Unit>, object, string>(
"sh script here",
(FSharpFunc<StepDag<object, Unit>, SealedStepDag<object, Unit>>) declarative.Return
),
(FSharpFunc<object, string>) (fun _ -> "a shell script")
),
(FSharpFunc<object, SealedStepDag<a, Unit>>) (fun _ ->
string message = "hi";
if (true)
throw Operators.Failure(message);
StepDag<a, Unit> sd = (StepDag<a, Unit>) null;
return declarative.Return<a>(sd);
)
);
*)

8
WoofWorkflows/Program.fs Normal file
View File

@@ -0,0 +1,8 @@
namespace WoofWorkflows
module Program =
[<EntryPoint>]
let main argv =
Pipeline.foo<uint32>
|> ignore
0

21
WoofWorkflows/StepDag.fs Normal file
View File

@@ -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)
[<RequireQualifiedAccess>]
module Comp =
let make (x : 'a) : Comp<'a> = Comp (fun () -> x)
[<RequireQualifiedAccess>]
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

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="StepDag.fs" />
<Compile Include="Pipeline.fs" />
<Compile Include="Program.fs"/>
</ItemGroup>
</Project>