-- Sample Haskell program — samplefiles.com
module Main where

import Text.Printf (printf)

data Customer = Customer { customerId :: Int, name :: String, balance :: Double }

isVip :: Customer -> Bool
isVip c = balance c >= 10000

totalBalance :: [Customer] -> Double
totalBalance = sum . map balance

main :: IO ()
main = do
  let customers = [Customer 1 "Ada" 12500, Customer 2 "Grace" 830.5, Customer 3 "Linus" 10000]
  mapM_ (\c -> printf "%-6s %10.2f %s\n" (name c) (balance c) (if isVip c then "VIP" else "")) customers
  printf "Total: %.2f\n" (totalBalance customers)
