From: Mart Lubbers Date: Sun, 8 Nov 2015 12:02:25 +0000 (+0100) Subject: start met iTask X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=866a4077b5d26a1ac6f62e9dc9cf2c8e7989a75e;p=ap2015.git start met iTask --- diff --git a/a7/mart/skeleton7.icl b/a7/mart/skeleton7.icl index 5281d10..2aedd83 100644 --- a/a7/mart/skeleton7.icl +++ b/a7/mart/skeleton7.icl @@ -4,7 +4,7 @@ from iTasks import always, hasValue, :: TaskValue(..), :: Task, :: Stability, :: TaskCont(..), :: Action, updateInformation, viewInformation, class descr, instance descr String, :: UpdateOption, :: ViewOption(..), - -||-, -||, ||-, startEngine, class Publishable, >>*, class TFunctor, + -||-, -||, ||- , startEngine, class Publishable, >>*, class TFunctor, instance TFunctor Task, class TApplicative, instance TApplicative Task, instance Publishable Task, Void import Data.Tuple, StdClass, StdList, iTasks._Framework.Generic, Text.JSON, @@ -16,7 +16,7 @@ import StdTuple from Text import class Text, instance Text String from StdFunc import o -e = Insert New (Oper New +. (Union (Integer 7) (Size (Integer 9)))) +e = New :: Expression = New @@ -141,7 +141,16 @@ ActionOk :== 'iTasks'.ActionOk ActionQuit :== 'iTasks'.ActionQuit ActionNew :== 'iTasks'.ActionNew -mainTask = viewInformation (print e) +expressionLens :: Expression -> String +expressionLens e = case evalExpr e newMap of + (Left s) = "Error: " +++ s + (Right (Set s)) = "{" +++ ('Text'.join ", " (map toString s)) +++ "}" + (Right (Int i)) = toString i + +mainTask = updateInformation "Expression enter" [] e + >>* [OnAction ActionOk (hasValue (viewInformation "Expression view" [ViewWith expressionLens]))] + +derive class iTask Expression, Op, Val Start :: *World -> *World Start world = startEngine mainTask world