From: Mart Lubbers Date: Mon, 10 Sep 2018 13:53:22 +0000 (+0200) Subject: tests' X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=9428445d9b5c1c2ab83b98f3f41a0edd8f84dd71;p=clean-tests.git tests' _' ' --- diff --git a/filepicker/test.icl b/filepicker/test.icl index 4ae8838..bdf9d97 100644 --- a/filepicker/test.icl +++ b/filepicker/test.icl @@ -1,55 +1,8 @@ module test -from iTasks.UI.Editor.Controls import :: ChoiceNode{..} -import StdEnv -import Data.List -import Data.Func -import Data.Functor -import Data.Tuple -import Data.Tree -import Data.Maybe -import Data.Error -import Control.Applicative -import Control.Monad -import Control.Monad.State -import Control.Monad.Identity -import System.FilePath -import System.File -import System.Directory +import iTasks +import iTasks.Extensions.Files -import Text.GenPrint -import iTasks => qualified >>=, >>|, forever, sequence, return - -derive class iTask RTree, ChoiceNode, FileInfo, Tm - -Start w = startEngine (selectFile "/opt/clean/lib/StdLib" () False) w - -selectFile :: FilePath d Bool -> Task [FilePath] | toPrompt d -selectFile root p m = tbind - (accWorldOSError (appFst (fmap numberTree) o recurseDirectory root "")) - \tree->editSelection p m (SelectInTree (pure o toChoiceNode fp2cn) fromTree) tree [] -where - numberTree :: ((RTree a) -> RTree (Int, a)) - numberTree = flip evalState zero o foldTree \a cs-> - (\lvs i->RNode (i, a) lvs) <$> sequence cs <*> getState <* modify ((+)one) - - toChoiceNode :: (Int a -> ChoiceNode) -> ((RTree (Int, a)) -> ChoiceNode) - toChoiceNode tfun = foldTree \a cs->{ChoiceNode | uncurry tfun a & children=cs} - - fp2cn :: Int (FilePath, FileInfo) -> ChoiceNode - fp2cn i (fp, fi) = {id =if fi.directory (~i) i,label=dropDirectory fp,icon=Nothing,expanded=False,children=[]} - - fromTree :: (RTree (Int, (FilePath, a))) [Int] -> [FilePath] - fromTree tree sel = [f\\(i, (f, _))<-leafs tree | isMember i sel] - -recurseDirectory :: !FilePath !FilePath !*World -> *(MaybeOSError (RTree (FilePath, FileInfo)), !*World) -recurseDirectory acc fp w - # fp = acc fp - # (mfi, w) = getFileInfo fp w - | isError mfi = (liftError mfi, w) - # (Ok fi) = mfi - | not fi.directory = (Ok $ RNode (fp, fi) [], w) - # (mcs, w) = readDirectory fp w - | isError mfi = (liftError mcs, w) - # (cs, w) = appFst sequence $ mapSt (recurseDirectory fp) (filter (\c->not (elem c [".", ".."])) (fromOk mcs)) w - = (RNode (fp, fi) <$> cs, w) +Start w = startEngine ( + selectFile "/opt/clean/lib" () False [] + >&> viewSharedInformation "Selection" []) w diff --git a/haye_test/test.icl b/haye_test/test.icl new file mode 100644 index 0000000..3cc7df7 --- /dev/null +++ b/haye_test/test.icl @@ -0,0 +1,20 @@ +module test + +class Test sds +where + ttest :: sds -> (String, String) + +:: ADT = E. sds: ADT (String sds -> Int) & Test sds + +:: TestRecord = { bla2 :: ADT} + +instance Test (String, String) +where + ttest ss = ss + +f :: (String, TestRecord) +f = ("jaja", {TestRecord| bla2 =ADT \s sds -> 18}) + +Start = case f of + ("jaja", {bla2}) = case bla2 of + (ADT ff) = ff "a" ("as", "bs")