Skip to content

Commit 02124d6

Browse files
committed
[exercise] 14.1
1 parent 651f937 commit 02124d6

File tree

1 file changed

+9
-0
lines changed
  • chapter14-Foldables-and-friends

1 file changed

+9
-0
lines changed

chapter14-Foldables-and-friends/1.hs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- This is a hypothetical program which does not run in GHCi.
2+
3+
import Data.Monoid
4+
5+
instance (Monoid a, Monoid b) => Monoid (a, b) where
6+
-- mempty :: (a, b)
7+
mempty = (mempty, mempty)
8+
-- mappend :: (a, b) -> (a, b) -> (a, b)
9+
(x1, y1) `mappend` (x2, y2) = (x1 `mappend` x2, y1 `mappend` y2)

0 commit comments

Comments
 (0)