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
b699bad8
Commit
b699bad8
authored
Jun 07, 2019
by
Tim Steenvoorden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swap and rename things
parent
e863d37f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
52 deletions
+35
-52
Examples/DynamicEditor/DynEditorExample.icl
Examples/DynamicEditor/DynEditorExample.icl
+35
-52
No files found.
Examples/DynamicEditor/DynEditorExample.icl
View file @
b699bad8
...
...
@@ -34,17 +34,15 @@ where
::
TaskConstExpr
=
Apply
TaskFuncExpr
Expr
|
EnterInformation
String
Ty
|
Bind
TaskConstExpr
TaskFuncExpr
|
Blind
TaskConstExpr
TaskConstExpr
|
EnterInfo
String
Ty
|
Then
TaskConstExpr
TaskFuncExpr
|
Or
TaskConstExpr
TaskConstExpr
|
And
TaskConstExpr
TaskConstExpr
|
When
TaskConstExpr
(
List
(
FunExpr
,
String
,
TaskFuncExpr
))
::
TaskFuncExpr
=
ViewInformation
String
|
UpdateInformation
String
|
Return
=
ViewInfo
String
|
UpdateInfo
String
::
Expr
=
Int
Int
...
...
@@ -95,44 +93,37 @@ where
$
functionConsDyn
"TaskConstExpr"
"(enter task)"
(
dynamic
\(
Typed
taskExpr
)
->
taskExpr
::
A
.
a
:
(
Typed
TaskConstExpr
a
)
->
TaskConstExpr
)
<<@@@
HideIfOnlyChoice
,
DynamicConsGroup
"Combinators"
[
functionConsDyn
"
Bind"
">>=
"
[
functionConsDyn
"
Then"
"sequence
"
(
dynamic
\(
Typed
task
)
(
Typed
taskFunc
)
->
Typed
(
Bind
task
taskFunc
)
::
Typed
(
Then
task
taskFunc
)
::
A
.
a
b
:
(
Typed
TaskConstExpr
(
Task
a
))
(
Typed
TaskFuncExpr
(
a
->
Task
b
))
->
Typed
TaskConstExpr
(
Task
b
)
)
,
functionConsDyn
"
Blind"
">>|
"
(
dynamic
\(
Typed
task1
)
(
Typed
task2
)
->
Typed
(
Blind
task1
task2
)
::
,
functionConsDyn
"
When"
"when
"
(
dynamic
\(
Typed
task1
)
(
Typed
steps
)
->
Typed
(
When
task1
[(
expr
,
pred
,
tfExpr
)
\\
(
Typed
expr
,
pred
,
Typed
tfExpr
)
<-
steps
]
)
::
A
.
a
b
:
(
Typed
TaskConstExpr
(
Task
a
))
(
Typed
TaskConstExpr
(
Task
b
))
(
Typed
TaskConstExpr
(
Task
a
))
(
Typed
(
List
(
Typed
FunExpr
(
a
->
Bool
),
String
,
Typed
TaskFuncExpr
(
a
->
Task
a
)))
(
a
->
Task
b
))
->
Typed
TaskConstExpr
(
Task
b
)
)
,
functionConsDyn
"Or"
"-||-"
<<@@@
applyHorizontalClasses
,
functionConsDyn
"Or"
"or"
(
dynamic
\(
Typed
task1
)
(
Typed
task2
)
->
Typed
(
Or
task1
task2
)
::
A
.
a
b
:
(
Typed
TaskConstExpr
(
Task
a
))
(
Typed
TaskConstExpr
(
Task
a
))
->
Typed
TaskConstExpr
(
Task
a
)
)
,
functionConsDyn
"And"
"
-&&-
"
,
functionConsDyn
"And"
"
and
"
(
dynamic
\(
Typed
task1
)
(
Typed
task2
)
->
Typed
(
And
task1
task2
)
::
A
.
a
b
:
(
Typed
TaskConstExpr
(
Task
a
))
(
Typed
TaskConstExpr
(
Task
b
))
->
Typed
TaskConstExpr
(
Task
(
a
,
b
))
)
,
functionConsDyn
"When"
"when"
(
dynamic
\(
Typed
task1
)
(
Typed
steps
)
->
Typed
(
When
task1
[(
expr
,
pred
,
tfExpr
)
\\
(
Typed
expr
,
pred
,
Typed
tfExpr
)
<-
steps
])
::
A
.
a
b
:
(
Typed
TaskConstExpr
(
Task
a
))
(
Typed
(
List
(
Typed
FunExpr
(
a
->
Bool
),
String
,
Typed
TaskFuncExpr
(
a
->
Task
a
)))
(
a
->
Task
b
))
->
Typed
TaskConstExpr
(
Task
b
)
)
<<@@@
applyHorizontalClasses
,
listConsDyn
"[(FunExpr, String, TaskFuncExpr)]"
"[(FunExpr, String, TaskFuncExpr)]"
,
listConsDyn
"List (FunExpr, String, TaskFuncExpr)"
"List (FunExpr, String, TaskFuncExpr)"
(
dynamic
\
typedSteps
->
Typed
((\(
Typed
expr
)
->
expr
)
<$>
typedSteps
)
::
A
.
a
b
:
...
...
@@ -161,35 +152,30 @@ where
(
Typed
Expr
a
)
->
Typed
TaskConstExpr
(
Task
b
)
)
,
functionConsDyn
"EnterInfo
rmation
"
"enter information"
,
functionConsDyn
"EnterInfo"
"enter information"
(
dynamic
\
s
(
Typed
ty
)
->
Typed
(
EnterInfo
rmation
s
ty
)
::
Typed
(
EnterInfo
s
ty
)
::
A
.
a
:
String
(
Typed
Ty
a
)
->
Typed
TaskConstExpr
(
Task
a
)
)
<<@@@
applyHorizontalClasses
,
functionConsDyn
"ViewInfo
rmation
"
"view information"
,
functionConsDyn
"ViewInfo"
"view information"
(
dynamic
\
s
->
Typed
(
ViewInfo
rmation
s
)
::
Typed
(
ViewInfo
s
)
::
A
.
a
:
String
->
Typed
TaskFuncExpr
(
a
->
Task
a
)
)
<<@@@
applyHorizontalClasses
,
functionConsDyn
"UpdateInfo
rmation
"
"update information"
,
functionConsDyn
"UpdateInfo"
"update information"
(
dynamic
\
s
->
Typed
(
UpdateInfo
rmation
s
)
::
Typed
(
UpdateInfo
s
)
::
A
.
a
:
String
->
Typed
TaskFuncExpr
(
a
->
Task
a
)
)
<<@@@
applyHorizontalClasses
,
functionConsDyn
"Return"
"return"
(
dynamic
Typed
Return
::
A
.
a
:
Typed
TaskFuncExpr
(
a
->
Task
a
)
)
]
// ordinary (non-task) expressions
,
DynamicCons
...
...
@@ -266,10 +252,9 @@ applyHorizontalClasses = ApplyCssClasses ["itasks-horizontal", "itasks-wrap-widt
evalTaskConstExpr
::
TaskConstExpr
->
Task
Value
evalTaskConstExpr
(
EnterInfo
rmation
prompt
(
Ty
toValue
))
=
enterInformation
prompt
[]
@
toValue
evalTaskConstExpr
(
EnterInfo
prompt
(
Ty
toValue
))
=
enterInformation
prompt
[]
@
toValue
evalTaskConstExpr
(
Apply
taskFunc
expr
)
=
evalTaskFuncExpr
taskFunc
$
evalExpr
expr
evalTaskConstExpr
(
Bind
task
taskFunc
)
=
evalTaskConstExpr
task
>>=
evalTaskFuncExpr
taskFunc
evalTaskConstExpr
(
Blind
task1
task2
)
=
evalTaskConstExpr
task1
>>|
evalTaskConstExpr
task2
evalTaskConstExpr
(
Then
task
taskFunc
)
=
evalTaskConstExpr
task
>>=
evalTaskFuncExpr
taskFunc
evalTaskConstExpr
(
Or
task1
task2
)
=
evalTaskConstExpr
task1
-||-
evalTaskConstExpr
task2
evalTaskConstExpr
(
And
task1
task2
)
=
evalTaskConstExpr
task1
-&&-
evalTaskConstExpr
task2
@
\(
a
,
b
)
->
VTuple
a
b
evalTaskConstExpr
(
When
task1
options
)
=
evalTaskConstExpr
task1
...
...
@@ -291,30 +276,28 @@ where
evalTaskFuncExpr
::
TaskFuncExpr
Value
->
Task
Value
evalTaskFuncExpr
(
ViewInfo
rmation
p
)
(
VInt
i
)
=
(
viewInformation
p
[]
i
@
VInt
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
ViewInfo
rmation
p
)
(
VBool
b
)
=
(
viewInformation
p
[]
b
@
VBool
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
ViewInfo
rmation
p
)
(
VString
s
)
=
(
viewInformation
p
[]
s
@
VString
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
ViewInfo
rmation
p
)
(
VTuple
a
b
)
=
evalTaskFuncExpr
(
ViewInfo
p
)
(
VInt
i
)
=
(
viewInformation
p
[]
i
@
VInt
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
ViewInfo
p
)
(
VBool
b
)
=
(
viewInformation
p
[]
b
@
VBool
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
ViewInfo
p
)
(
VString
s
)
=
(
viewInformation
p
[]
s
@
VString
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
ViewInfo
p
)
(
VTuple
a
b
)
=
(
viewInformation
p
[]
()
||-
evalTaskFuncExpr
(
ViewInfo
rmation
""
)
a
-&&-
evalTaskFuncExpr
(
ViewInfo
rmation
""
)
b
||-
evalTaskFuncExpr
(
ViewInfo
""
)
a
-&&-
evalTaskFuncExpr
(
ViewInfo
""
)
b
@
\(
a
,
b
)
->
VTuple
a
b
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
UpdateInfo
rmation
p
)
(
VInt
i
)
=
(
updateInformation
p
[]
i
@
VInt
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
UpdateInfo
rmation
p
)
(
VBool
b
)
=
(
updateInformation
p
[]
b
@
VBool
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
UpdateInfo
rmation
p
)
(
VString
s
)
=
(
updateInformation
p
[]
s
@
VString
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
UpdateInfo
rmation
p
)
(
VTuple
a
b
)
=
evalTaskFuncExpr
(
UpdateInfo
p
)
(
VInt
i
)
=
(
updateInformation
p
[]
i
@
VInt
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
UpdateInfo
p
)
(
VBool
b
)
=
(
updateInformation
p
[]
b
@
VBool
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
UpdateInfo
p
)
(
VString
s
)
=
(
updateInformation
p
[]
s
@
VString
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
(
UpdateInfo
p
)
(
VTuple
a
b
)
=
(
viewInformation
p
[]
()
||-
evalTaskFuncExpr
(
UpdateInfo
rmation
""
)
a
-&&-
evalTaskFuncExpr
(
UpdateInfo
rmation
""
)
b
||-
evalTaskFuncExpr
(
UpdateInfo
""
)
a
-&&-
evalTaskFuncExpr
(
UpdateInfo
""
)
b
@
\(
a
,
b
)
->
VTuple
a
b
)
<<@
ApplyLayout
arrangeHorizontal
evalTaskFuncExpr
Return
value
=
return
value
evalExpr
::
Expr
->
Value
evalExpr
(
Int
i
)
=
VInt
i
...
...
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