X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=test.icl;h=822f41d96f79c20b12a4020c848454a937724434;hb=0140429ff1785b6ff033813fe4d4c7cdb018e5a9;hp=2076421b57b65c92f0b2149d5e626c1d337390d0;hpb=dfcca36a36a964320436b622d18bce909ed5a9fc;p=clean-tests.git diff --git a/test.icl b/test.icl index 2076421..822f41d 100644 --- a/test.icl +++ b/test.icl @@ -1,45 +1,38 @@ module test -<<<<<<< HEAD import StdEnv -from Data.Func import $ -import System.Directory -import System.Time - -:: S s a = S .(s -> *(a, s)) -runS (S s) = s - -(>>=) infixl 1 :: u:(S .a .b) v:(.b -> .(S .a .c)) -> w:(S .a .c), [w <= u,w <= v] -(>>=) ma a2mb = S \s - # (a, s) = runS ma s - = runS (a2mb a) s - -Start world = flip runS world - $ (S time) - >>= \_->S (readDirectory "/home/mrl") -======= -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 ()))] ->>>>>>> 49f7dcc4c088dc816398a0c7854d75d7c2628f15 +//Mag wel +Start = let (Print f) = lit 4 + lit 38 in f