From 98329e0a3dd4f78b5d815ac3896272ec70904901 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 11 Dec 2025 10:28:11 +0100 Subject: Add remaining haskell book exercises --- Haskell-book/16/Short.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Haskell-book/16/Short.hs (limited to 'Haskell-book/16/Short.hs') diff --git a/Haskell-book/16/Short.hs b/Haskell-book/16/Short.hs new file mode 100644 index 0000000..f6ecd66 --- /dev/null +++ b/Haskell-book/16/Short.hs @@ -0,0 +1,10 @@ +module Short where + +data Sum a b = + First a + | Second b + deriving (Eq, Show) + +instance Functor (Sum a) where + fmap f (Second x) = Second $ f x + fmap f (First x) = First x -- cgit v1.2.3