diff --git a/Front.hs b/Front.hs index 59c9a0a..38fa355 100644 --- a/Front.hs +++ b/Front.hs @@ -411,6 +411,7 @@ instance WeakDesugar HsDecl where wds (HsTypeSig loc ns ty)=HsTypeSig loc ns ty wds (HsDataDecl loc [] n vs cdecls [])=HsDataDecl loc [] n vs cdecls [] wds (HsDataDecl _ _ _ _ _ _)=error "WeakDesugar: HsDataDecl: context/deriving is not supported" + wds (HsInfixDecl loc assoc lv ops)=HsInfixDecl loc assoc lv ops instance WeakDesugar HsExp where wds (HsApp e0 e1)=HsApp (wds e0) (wds e1) diff --git a/auto-test b/auto-test index 906355e..86b32a8 100755 --- a/auto-test +++ b/auto-test @@ -17,7 +17,7 @@ and test_bf test/LocalFun.hs and test_bf test/Lambda.hs and test_bf test/Arithmetic.hs and test_bf test/ShowList.hs -# and test_bf test/QuickSort.hs +and test_bf test/QuickSort.hs # and test_bf test/TypeClass.hs # and test_bf test/ConstPattern.hs # and test_bf test/ diff --git a/test/Prelude.hs b/test/Prelude.hs index 724d478..5d170ec 100644 --- a/test/Prelude.hs +++ b/test/Prelude.hs @@ -1,5 +1,7 @@ +infixr 0 $ f $ x=f x + f $! x=x `seq` (f x) data Bool @@ -99,8 +101,16 @@ filter f (x:xs) |n `eqByte` 0 = x |otherwise = xs !! (n `subByte` 1) +{- I don't know why, but this code doesn't work! []++ys=ys (x:xs)++ys=x:(xs++ys) +-} + +xs ++ ys= + case xs of + [] -> ys + x:xs -> x:(xs++ys) + length []=0 length (x:xs)=1 `addByte` (length xs) diff --git a/test/QuickSort.hs b/test/QuickSort.hs new file mode 100644 index 0000000..65721a6 --- /dev/null +++ b/test/QuickSort.hs @@ -0,0 +1,9 @@ + +main=outputStr Halt (qsort "etsb") + +qsort []=[] +qsort (x:xs)=qsort (filter (gtByte x) xs)++[x]++qsort (filter (leByte x) xs) + +outputStr k []=k +outputStr k (x:xs)=Output x (outputStr k xs) + diff --git a/test/ShowList.hs b/test/ShowList.hs index 7440f0d..9893e88 100644 --- a/test/ShowList.hs +++ b/test/ShowList.hs @@ -1,6 +1,6 @@ -main=outputStr Halt (map showByte1 [1,2,3,4]) +main=outputStr Halt ((map showByte1 [1,2,3])++"\n") showByte1 x=addByte '0' x