diff options
| author | Eugen Wissner <belka@caraus.de> | 2025-12-09 16:32:32 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2025-12-09 16:32:32 +0100 |
| commit | 3624c712d72d246f21d4e710cec7c11e052e0326 (patch) | |
| tree | f385cb51c72a0c5eeb2057609b75f5f8c6c4f272 /Haskell-book/11/TooMany.hs | |
| parent | c95abc31d62e296db4f1b537e3de440dd40defd1 (diff) | |
| download | book-exercises-3624c712d72d246f21d4e710cec7c11e052e0326.tar.gz | |
Add the haskell book
Diffstat (limited to 'Haskell-book/11/TooMany.hs')
| -rw-r--r-- | Haskell-book/11/TooMany.hs | 16 |
1 files changed, 16 insertions, 0 deletions
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 |
