@@ -178,7 +178,7 @@ lastv v1 v2 =
178178 (Beta , SemVer _ _ _) -> v2
179179 (SemVer x1 _ _, SemVer x2 _ _) | x1 < x2 -> v2
180180 (SemVer x1 y1 _, SemVer x2 y2 _) | x1 == x2 && y1 < y2 -> v2
181- _ -> error " I'm too lazy "
181+ _ -> error " TODO "
182182```
183183
184184???
@@ -292,10 +292,9 @@ foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
292292wordCount :: [[String ]] -> Int
293293wordCount files = undefined
294294
295- -- | 'Word16' is a zero or positive number
296- data Operation = Debit Word16 | Credit Word16
295+ data Operation = Debit Int | Credit Int
297296
298- balance :: [Operation ] -> Word16
297+ balance :: [Operation ] -> Int
299298balance = undefined
300299```
301300
@@ -305,7 +304,7 @@ balance = undefined
305304wordCount :: [[String ]] -> Int
306305wordCount files = foldr (\ words soFar -> (length words ) + soFar) 0 files
307306
308- balance' :: [Operation ] -> Word16
307+ balance' :: [Operation ] -> Int
309308balance' = foldr (\ op soFar -> toInt op + soFar) 0
310309 where
311310 toInt = \ case Debit x -> - x; Credit x -> x
@@ -315,8 +314,6 @@ balance' = foldr (\op soFar -> toInt op + soFar) 0
315314
316315---
317316
318- ---
319-
320317# Composition
321318
322319Because functions are so central in functional programming, it is crucial
@@ -404,6 +401,8 @@ dubious accounts =
404401 ` dubious ` ?
405402 - Would you rather have 3 loops or one loop?
406403
404+ ---
405+
407406# Composition on steroids
408407
409408<!-- exdown-skip -->
0 commit comments