Files
book-exercises/Haskell-book/11/TooMany.hs
2025-12-09 16:32:32 +01:00

17 lines
366 B
Haskell

{-# 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