From: Mart Lubbers Date: Fri, 21 Sep 2018 07:01:30 +0000 (+0200) Subject: runtasks X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=bcac28800fcf7a1da9f3a6dbb85bce08e991ae5b;p=clean-tests.git runtasks --- diff --git a/filepicker/prj b/filepicker/prj new file mode 100644 index 0000000..ff38448 --- /dev/null +++ b/filepicker/prj @@ -0,0 +1,3 @@ +[?25l[?25h[?1049h[?1h=[?25l"Clean System Files" is a directory~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ [?25h[?25l-- VISUAL --[?25h[?25l[?25h[?25l[?25h[?25l[?25h[?25l[?25h[?25l[?25h[?25l[?25h[?25lType :qa! and press to abandon all changes and exit Vim[?25h[?25l[?25h[?25l[?25h[?25l[?25h[?1l>[?1049lVim: Error reading input, exiting... +Vim: Finished. +[?25h6 files to edit diff --git a/filepicker/test.icl b/filepicker/test.icl index e3af2e6..a306d2c 100644 --- a/filepicker/test.icl +++ b/filepicker/test.icl @@ -1,57 +1,8 @@ module test -import StdFunctions -import System.Directory -import System.File -import System.FilePath -import Data.List -import Data.Functor -import Data.Tree -import qualified Control.Monad as CM -import Control.Applicative -import Control.Monad.Identity -import Control.Monad.State -import iTasks +import iTasks.Extensions.Files -derive class iTask RTree, FileInfo, Tm - -Start w = startEngine (selectFile "select a file" "/opt/clean") w - -selectFile :: !d !FilePath -> Task FilePath | toPrompt d -selectFile d root = accWorld (createDirectoryTree root (Just 1)) >>= \tree-> - withShared tree \stree->let numberedtree = mapRead numberTree stree in - withShared [] \ssel-> - editSharedSelectionWithShared d False selOpt numberedtree ssel - -|| whileUnchanged (ssel >*< numberedtree) (\(sel, tree)->case sel of - [i] = case find ((==)i o fst) (leafs tree) of - Just (i, (fp, Ok {directory=True})) - = accWorld (createDirectoryTree fp (Just 1)) - @ flip (mergeIn i) tree - >>= \newtree->set ([], newtree) (ssel >*< stree) @? const NoValue - _ = unstable () - _ = unstable () - ) - -|| viewSharedInformation "tree" [] (mapRead (drawRTree o fmap toSingleLineText) numberedtree) - @? tvHd - @ fst o snd -where - mergeIn j newtree = foldTree \(i, t) cs->if (i == j) newtree (RNode t cs) - - unstable a = treturn a @? \(Value a _)->Value a False - - selOpt :: SelectOption (RTree (Int, (FilePath, MaybeOSError FileInfo))) (Int, (FilePath, MaybeOSError FileInfo)) - selOpt = SelectInTree - (\tree->[{foldTree fp2cn tree & label=root}]) - (\tree sel->[t\\t=:(i, _)<-leafs tree | isMember i sel]) - - fp2cn (i, (fp, mfi)) cs = - { id = i - , label=dropDirectory fp - , icon=Nothing - , expanded=True - , children=cs - } - -numberTree :: ((RTree a) -> RTree (Int, a)) -numberTree = flip evalState zero o foldTree \a cs-> - (\lvs i->RNode (i, a) lvs) <$> 'CM'.sequence cs <*> getState <* modify inc +Start w = startEngine ( + selectFileTreeLazy "select a file" False "/opt/clean" + -&&- selectFileTree False "select a file" False "/opt/clean"[] + >&> viewSharedInformation "selection" []) w diff --git a/filepickerbas/test.icl b/filepickerbas/test.icl new file mode 100644 index 0000000..c77ef2a --- /dev/null +++ b/filepickerbas/test.icl @@ -0,0 +1,6 @@ +module test + +import iTasks +import iTasks.Extensions.FileDialog + +Start w = startEngine (editFilePath "bork" (Action "Ok") (Just "/opt/clean")) w diff --git a/runtasks/test.dcl b/runtasks/test.dcl new file mode 100644 index 0000000..a102fe3 --- /dev/null +++ b/runtasks/test.dcl @@ -0,0 +1,6 @@ +definition module test + +class c c +where + m1 :: c + m2 :: c diff --git a/runtasks/test.icl b/runtasks/test.icl new file mode 100644 index 0000000..e84c95e --- /dev/null +++ b/runtasks/test.icl @@ -0,0 +1,7 @@ +implementation module test + +class c c +where + m1 :: c + +Start = 42