-- whim: a window manager
-- Copyright (C) 2006 Evan Martin <martine@danga.com>

module Whim.Util where

import Data.List (intersperse)

log :: [String] -> IO ()
-- Output a string to the log.
log str = putStrLn $ "whim: " ++ (foldr1 (++) $ intersperse " " str)

-- Some utilities for working with 2d coordinates.
type Coord = (Int, Int)
-- The mnemonic for these operators is the two dots of the colon = 2d.
(-:) :: Coord -> Coord -> Coord
(x1,y1) -: (x2,y2) = (x1-x2, y1-y2)
(+:) :: Coord -> Coord -> Coord
(x1,y1) +: (x2,y2) = (x1+x2, y1+y2)