summaryrefslogtreecommitdiff
path: root/assignment-8/skeleton8.icl
diff options
context:
space:
mode:
Diffstat (limited to 'assignment-8/skeleton8.icl')
-rw-r--r--assignment-8/skeleton8.icl19
1 files changed, 13 insertions, 6 deletions
diff --git a/assignment-8/skeleton8.icl b/assignment-8/skeleton8.icl
index 613a057..ed8e447 100644
--- a/assignment-8/skeleton8.icl
+++ b/assignment-8/skeleton8.icl
@@ -7,7 +7,7 @@ module skeleton8
import StdBool
import StdEnum
-from StdFunc import flip, o
+from StdFunc import const, flip, id, o
import StdList
import StdString
import StdTuple
@@ -33,10 +33,11 @@ from iTasks import
generic gEq, generic gDefault, generic JSONDecode, generic JSONEncode,
generic gText, generic gEditor,
:: JSONNode, :: TextFormat, :: Editor, :: Task,
- :: ViewOption(..), :: UpdateOption, :: EnterOption,
+ :: ViewOption(..), :: UpdateOption(..), :: EnterOption(..),
:: Title(Title), instance toPrompt Title,
- class tune, <<@, :: UIAttributes, instance tune ArrangeHorizontal Task,
- :: ArrangeHorizontal(..),
+ class tune, <<@, :: UIAttributes, instance tune UIAttributes Editor,
+ instance tune ArrangeHorizontal Task,
+ :: ArrangeHorizontal(..), directionAttr, :: UIDirection(..),
updateInformation, viewInformation, enterInformation, @, -||, startEngine
import qualified iTasks
@@ -234,7 +235,7 @@ derive class iTask Expression, Logical, Stmt, Val, Result
simulate :: Stmt -> Task Stmt
simulate stmt =
- updateInformation (Title "Program") [] stmt
+ updateInformation (Title "Program") [UpdateUsing id const stmtEditor] stmt
-|| 'iTasks'.allTasks
[ viewInformation (Title "String representation") [ViewAs printToString] stmt
, viewInformation (Title "Type") [ViewAs showtype] stmt
@@ -244,6 +245,12 @@ where
execute = fmap (appSnd 'Map'.toList) o flip runStateT 'Map'.newMap o evalS
showtype = fmap fst o flip runStateT 'Map'.newMap o type
+// NB: I want the input fields to be put vertically but don't see how that is
+// possible; neither this nor this with Vertical nor
+// <<@ Arrange{Horizontal,Vertical} on the task works.
+stmtEditor :: Editor Stmt
+stmtEditor = gEditor{|*|} <<@ directionAttr Horizontal
+
// === type checking
:: Type
@@ -347,7 +354,7 @@ where (result,type) = test stm
Start _ = quietnm 100000 20 aStream check
*/
-Start w = startEngine (enterInformation (Title "Program") [] >>>= sim) w
+Start w = startEngine (enterInformation (Title "Program") [EnterUsing id stmtEditor] >>>= sim) w
where
sim :: Stmt -> Task Stmt
sim st = simulate st >>>= sim