module Exercise_7 where import Data.List {-WETT-} tuppleSort2 (i1,(a1,b1)) (i2,(a2,b2)) | (i1 > i2) = GT | otherwise = LT trancl :: Eq a => [(Integer,(a,a))] -> [(Integer,(a,a))] trancl as | as == uniqList = uniqList | otherwise = trancl uniqList where uniqList = nubBy (\(i1,(a1,b1)) (i2,(a2,b2)) -> a1 == a2 && b1 == b2) sortedList sortedList = sortBy tuppleSort2 fullList fullList = [ (i1+i2,(a,c)) | (i1,(a,b1))<-as, (i2,(b2,c))<-as , b1==b2] ++ as {-TTEW-}