-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0162f1
commit 152dd52
Showing
13 changed files
with
142 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
let Prelude = ../lib/prelude.dhall | ||
|
||
let Types = ../types/package.dhall | ||
|
||
let Step = Types.Step | ||
|
||
let StepConstructors = Types.StepConstructors | ||
|
||
let translateHooks = ./translateHooks.dhall | ||
|
||
let mergeTags | ||
: Optional (List Text) → List Text → Optional (List Text) | ||
= λ(origTags : Optional (List Text)) | ||
→ λ(newTags : List Text) | ||
→ Some | ||
( merge | ||
{ None = newTags | ||
, Some = | ||
λ(tags : List Text) | ||
→ Prelude.List.concat Text [ tags, newTags ] | ||
} | ||
origTags | ||
) | ||
|
||
let addTagsToGet | ||
: List Text → Types.GetStep → Types.StepHooks Step → Step | ||
= λ(tags : List Text) | ||
→ λ(g : Types.GetStep) | ||
→ λ(h : Types.StepHooks Step) | ||
→ λ(S : Type) | ||
→ λ(c : StepConstructors S) | ||
→ c.get (g ⫽ { tags = mergeTags g.tags tags }) (translateHooks S c h) | ||
|
||
let addTagsToPut | ||
: List Text → Types.PutStep → Types.StepHooks Step → Step | ||
= λ(tags : List Text) | ||
→ λ(p : Types.PutStep) | ||
→ λ(h : Types.StepHooks Step) | ||
→ λ(S : Type) | ||
→ λ(c : StepConstructors S) | ||
→ c.put (p ⫽ { tags = mergeTags p.tags tags }) (translateHooks S c h) | ||
|
||
let addTagsToTask | ||
: List Text → Types.TaskStep → Types.StepHooks Step → Step | ||
= λ(tags : List Text) | ||
→ λ(t : Types.TaskStep) | ||
→ λ(h : Types.StepHooks Step) | ||
→ λ(S : Type) | ||
→ λ(c : StepConstructors S) | ||
→ c.task (t ⫽ { tags = mergeTags t.tags tags }) (translateHooks S c h) | ||
|
||
|
||
let addTagsToStep | ||
: List Text → Step → Step | ||
= λ(tags : List Text) | ||
→ λ(s : Step) | ||
→ s | ||
Step | ||
{ get = addTagsToGet tags | ||
, put = addTagsToPut tags | ||
, task = addTagsToTask tags | ||
, aggregate = ./aggregateWithHooks.dhall | ||
, do = ./doWithHooks.dhall | ||
, try = ./tryWithHooks.dhall | ||
, in_parallel = ./inParallelWithHooks.dhall | ||
} | ||
|
||
let addTags | ||
: List Text → List Types.Job → List Types.Job | ||
= λ(tags : List Text) | ||
→ Prelude.List.map | ||
Types.Job | ||
Types.Job | ||
( λ(j : Types.Job) | ||
→ j | ||
⫽ { plan = Prelude.List.map Step Step (addTagsToStep tags) j.plan | ||
} | ||
) | ||
|
||
in addTags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,11 @@ | ||
let Types = ../types/package.dhall | ||
|
||
let Prelude = ../lib/prelude.dhall | ||
|
||
in ( λ(steps : List Types.Step) | ||
→ λ(hooks : Types.StepHooks Types.Step) | ||
→ λ(Step : Type) | ||
→ λ(constructors : Types.StepConstructors Step) | ||
→ let stepTypeFix = | ||
Prelude.List.map | ||
Types.Step | ||
Step | ||
(λ(s : Types.Step) → s Step constructors) | ||
steps | ||
|
||
in constructors.aggregate | ||
stepTypeFix | ||
(./translateHooks.dhall hooks Step constructors) | ||
→ constructors.aggregate | ||
(./translateSteps.dhall Step constructors steps) | ||
(./translateHooks.dhall Step constructors hooks) | ||
) | ||
: List Types.Step → Types.StepHooks Types.Step → Types.Step |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,13 @@ | ||
let Types = ../types/package.dhall | ||
|
||
let Prelude = ../lib/prelude.dhall | ||
|
||
let doStep | ||
: List Types.Step → Types.StepHooks Types.Step → Types.Step | ||
= λ(steps : List Types.Step) | ||
→ λ(hooks : Types.StepHooks Types.Step) | ||
→ λ(Step : Type) | ||
→ λ(constructors : Types.StepConstructors Step) | ||
→ let stepTypeFix = | ||
Prelude.List.map | ||
Types.Step | ||
Step | ||
(λ(s : Types.Step) → s Step constructors) | ||
steps | ||
|
||
in constructors.do | ||
stepTypeFix | ||
(./translateHooks.dhall hooks Step constructors) | ||
→ constructors.do | ||
(./translateSteps.dhall Step constructors steps) | ||
(./translateHooks.dhall Step constructors hooks) | ||
|
||
in doStep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,13 @@ | ||
let Types = ../types/package.dhall | ||
|
||
let Prelude = ../lib/prelude.dhall | ||
|
||
let typeFixSteps | ||
: ∀(T : Type) → Types.StepConstructors T → List Types.Step → List T | ||
= λ(T : Type) | ||
→ λ(constructors : Types.StepConstructors T) | ||
→ Prelude.List.map Types.Step T (λ(s : Types.Step) → s T constructors) | ||
|
||
let typeFix | ||
: ∀(T : Type) | ||
→ Types.StepConstructors T | ||
→ Types.InParallelStep Types.Step | ||
→ Types.InParallelStep T | ||
= λ(T : Type) | ||
→ λ(constructors : Types.StepConstructors T) | ||
→ λ(parallel : Types.InParallelStep Types.Step) | ||
→ merge | ||
{ Steps = | ||
λ(s : List Types.Step) | ||
→ (Types.InParallelStep T).Steps (typeFixSteps T constructors s) | ||
, Config = | ||
λ(cfg : Types.InParallelConfig Types.Step) | ||
→ (Types.InParallelStep T).Config | ||
(cfg ⫽ { steps = typeFixSteps T constructors cfg.steps }) | ||
} | ||
parallel | ||
|
||
let inParallelWithHooks | ||
: Types.InParallelStep Types.Step → Types.StepHooks Types.Step → Types.Step | ||
= λ(parallelSteps : Types.InParallelStep Types.Step) | ||
→ λ(hooks : Types.StepHooks Types.Step) | ||
→ λ(Step : Type) | ||
→ λ(constructors : Types.StepConstructors Step) | ||
→ let stepTypeFix = typeFix Step constructors parallelSteps | ||
|
||
in constructors.in_parallel | ||
stepTypeFix | ||
(./translateHooks.dhall hooks Step constructors) | ||
→ constructors.in_parallel | ||
(./translateInParallelStep.dhall Step constructors parallelSteps) | ||
(./translateHooks.dhall Step constructors hooks) | ||
|
||
in inParallelWithHooks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
let Types = ../types/package.dhall | ||
|
||
let translateInParallelStep | ||
: ∀(T : Type) | ||
→ Types.StepConstructors T | ||
→ Types.InParallelStep Types.Step | ||
→ Types.InParallelStep T | ||
= λ(T : Type) | ||
→ λ(constructors : Types.StepConstructors T) | ||
→ λ(parallel : Types.InParallelStep Types.Step) | ||
→ merge | ||
{ Steps = | ||
λ(s : List Types.Step) | ||
→ (Types.InParallelStep T).Steps | ||
(./translateSteps.dhall T constructors s) | ||
, Config = | ||
λ(cfg : Types.InParallelConfig Types.Step) | ||
→ (Types.InParallelStep T).Config | ||
( cfg | ||
⫽ { steps = ./translateSteps.dhall T constructors cfg.steps | ||
} | ||
) | ||
} | ||
parallel | ||
|
||
in translateInParallelStep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
let Step = ../types/Step.dhall | ||
|
||
let StepConstructors = ../types/StepConstructors.dhall | ||
|
||
let Prelude = ../lib/prelude.dhall | ||
|
||
let translateSteps | ||
: ∀(S : Type) → StepConstructors S → List Step → List S | ||
= λ(S : Type) | ||
→ λ(c : StepConstructors S) | ||
→ Prelude.List.map Step S (λ(s : Step) → s S c) | ||
|
||
in translateSteps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters