import Test.QuickCheck
import Data.List

myCompress' :: Eq a => [a] -> [a] -> [a]
myCompress' c [] = c
myCompress' [] x = myCompress' [head x] (tail x)
myCompress' c x =
	case head x == last c of
		True -> myCompress' c (tail x)
		False -> myCompress' (c ++ [head x]) (tail x)

myCompress :: Eq a => [a] -> [a]
myCompress x = myCompress' [] x

testMyCompress :: [Char] -> Bool
testMyCompress xs = myCompress xs == [head x | x <- group xs]

main = quickCheck testMyCompress
