Fix Total004 test

Names in Data.List clashed
This commit is contained in:
Edwin Brady 2019-07-06 15:55:47 +01:00
parent 62382dcd96
commit fc224b1450
3 changed files with 14 additions and 14 deletions

View File

@ -111,17 +111,17 @@ qsort' (x :: xs)
partition : a -> List a -> (List a, List a)
partition x xs = (filter (< x) xs, filter (>= x) xs)
sorted : Ord a => List a -> Bool
sorted [] = True
sorted (x::xs) =
mySorted : Ord a => List a -> Bool
mySorted [] = True
mySorted (x::xs) =
case xs of
Nil => True
(y::ys) => x <= y && sorted (y::ys)
(y::ys) => x <= y && mySorted (y::ys)
mergeBy : (a -> a -> Ordering) -> List a -> List a -> List a
mergeBy order [] right = right
mergeBy order left [] = left
mergeBy order (x::xs) (y::ys) =
myMergeBy : (a -> a -> Ordering) -> List a -> List a -> List a
myMergeBy order [] right = right
myMergeBy order left [] = left
myMergeBy order (x::xs) (y::ys) =
case order x y of
LT => x :: mergeBy order xs (y::ys)
_ => y :: mergeBy order (x::xs) ys
LT => x :: myMergeBy order xs (y::ys)
_ => y :: myMergeBy order (x::xs) ys

View File

@ -15,6 +15,6 @@ Main> Main.size is total
Main> Main.qsortBad is not terminating due to recursive path Main.qsortBad -> Main.qsortBad
Main> Main.qsort is total
Main> Main.qsort' is total
Main> Main.sorted is total
Main> Main.mergeBy is total
Main> Main.mySorted is total
Main> Main.myMergeBy is total
Main> Bye for now!

View File

@ -13,6 +13,6 @@
:total qsortBad
:total qsort
:total qsort'
:total sorted
:total mergeBy
:total mySorted
:total myMergeBy
:q