File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ lastv v1 v2 =
4949 (Beta , SemVer _ _ _) -> v2
5050 (SemVer x1 _ _, SemVer x2 _ _) | x1 < x2 -> v2
5151 (SemVer x1 y1 _, SemVer x2 y2 _) | x1 == x2 && y1 < y2 -> v2
52- _ -> error " I'm too lazy "
52+ _ -> error " TODO "
5353
5454data Sign = Negative | Zero | Positive
5555
@@ -89,14 +89,13 @@ instance Functor Tree where
8989 fmap f (Node x children) = Node (f x) (map (fmap f) children)
9090
9191
92- -- | 'Word16' is a zero or positive number
93- data Operation = Debit Word16 | Credit Word16
92+ data Operation = Debit Int | Credit Int
9493
9594
9695wordCount :: [[String ]] -> Int
9796wordCount files = foldr (\ words soFar -> (length words ) + soFar) 0 files
9897
99- balance' :: [Operation ] -> Word16
98+ balance' :: [Operation ] -> Int
10099balance' = foldr (\ op soFar -> toInt op + soFar) 0
101100 where
102101 toInt = \ case Debit x -> - x; Credit x -> x
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ instance Functor Tree where
287287foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
288288```
289289
290- <!-- exdown-skip 1 2 7 8 -->
290+ <!-- exdown-skip 1 2 6 7 -->
291291``` hs
292292wordCount :: [[String ]] -> Int
293293wordCount files = undefined
You can’t perform that action at this time.
0 commit comments