From 6f27ed755602d2ce8f8df4ea2401af0fc89a6b84 Mon Sep 17 00:00:00 2001 From: Andrea Bessi Date: Thu, 10 May 2018 19:50:55 +0200 Subject: [PATCH] Shorten the solution of combineLists in ch11 `combineLists other Empty = other` isn't needed: in case the second list is empty, it'll be pattern matched against `combineLists (Value v rest) other` and go on in this way until the first List is Empty. --- 11-functors-applicative-functors-and-monoids.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/11-functors-applicative-functors-and-monoids.hs b/11-functors-applicative-functors-and-monoids.hs index 874f463..b5924c1 100644 --- a/11-functors-applicative-functors-and-monoids.hs +++ b/11-functors-applicative-functors-and-monoids.hs @@ -12,7 +12,6 @@ instance Functor List where -- Write a function which appends one list on to another combineLists:: List a -> List a -> List a combineLists Empty other = other -combineLists other Empty = other combineLists (Value v rest) other = Value v (combineLists rest other) -- Make our list a Monoid