import Test.QuickCheck
import Data.List

myPack' :: Eq a => [[a]] -> [a] -> [[a]]
myPack' p [] = p
myPack' [] x = myPack' [[head x]] (tail x)
myPack' p x =
	case (head x) == (last . last $ p) of
		True -> myPack' (init p ++ [last p ++ [head x]]) (tail x)
		False -> myPack' (p ++ [[head x]]) (tail x)

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

testMyPack :: [Char] -> Bool
testMyPack x = myPack x == group x

main = quickCheck testMyPack
