История изменений
Исправление AndreyKl, (текущая версия) :
ну или так
data Fruit = Apple | Orange deriving (Show, Eq)
data Ao = Ao Fruit Int
wdiff w1 w2 | w1 == w2 = "weights are equal"
| otherwise = "weights are different"
diff2 (Ao f1 a1) (Ao f2 a2) | f1 == f2 = "both are of type " ++ show f1 ++ ", " ++ wdiff a1 a2
| otherwise = "first is " ++ show f1 ++ ", second is " ++ show f2
Исходная версия AndreyKl, :
ну или так
data Fruit = Apple | Orange deriving (Show, Eq)
data Ao = Ao Fruit Int
wdiff w1 w2 | w1 == w2 = "weights are equal"
| otherwise = "weights are different"
diff2 (Ao f1 a1) (Ao f2 a2) | f1 == f2 = "both are of type " ++ show f1 ++ ", " ++ wdiff a1 a2
| otherwise = "first is " ++ show f1 ++ ", second is " ++ show f2