diff --git a/frege/data/NanoParsec.fr b/frege/data/NanoParsec.fr index 720d8d6b..76adacb7 100644 --- a/frege/data/NanoParsec.fr +++ b/frege/data/NanoParsec.fr @@ -520,30 +520,27 @@ prop_count_0 = allParsers (\p -> prop_count_1 = allParsers (\p -> count 1 p `same` fmap return p) -private main = do - -- parseTest (skip $ letter >> letter) ['Q'] - -- parseTest (many $ letter >> letter) ['Q'] - -- parseTest (skip $ letter >> pany >> letter) ['x', 'o'] - -- parseTest ((many $ letter >> pany >> letter) >> return ()) ['x', 'o'] - parseTest rec (unpacked "(a,)") - parseTest rec (unpacked "(a,b)") - -- parseTest rec (unpacked "abc") - parseTest rec (unpacked "()") - parseTest rec (unpacked "0(a,)") - parseTest rec (unpacked "1(a,b)") - -- parseTest rec (unpacked "2abc") - parseTest rec (unpacked "3()") - parseTest rec (unpacked "4super") - parseTest rec (unpacked "4,super") - parseTest rec (unpacked "(a;)") - parseTest rec (unpacked "5(a;)") - where - ident = many letter - -rec :: Parser [] Char [Char] -rec = between (expect '(') (expect ')') (letter `sepEndBy` (expect ',')) - <|> (digit >> rec) +-- private main = do +-- -- parseTest (skip $ letter >> letter) ['Q'] +-- -- parseTest (many $ letter >> letter) ['Q'] +-- -- parseTest (skip $ letter >> pany >> letter) ['x', 'o'] +-- -- parseTest ((many $ letter >> pany >> letter) >> return ()) ['x', 'o'] +-- parseTest rec (unpacked "(a,)") +-- parseTest rec (unpacked "(a,b)") +-- -- parseTest rec (unpacked "abc") +-- parseTest rec (unpacked "()") +-- parseTest rec (unpacked "0(a,)") +-- parseTest rec (unpacked "1(a,b)") +-- -- parseTest rec (unpacked "2abc") +-- parseTest rec (unpacked "3()") +-- parseTest rec (unpacked "4super") +-- parseTest rec (unpacked "4,super") +-- parseTest rec (unpacked "(a;)") +-- parseTest rec (unpacked "5(a;)") +-- where +-- ident = many letter +-- +-- rec :: Parser [] Char [Char] +-- rec = between (expect '(') (expect ')') (letter `sepEndBy` (expect ',')) +-- <|> (digit >> rec) -- <|> many letter - - -- parseTest (between (expect '[') (expect ']') $ ident `sepEndBy` expect ',') "[,]" - \ No newline at end of file diff --git a/frege/lib/Modules.fr b/frege/lib/Modules.fr index 98243896..6221e82b 100644 --- a/frege/lib/Modules.fr +++ b/frege/lib/Modules.fr @@ -106,7 +106,7 @@ walkThing arg = do -- `catch` cnf `catch` fnf where - cnf (ex::ClassNotFoundException) = return [] + -- cnf (ex::ClassNotFoundException) = return [] fnf (ex::FileNotFoundException) = do stderr.println ("Could not walk " ++ ex.getMessage) return [] @@ -131,7 +131,8 @@ main args = do data RTree a = T (Tree String a) | R String instance Functor RTree where - fmap f (T t) = T $ fmap f t + fmap f (T t) = T $ fmap f t + fmap f (R r) = R r data Y f = Y (f (Y f)) @@ -148,6 +149,9 @@ pack p ((s:ss), fp) = case out p of T x -> case lookup x s of Just p' -> Y $ T $ update x s (pack p' (ss, fp)) Nothing -> Y $ T $ insert x s (pack noPacks (ss, fp)) + R _ -> p -- this is bad, should be a directory, but is module + +pack p ([], _) = p pfind [] p = Just p pfind (s:ss) p = case out p of