-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Get terminal window height and width
--   
--   Get terminal window height and width without ncurses dependency.
@package terminal-size
@version 0.3.2.1


-- | Get terminal window height and width without ncurses dependency
--   
--   Based on answer by Andreas Hammar at
--   <a>http://stackoverflow.com/a/12807521/972985</a>
module System.Console.Terminal.Size

-- | Terminal window width and height
data Window a
Window :: !a -> !a -> Window a
[height] :: Window a -> !a
[width] :: Window a -> !a

-- | Get terminal window width and height for <tt>stdout</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; import System.Console.Terminal.Size
--   
--   &gt;&gt;&gt; size
--   Just (Window {height = 60, width = 112})
--   </pre>
size :: Integral n => IO (Maybe (Window n))

-- | <i>Not available on Windows:</i> Get terminal window width and height
--   for a specified file descriptor. If it's not attached to a terminal
--   then <a>Nothing</a> is returned.
--   
--   <pre>
--   &gt;&gt;&gt; import System.Console.Terminal.Size
--   
--   &gt;&gt;&gt; import System.Posix
--   
--   &gt;&gt;&gt; fdSize stdOutput
--   Just (Window {height = 56, width = 85})
--   
--   &gt;&gt;&gt; fd &lt;- openFd "foo" ReadWrite (Just stdFileMode) defaultFileFlags
--   
--   &gt;&gt;&gt; fdSize fd
--   Nothing
--   </pre>
fdSize :: Integral n => Fd -> IO (Maybe (Window n))

-- | <i>Not available on Windows:</i> Same as <a>fdSize</a>, but takes
--   <a>Handle</a> instead of <a>Fd</a> (file descriptor).
--   
--   <pre>
--   &gt;&gt;&gt; import System.Console.Terminal.Size
--   
--   &gt;&gt;&gt; import System.IO
--   
--   &gt;&gt;&gt; hSize stdout
--   Just (Window {height = 56, width = 85})
--   </pre>
hSize :: Integral n => Handle -> IO (Maybe (Window n))
