use parsec for the parser
[clean-tests.git] / datatype / Main.hs
index 8d31f60..c68cb85 100644 (file)
@@ -35,12 +35,12 @@ main
 --  >> putStrLn (show $ runInterpreter (unmain f4))
   >> putStrLn (runPrint $ unmain f5)
   >> putStrLn (show $ interpret 50 <$> runCompiler (unmain f5))
-  >> putStrLn (runPrint $ unmain f6)
-  >> putStrLn (show $ interpret 50 <$> runCompiler (unmain f6))
-  >> putStrLn (runPrint $ unmain f7)
-  >> putStrLn (show $ interpret 50 <$> runCompiler (unmain f7))
-  >> putStrLn (runPrint $ unmain f7')
-  >> putStrLn (show $ interpret 100 <$> runCompiler (unmain f7'))
+--  >> putStrLn (runPrint $ unmain f6)
+--  >> putStrLn (show $ interpret 50 <$> runCompiler (unmain f6))
+--  >> putStrLn (runPrint $ unmain f7)
+--  >> putStrLn (show $ interpret 50 <$> runCompiler (unmain f7))
+--  >> putStrLn (runPrint $ unmain f7')
+--  >> putStrLn (show $ interpret 100 <$> runCompiler (unmain f7'))
 
 e0 :: Expression v => v Int
 e0 = lit 2 -. lit 8
@@ -94,8 +94,8 @@ f4
 f5 :: (List' v, Expression v, Function (v (List Int)) v) => Main (v Int)
 f5
     = fun ( \sumf->(\l->[cp|case l of
-                Cons e rest -> e +. sumf(rest)
                 Nil -> 0
+                Cons e rest -> e +. sumf(rest)
             |])
 --    :- Main {unmain=sumf $ lit (1 :: Int) `cons` (lit 2 `cons` (lit 3 `cons` nil))}
     :- Main {unmain=sumf $ lit (1 :: Int) `cons` (lit 2 `cons` (lit 3 `cons` nil))}
@@ -104,7 +104,7 @@ f5
 f6 :: (TupleR' v, Expression v, Function (v (TupleR Int Char)) v) => Main (v Int)
 f6
     = fun ( \firstfun->(\l->[cp|case l of
-                TupleR{first=f} -> f
+                TupleR {first=f} -> f
             |])
 --    :- Main {unmain=sumf $ lit (1 :: Int) `cons` (lit 2 `cons` (lit 3 `cons` nil))}
     :- Main {unmain=firstfun $ tupler (lit 1) (lit 'c')}
@@ -113,8 +113,8 @@ f6
 f7 :: (Expression v, Function (v Int) v) => Main (v Int)
 f7
     = fun ( \ffac->(\l->[cp|case l of
-                0 -> 1;
-                n -> n *. ffac (n -. 1);
+                0 -> 1
+                n -> n *. ffac (n -. 1)
             |])
     :- Main {unmain=ffac (lit 10)}
     )