X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=test.icl;h=822f41d96f79c20b12a4020c848454a937724434;hb=7db58a8b1702130a00cce2a957730e96cf477b77;hp=609d79ef5c8c2e360b30f2b5d05b968e821959ff;hpb=49f7dcc4c088dc816398a0c7854d75d7c2628f15;p=clean-tests.git diff --git a/test.icl b/test.icl index 609d79e..822f41d 100644 --- a/test.icl +++ b/test.icl @@ -1,25 +1,38 @@ module test -import qualified Data.Map as DM -import iTasks -import Data.Func -import Data.Tuple + 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) -Start w = doTasksWithOptions (\a o->Ok $ flip tuple {o & autoLayout=True} $ - (parallel - [(Embedded, tab "tab1") - ,(Embedded, tab "tab2") - ] - [ OnAction (Action "New") (always (Embedded, tab "New tab")) - , OnAction (Action " ") (always (Embedded, tab "New tab")) - , OnAction (Action "Close") (never (Embedded, \_->treturn ())) - , OnAction (Action "Dis no icon") (never (Embedded, \_->treturn ())) - , OnAction (Action "+") (always (Embedded, tab "New tab")) - ] - <<@ ArrangeWithTabs True - <<@ ApplyLayout (setActionIcon ('DM'.put " " "new" 'DM'.newMap)) - )) w - -tab title _ = tune (Title title) - $ viewInformation [] () - >>* [OnAction (Action "Close") (always (treturn ()))] +//Mag wel +Start = let (Print f) = lit 4 + lit 38 in f