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
74
Issues
74
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
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
b2189b57
Commit
b2189b57
authored
Jun 11, 2019
by
Tim Steenvoorden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conveniently name buttons
parent
89409ebb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
Examples/DynamicEditor/DynEditorExample.icl
Examples/DynamicEditor/DynEditorExample.icl
+24
-15
No files found.
Examples/DynamicEditor/DynEditorExample.icl
View file @
b2189b57
...
...
@@ -3,29 +3,38 @@ module DynEditorExample
import
StdEnv
import
Data
.
Func
import
Data
.
Functor
import
Text
import
iTasks
import
iTasks
.
Extensions
.
Editors
.
DynamicEditor
//
Synonyms
////////////////////////////////////////////////////////////////////
//
Helpers /
////////////////////////////////////////////////////////////////////
::
List
a
:==
[
a
]
::
Message
:==
String
::
Button
:==
String
always
x
:==
const
True
x
(>?>)
infixl
1
::
(
Task
a
)
(
List
(
Button
,
a
->
Bool
,
a
->
Task
b
))
->
Task
b
|
iTask
a
&
iTask
b
(>?>)
task
options
=
task
>>*
map
trans
options
where
trans
(
a
,
p
,
t
)
=
OnAction
(
Action
a
)
(
ifValue
p
t
)
// Main ////////////////////////////////////////////////////////////////////////
Start
world
=
doTasks
(
editTask
Nothing
)
world
editTask
::
(
Maybe
(
DynamicEditorValue
TaskExpr
))
->
Task
(
Maybe
(
DynamicEditorValue
TaskExpr
))
editTask
mv
=
enterOrUpdate
(
"Contruct a task"
,
info1
)
mv
>>=
\
v
->
viewInformation
(
"Evaluate the task"
,
info2
)
[]
()
||-
(
evalTaskConstExpr
(
toValue
taskEditor
v
)
<<@
ApplyLayout
frameCompact
)
>>=
viewInformation
(
"Done!"
,
info3
)
[]
>>=
return
>>|
editTask
(
Just
v
)
Start
world
=
doTasks
(
editTaskExpr
Nothing
)
world
editTaskExpr
::
(
Maybe
(
DynamicEditorValue
TaskExpr
))
->
Task
(
Maybe
(
DynamicEditorValue
TaskExpr
))
editTaskExpr
mv
=
enterOrUpdateExpr
(
"Contruct a task"
,
info1
)
mv
>?>
[
(
"Run"
,
always
,
\
v
->
viewInformation
(
"Evaluate the task"
,
info2
)
[]
()
||-
(
evalTaskConstExpr
(
toValue
taskEditor
v
)
<<@
ApplyLayout
frameCompact
)
>?>
[
(
"Finish"
,
always
,
\
r
->
viewInformation
(
"Done!"
,
info3
)
[]
r
>?>
[
(
"Back"
,
always
,
\_
->
editTaskExpr
(
Just
v
)
)
]
)
]
)
]
where
info1
::
String
info1
=
"Select the editors and combinators you'd like to use. When you're ready, push the 'Continue' button below to run your program."
...
...
@@ -34,8 +43,8 @@ where
info3
::
String
info3
=
"The program is done, the result is given below."
enterOrUpdate
msg
Nothing
=
enterInformation
msg
[
EnterUsing
id
$
dynamicEditor
taskEditor
]
enterOrUpdate
msg
(
Just
v
)
=
updateInformation
msg
[
UpdateUsing
id
(
curry
fst
)
(
dynamicEditor
taskEditor
)]
v
enterOrUpdate
Expr
msg
Nothing
=
enterInformation
msg
[
EnterUsing
id
$
dynamicEditor
taskEditor
]
enterOrUpdate
Expr
msg
(
Just
v
)
=
updateInformation
msg
[
UpdateUsing
id
(
curry
fst
)
(
dynamicEditor
taskEditor
)]
v
// Data ////////////////////////////////////////////////////////////////////////
...
...
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