content: {-# LANGUAGE GeneralizedNewtypeDeriving #-}
  
  data Price = Price Integer deriving (Eq, Show)
  data Size = Size Integer deriving (Eq, Show)
  
  data Manufacturer = Mini
                    | Mazda
                    | Tata
                      deriving (Eq, Show)
  
  data Airline = PapuAir
               | CatapultsR'Us
               | TakeYourChancesUnited
                 deriving (Eq, Show)
  
  data Vehicle = Car Manufacturer Price
               | Plane Airline Size
                 deriving (Eq, Show)
  
  myCar = Car Mini (Price 14000)
  urCar = Car Mazda (Price 20000)
  clownCar = Car Tata (Price 7000)
  doge = Plane PapuAir (Size 34000)
  
  isCar :: Vehicle -> Bool
  isCar x = case x of
    Car _ _ -> True
    _ -> False
  
  isPlane :: Vehicle -> Bool
  isPlane x = case x of
    Plane _ _ -> True
    _ -> False
  
  areCars :: [Vehicle] -> [Bool]
  areCars = map isCar
  
  getManu :: Vehicle -> Maybe Manufacturer
  getManu x = case x of
    Car x _ -> Just x
    _ -> Nothing
  
  newtype Goats = Goats Int deriving (Eq, Show)
  newtype Cows = Cows Int deriving (Eq, Show)
  
  tooManyGoats :: Goats -> Bool
  tooManyGoats (Goats n) = n > 42
  
  class TooMany a where
    tooMany :: a -> Bool
  
  instance TooMany Int where
    tooMany n = n > 42
  
  instance TooMany Goats where
    tooMany (Goats n) = tooMany n
  