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
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
4bde014f
Commit
4bde014f
authored
May 22, 2019
by
Steffen Michels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add enterInformation with user specified type
parent
70f53b74
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
4 deletions
+28
-4
Examples/DynamicEditor/DynEditorExample.icl
Examples/DynamicEditor/DynEditorExample.icl
+28
-4
No files found.
Examples/DynamicEditor/DynEditorExample.icl
View file @
4bde014f
...
...
@@ -11,15 +11,23 @@ editTask =
enterInformation
()
[
EnterUsing
id
$
dynamicEditor
taskEditor
]
>>=
evalTaskConstExpr
o
toValue
taskEditor
::
TaskConstExpr
=
Apply
TaskFuncExpr
Expr
::
TaskConstExpr
=
Apply
TaskFuncExpr
Expr
|
EnterInformation
Type
::
TaskFuncExpr
=
ViewInformation
::
Expr
=
Int
Int
|
Bool
Bool
|
Tuple
Expr
Expr
|
Fst
Expr
|
Snd
Expr
|
Eq
Expr
Expr
::
Value
=
VInt
Int
|
VBool
Bool
|
VTuple
Value
Value
::
Typed
a
b
=:
Typed
a
::
Type
=
E
.
a
:
Type
(
a
->
Value
)
&
iTask
a
::
Typed
a
b
=:
Typed
a
derive
class
iTask
TaskConstExpr
,
TaskFuncExpr
,
Expr
,
Value
,
Typed
// instances are never used
gDefault
{|
Type
|}
=
undef
gEq
{|
Type
|}
_
_
=
undef
JSONEncode
{|
Type
|}
_
_
=
undef
JSONDecode
{|
Type
|}
_
_
=
undef
gText
{|
Type
|}
_
_
=
undef
gEditor
{|
Type
|}
=
undef
taskEditor
::
DynamicEditor
x
|
TC
x
taskEditor
=
DynamicEditor
conses
where
...
...
@@ -36,9 +44,14 @@ where
)
]
,
DynamicConsGroup
"Editors"
[
functionConsDyn
"ViewInformation"
"view information"
[
functionConsDyn
"EnterInformation"
"enter information"
(
dynamic
\(
Typed
type
)
->
Typed
(
EnterInformation
type
)
::
A
.
a
:
(
Typed
Type
a
)
->
Typed
TaskConstExpr
(
Task
a
)
)
,
functionConsDyn
"ViewInformation"
"view information"
(
dynamic
Typed
ViewInformation
::
A
.
a
:
Typed
TaskFuncExpr
(
a
->
Task
a
))
]
// ordinary (non-task) expressions
,
DynamicCons
$
functionConsDyn
"int"
"enter integer:"
(
dynamic
\
i
->
Typed
(
Int
i
)
::
Int
->
Typed
Expr
Int
)
,
DynamicCons
$
functionConsDyn
"bool"
"enter boolean:"
...
...
@@ -57,6 +70,16 @@ where
)
,
DynamicCons
$
customEditorCons
"Int"
"(enter integer)"
intEditor
<<@@@
HideIfOnlyChoice
,
DynamicCons
$
customEditorCons
"Bool"
"(enter boolean)"
boolEditor
<<@@@
HideIfOnlyChoice
// type specifications for enterInformation
,
DynamicCons
$
functionConsDyn
"Type.Int"
"Int"
(
dynamic
Typed
(
Type
VInt
)
::
Typed
Type
Int
)
,
DynamicCons
$
functionConsDyn
"Type.Bool"
"Bool"
(
dynamic
Typed
(
Type
VBool
)
::
Typed
Type
Bool
)
,
DynamicCons
$
functionConsDyn
"Type.Tuple"
"Tuple"
(
dynamic
\(
Typed
(
Type
toValue1
))
(
Typed
(
Type
toValue2
))
->
Typed
(
Type
\(
x
,
y
)
->
VTuple
(
toValue1
x
)
(
toValue2
y
))
::
A
.
a
b
:
(
Typed
Type
a
)
(
Typed
Type
b
)
->
Typed
Type
(
a
,
b
)
)
]
intEditor
::
Editor
Int
...
...
@@ -67,6 +90,7 @@ where
evalTaskConstExpr
::
TaskConstExpr
->
Task
Value
evalTaskConstExpr
(
Apply
taskFunc
expr
)
=
evalTaskFuncExpr
taskFunc
$
evalExpr
expr
evalTaskConstExpr
(
EnterInformation
(
Type
toValue
))
=
enterInformation
()
[]
@
toValue
evalTaskFuncExpr
::
TaskFuncExpr
Value
->
Task
Value
evalTaskFuncExpr
ViewInformation
value
=
viewInformation
()
[]
value
...
...
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