Hi,
ich hab Bsp 2 jetzt auch fast fertig jedoch noch ein Typproblem.
Ich habe eine Funktion unzipT die ihre Aufgabe erledigt, indem sie 2 Hilfsfunktionen aufruft.
unzipT :: (Eq a, Eq b) => Tree (a,b) -> (Tree a,Tree b)
unzipT x = (unzipTHelpL x (getFirst x), (unzipTHelpR x (getSecond x)) )
unzipTHelpL und unzipTHelpR haben fast die gleiche Funktionalität.
unzipTHelpL baut einen Baum mit dem ersten Element des Inhaltspaares und unzipTHelpR einen Baum mit dem zweiten Element des Inahltspaares.
das 2te Argument, ist nur ein "Hilfsbaum", der als Start verwendet wird und zum Aufbauen gebraucht wird.
unzipTHelpL hat folgende Signatur und funktioniert bereits:
unzipTHelpL :: (Eq a, Eq b) => Tree (a,b) -> Tree a -> Tree a
unzipTHelpL (Node (x,_) x1 x2) (Node y y1 y2)
Für unzipTHelpR siechts so aus
unzipTHelpR :: (Eq a, Eq b) => Tree (a,b) -> Tree b -> Tree b
unzipTHelpR (Node (_,x) x1 x2) (Node y y1 y2)
ich bekomm jedoch für unzipTHelpR folgende Fehlermeldung:
ERROR file:C:\uni\sem5\funprog\Aufgabe8.hs:94 - Inferred type is not general enough
*** Expression : unzipTHelpR
*** Expected type : (Eq a, Eq b) => Tree (a,b) -> Tree b -> Tree b
*** Inferred type : (Eq a, Eq a) => Tree (a,a) -> Tree a -> Tree a
Habt ihr eine Ahnung was da das Problem ist, bzw. muss ich das Problem anders angehen?
Danke!