cloud
[clean-tests.git] / test.icl
index 609d79e..822f41d 100644 (file)
--- 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