From 3624c712d72d246f21d4e710cec7c11e052e0326 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 9 Dec 2025 16:32:32 +0100 Subject: Add the haskell book --- Haskell-book/11/TooMany.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Haskell-book/11/TooMany.hs (limited to 'Haskell-book/11/TooMany.hs') diff --git a/Haskell-book/11/TooMany.hs b/Haskell-book/11/TooMany.hs new file mode 100644 index 0000000..633c6b2 --- /dev/null +++ b/Haskell-book/11/TooMany.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE FlexibleInstances #-} +module TooMany where + +newtype Goats = Goats Int deriving (Eq, Show, TooMany) + +newtype Cows = Cows Int deriving (Eq, Show) + +class TooMany a where + tooMany :: a -> Bool + +instance TooMany Int where + tooMany n = n > 42 + +instance TooMany (Int, String) where + tooMany (n, _) = n > 42 -- cgit v1.2.3