ex11. sumRights done with challenge

This commit is contained in:
Aaro Koivukangas
2024-01-17 12:32:38 +02:00
parent dd3918b3ba
commit 387e8c3d2b
+1 -1
View File
@@ -240,7 +240,7 @@ a +|+ b = [head a, head b]
-- sumRights [Left "bad!", Left "missing"] ==> 0
sumRights :: [Either a Int] -> Int
sumRights = todo
sumRights = foldr (\a b -> fromRight 0 a + b) 0
------------------------------------------------------------------------------
-- Ex 12: recall the binary function composition operation