We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b2b8d2c commit 7de1ca4Copy full SHA for 7de1ca4
chapter-21/laws/app/Main.hs
@@ -124,9 +124,8 @@ instance Traversable (List) where
124
traverse f (Cons a rest) = liftA2 (Cons) (f a) (traverse f rest)
125
126
instance Foldable List where
127
- {-TODO cannot make this to work if foldMap below is commented-}
128
foldr f d Nil = d
129
- foldr f d (Cons x rest) = foldr f (f x d) rest
+ foldr f d (Cons x rest) = f x (foldr f d rest)
130
131
foldMap ctor (Nil) = mempty
132
foldMap ctor (Cons x rest) = ctor x `mappend` (foldMap ctor rest)
0 commit comments