X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=test.icl;h=822f41d96f79c20b12a4020c848454a937724434;hb=7db58a8b1702130a00cce2a957730e96cf477b77;hp=600f4d6e84ec511c98c7acb7677a00778c04f486;hpb=d039e976dcfebdd914caaa64e0f83143a65644ca;p=clean-tests.git diff --git a/test.icl b/test.icl index 600f4d6..822f41d 100644 --- a/test.icl +++ b/test.icl @@ -1,57 +1,38 @@ module test -// -//import Data.Func, StdFunctions, iTasks -// -//derive gDefault ChoiceNode -// -//Start w = flip doTasks w $ -// withShared 5 \sharedInt-> -// withShared [] \sharedSel-> -// (editSharedSelectionWithShared -// [SelectInTree -// (\l->[{defaultValue & id=i,label=toString i}\\i<-[0..l]]) -// (\_ s->s) -// ] sharedInt sharedSel <<@ Title "Selection" <<@ multipleAttr False) -// -|| (updateSharedInformation [] sharedInt <<@ Title "Number of items") -// -|| (updateSharedInformation [] sharedSel <<@ Title "Current selection") -// >&> \sh->(viewSharedInformation [] (mapRead toSingleLineText sh) <<@ Title "Current task value" ) -// -//from Data.Map import singleton -//import Data.Map.GenJSON -//import iTasks -// -//Start w = doTasks t w -// -//t :: Task [(Int, TaskValue Int)] -//t = parallel -// [(Embedded, \stl-> -// appendTask Embedded (\_->viewInformation [] 42) stl -// >>! \i->set (singleton "focus" (JSONBool True)) (sdsFocus i (taskListEntryMeta stl)) -// >>~ \_->viewSharedInformation [] -// (sdsFocus {onlyIndex=Nothing,onlyTaskId=Nothing,onlySelf=False,includeValue=True,includeProgress=True,includeAttributes=True} stl) -// @! 42 -// )] [] - -//import iTasks -//Start w = doTasks t w -//where -// t = viewInformation [ViewUsing id progressBar] (Just 80, Just long) <<@ Title "bork" -// long = "borkueaohutenhuaostuehasunethuaosnuhtesuhaotsuehtausneohtusoauhtesauhtesnuhtasuhetauhosunehtoauesnhtaueshautesnhutaonsuhetaonsuhetansuhetansuhetaosnuehtaosnuhetaosunhaoetsunehatounsoehtasunhteunaoshuteoasnuhteaosuhnaoetsnuheotasunehotasunhetusnahotueaou" - - -import iTasks - -:: R = { x :: !String, y :: !String } -derive class iTask R - -Start w = doTasks (t -&&- u) w - -t = updateSharedInformation - [ UpdateSharedAs - (\r -> r.x) - (\r x -> {r & x=x}) - const - ] s -u = updateSharedInformation [] s - -s = sharedStore "x" {x="",y=""} + +import StdEnv +import Data.Maybe +import Data.Functor +import Control.Monad +import Control.Applicative + +class expr v where + lit :: i -> v i | toString i + (+.) infixl 6 :: (v i) (v i) -> v i | + i + +instance + (v a) | expr v & + a where + + l r = l +. r + +eval :: (Maybe a) -> Maybe a +eval x = x +instance expr Maybe where + lit i = Just i + +. x y = (+) <$> x <*> y + +:: Print a =: Print String +print :: (Print a) -> String +print (Print a) = a +instance expr Print where + lit i = Print (toString i) + +. (Print l) (Print r) = Print (l +++ "+" +++ r) + +printEval :: (A.v: v a | expr v) -> (Maybe a, String) +//printEval f = (f, let (Print p) = f in p) +printEval f = (eval f, print f) + +//Mag niet +//Start :: (Maybe Int, String) +//Start = printEval (lit 4 + lit 38) + +//Mag wel +Start = let (Print f) = lit 4 + lit 38 in f