From: Mart Lubbers Date: Thu, 6 Sep 2018 11:30:26 +0000 (+0200) Subject: bork X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=0b364491c5e0bf5a97e6f7dd5c52932c835f43c8;p=clean-tests.git bork --- diff --git a/arrayfunctor/test.icl b/arrayfunctor/test.icl new file mode 100644 index 0000000..b1eb773 --- /dev/null +++ b/arrayfunctor/test.icl @@ -0,0 +1,10 @@ +module test + +import StdEnv +import Data.Functor +import Data.Array +import Control.Applicative +import Control.Monad + +Start :: {Int} +Start = (+) <$> {1,2} <*> {1,2,3,4} >>= \e->pure (e+1) diff --git a/doublylinked/test.icl b/doublylinked/test.icl new file mode 100644 index 0000000..877bfb1 --- /dev/null +++ b/doublylinked/test.icl @@ -0,0 +1,33 @@ +module test + +:: DList a = Nil | Cons a (Link (DList a)) +:: Link a = {prev :: a, next :: a} + +fromList :: ([a] -> DList a) +fromList = go Nil +where + go :: (DList a) [a] -> DList a + go prev [] = Nil + go prev [a:as] = + let head = Cons a {prev=prev,next=tail} + tail = go head as + in head + +toList :: (DList a) -> [a] +toList Nil = [] +toList (Cons el {next}) = [el:toList next] + +nil :: DList a +nil = Nil + +(:!) infixr 0 :: a (DList a) -> DList a +(:!) elh Nil = Cons elh {prev=nil,next=nil} +(:!) elh (Cons elt link) = + let tail = Cons elt {link & prev=head} + head = Cons elh {prev=nil,next=tail} + in head + +Start = + (toList (1 :! 2 :! 3 :! nil) + ,toList (fromList [1,2,3]) + ) diff --git a/filepicker/test.icl b/filepicker/test.icl index e1989a7..4ae8838 100644 --- a/filepicker/test.icl +++ b/filepicker/test.icl @@ -20,7 +20,7 @@ import System.Directory import Text.GenPrint import iTasks => qualified >>=, >>|, forever, sequence, return -derive class iTask RTree, ChoiceNode +derive class iTask RTree, ChoiceNode, FileInfo, Tm Start w = startEngine (selectFile "/opt/clean/lib/StdLib" () False) w @@ -36,20 +36,20 @@ where toChoiceNode :: (Int a -> ChoiceNode) -> ((RTree (Int, a)) -> ChoiceNode) toChoiceNode tfun = foldTree \a cs->{ChoiceNode | uncurry tfun a & children=cs} - fp2cn :: Int (FilePath, Bool) -> ChoiceNode - fp2cn i (fp, bool) = {id =if bool (~i) i,label=dropDirectory fp,icon=Nothing,expanded=False,children=[]} + 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, Bool))) [Int] -> [FilePath] + 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, Bool)), !*World) +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, False) [], w) + | 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, True) <$> cs, w) + = (RNode (fp, fi) <$> cs, w) diff --git a/maybe-migration/Makefile b/maybe-migration/Makefile new file mode 100644 index 0000000..83f7745 --- /dev/null +++ b/maybe-migration/Makefile @@ -0,0 +1,4 @@ +all: + mkdir -p Clean\ System\ Files + gcc -c test.c -o test.o + clm -l test.o -dynamics -IL Dynamics test -o test diff --git a/maybe-migration/test.icl b/maybe-migration/test.icl new file mode 100644 index 0000000..0e008e7 --- /dev/null +++ b/maybe-migration/test.icl @@ -0,0 +1,7 @@ +module test + +import Control.Applicative +import Data.Foldable +import Data.Monoid + +Start = 42