-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Util.Types
-- Description :  Miscellaneous commonly used types.
-- Copyright   :  (c) Daniel Schoepe (2009)
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  Daniel Schoepe <daniel.schoepe@gmail.com>
-- Stability   :  unstable
-- Portability :  unportable
--
-- Miscellaneous commonly used types.
--
-----------------------------------------------------------------------------

module XMonad.Util.Types (Direction1D(..)
                         ,Direction2D(..)
                         ) where

-- | One-dimensional directions:
data Direction1D = Next | Prev deriving (Direction1D -> Direction1D -> Bool
(Direction1D -> Direction1D -> Bool)
-> (Direction1D -> Direction1D -> Bool) -> Eq Direction1D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Direction1D -> Direction1D -> Bool
$c/= :: Direction1D -> Direction1D -> Bool
== :: Direction1D -> Direction1D -> Bool
$c== :: Direction1D -> Direction1D -> Bool
Eq,ReadPrec [Direction1D]
ReadPrec Direction1D
Int -> ReadS Direction1D
ReadS [Direction1D]
(Int -> ReadS Direction1D)
-> ReadS [Direction1D]
-> ReadPrec Direction1D
-> ReadPrec [Direction1D]
-> Read Direction1D
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Direction1D]
$creadListPrec :: ReadPrec [Direction1D]
readPrec :: ReadPrec Direction1D
$creadPrec :: ReadPrec Direction1D
readList :: ReadS [Direction1D]
$creadList :: ReadS [Direction1D]
readsPrec :: Int -> ReadS Direction1D
$creadsPrec :: Int -> ReadS Direction1D
Read,Int -> Direction1D -> ShowS
[Direction1D] -> ShowS
Direction1D -> String
(Int -> Direction1D -> ShowS)
-> (Direction1D -> String)
-> ([Direction1D] -> ShowS)
-> Show Direction1D
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Direction1D] -> ShowS
$cshowList :: [Direction1D] -> ShowS
show :: Direction1D -> String
$cshow :: Direction1D -> String
showsPrec :: Int -> Direction1D -> ShowS
$cshowsPrec :: Int -> Direction1D -> ShowS
Show)

-- | Two-dimensional directions:
data Direction2D = U -- ^ Up
                 | D -- ^ Down
                 | R -- ^ Right
                 | L -- ^ Left
                   deriving (Direction2D -> Direction2D -> Bool
(Direction2D -> Direction2D -> Bool)
-> (Direction2D -> Direction2D -> Bool) -> Eq Direction2D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Direction2D -> Direction2D -> Bool
$c/= :: Direction2D -> Direction2D -> Bool
== :: Direction2D -> Direction2D -> Bool
$c== :: Direction2D -> Direction2D -> Bool
Eq,ReadPrec [Direction2D]
ReadPrec Direction2D
Int -> ReadS Direction2D
ReadS [Direction2D]
(Int -> ReadS Direction2D)
-> ReadS [Direction2D]
-> ReadPrec Direction2D
-> ReadPrec [Direction2D]
-> Read Direction2D
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Direction2D]
$creadListPrec :: ReadPrec [Direction2D]
readPrec :: ReadPrec Direction2D
$creadPrec :: ReadPrec Direction2D
readList :: ReadS [Direction2D]
$creadList :: ReadS [Direction2D]
readsPrec :: Int -> ReadS Direction2D
$creadsPrec :: Int -> ReadS Direction2D
Read,Int -> Direction2D -> ShowS
[Direction2D] -> ShowS
Direction2D -> String
(Int -> Direction2D -> ShowS)
-> (Direction2D -> String)
-> ([Direction2D] -> ShowS)
-> Show Direction2D
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Direction2D] -> ShowS
$cshowList :: [Direction2D] -> ShowS
show :: Direction2D -> String
$cshow :: Direction2D -> String
showsPrec :: Int -> Direction2D -> ShowS
$cshowsPrec :: Int -> Direction2D -> ShowS
Show,Eq Direction2D
Eq Direction2D
-> (Direction2D -> Direction2D -> Ordering)
-> (Direction2D -> Direction2D -> Bool)
-> (Direction2D -> Direction2D -> Bool)
-> (Direction2D -> Direction2D -> Bool)
-> (Direction2D -> Direction2D -> Bool)
-> (Direction2D -> Direction2D -> Direction2D)
-> (Direction2D -> Direction2D -> Direction2D)
-> Ord Direction2D
Direction2D -> Direction2D -> Bool
Direction2D -> Direction2D -> Ordering
Direction2D -> Direction2D -> Direction2D
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Direction2D -> Direction2D -> Direction2D
$cmin :: Direction2D -> Direction2D -> Direction2D
max :: Direction2D -> Direction2D -> Direction2D
$cmax :: Direction2D -> Direction2D -> Direction2D
>= :: Direction2D -> Direction2D -> Bool
$c>= :: Direction2D -> Direction2D -> Bool
> :: Direction2D -> Direction2D -> Bool
$c> :: Direction2D -> Direction2D -> Bool
<= :: Direction2D -> Direction2D -> Bool
$c<= :: Direction2D -> Direction2D -> Bool
< :: Direction2D -> Direction2D -> Bool
$c< :: Direction2D -> Direction2D -> Bool
compare :: Direction2D -> Direction2D -> Ordering
$ccompare :: Direction2D -> Direction2D -> Ordering
Ord,Int -> Direction2D
Direction2D -> Int
Direction2D -> [Direction2D]
Direction2D -> Direction2D
Direction2D -> Direction2D -> [Direction2D]
Direction2D -> Direction2D -> Direction2D -> [Direction2D]
(Direction2D -> Direction2D)
-> (Direction2D -> Direction2D)
-> (Int -> Direction2D)
-> (Direction2D -> Int)
-> (Direction2D -> [Direction2D])
-> (Direction2D -> Direction2D -> [Direction2D])
-> (Direction2D -> Direction2D -> [Direction2D])
-> (Direction2D -> Direction2D -> Direction2D -> [Direction2D])
-> Enum Direction2D
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Direction2D -> Direction2D -> Direction2D -> [Direction2D]
$cenumFromThenTo :: Direction2D -> Direction2D -> Direction2D -> [Direction2D]
enumFromTo :: Direction2D -> Direction2D -> [Direction2D]
$cenumFromTo :: Direction2D -> Direction2D -> [Direction2D]
enumFromThen :: Direction2D -> Direction2D -> [Direction2D]
$cenumFromThen :: Direction2D -> Direction2D -> [Direction2D]
enumFrom :: Direction2D -> [Direction2D]
$cenumFrom :: Direction2D -> [Direction2D]
fromEnum :: Direction2D -> Int
$cfromEnum :: Direction2D -> Int
toEnum :: Int -> Direction2D
$ctoEnum :: Int -> Direction2D
pred :: Direction2D -> Direction2D
$cpred :: Direction2D -> Direction2D
succ :: Direction2D -> Direction2D
$csucc :: Direction2D -> Direction2D
Enum,Direction2D
Direction2D -> Direction2D -> Bounded Direction2D
forall a. a -> a -> Bounded a
maxBound :: Direction2D
$cmaxBound :: Direction2D
minBound :: Direction2D
$cminBound :: Direction2D
Bounded)