Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
iTasks-SDK
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
73
Issues
73
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
iTasks-SDK
Commits
f6040c46
Commit
f6040c46
authored
Jul 16, 2018
by
Mart Lubbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify transform so it can create an exception
parent
e3abfac7
Pipeline
#12941
passed with stage
in 3 minutes and 47 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
Libraries/iTasks/WF/Combinators/Core.dcl
Libraries/iTasks/WF/Combinators/Core.dcl
+16
-2
Libraries/iTasks/WF/Combinators/Core.icl
Libraries/iTasks/WF/Combinators/Core.icl
+5
-4
No files found.
Libraries/iTasks/WF/Combinators/Core.dcl
View file @
f6040c46
...
...
@@ -4,6 +4,7 @@ definition module iTasks.WF.Combinators.Core
*/
import
iTasks
.
WF
.
Definition
from
iTasks
.
SDS
.
Definition
import
::
SDS
from
Data
.
Error
import
::
MaybeError
(
Ok
)
from
Data
.
Maybe
import
::
Maybe
//* Next task actions
...
...
@@ -78,16 +79,29 @@ ActionClose :== Action "Close"
derive
class
iTask
AttachException
instance
toString
AttachException
/**
* Adds a result transformation function to a task.
* The resulting task is still considered a single step in the workflow.
*
* @param Function: The transformation function.
* @param Task: The task to which the transformation function is added
*
* @return The transformed task
*/
transformError
::
((
TaskValue
a
)
->
MaybeError
TaskException
(
TaskValue
b
))
!(
Task
a
)
->
Task
b
/**
* Adds a result transformation function to a task.
* The resulting task is still considered a single step in the workflow.
*
* @param Function: The transformation function.
It works on maybe's to also map over instable tasks.
* @param Function: The transformation function.
* @param Task: The task to which the transformation function is added
*
* @return The transformed task
* @type ((TaskValue a) -> TaskValue b) !(Task a) -> Task b
*/
transform
::
((
TaskValue
a
)
->
TaskValue
b
)
!(
Task
a
)
->
Task
b
transform
f
:==
transformError
(\
tv
->
Ok
(
f
tv
))
/**
* The generic sequential combinator.
...
...
Libraries/iTasks/WF/Combinators/Core.icl
View file @
f6040c46
...
...
@@ -72,12 +72,13 @@ where
derive
class
iTask
AttachException
transform
::
((
TaskValue
a
)
->
TaskValue
b
)
!(
Task
a
)
->
Task
b
transform
f
(
Task
evala
)
=
Task
eval
transform
Error
::
((
TaskValue
a
)
->
MaybeError
TaskException
(
TaskValue
b
)
)
!(
Task
a
)
->
Task
b
transform
Error
f
(
Task
evala
)
=
Task
eval
where
eval
event
evalOpts
tree
iworld
=
case
evala
event
evalOpts
tree
iworld
of
//TODO: guarantee stability
(
ValueResult
val
lastEvent
rep
tree
,
iworld
)
=
(
ValueResult
(
f
val
)
lastEvent
rep
tree
,
iworld
)
(
ValueResult
val
lastEvent
rep
tree
,
iworld
)
=
case
f
val
of
Error
e
=
(
ExceptionResult
e
,
iworld
)
Ok
v
=
(
ValueResult
v
lastEvent
rep
tree
,
iworld
)
(
ExceptionResult
e
,
iworld
)
=
(
ExceptionResult
e
,
iworld
)
(
DestroyedResult
,
iworld
)
=
(
DestroyedResult
,
iworld
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment