{-|
Module      : Util.ScreenSize
Description : Utilities for getting screen width.

License     : BSD3
Maintainer  : The Idris Community.
-}
module Util.ScreenSize(getScreenWidth) where

import System.Console.Terminal.Size (size, width)

getScreenWidth :: IO Int
getScreenWidth :: IO Int
getScreenWidth = Int -> (Window Int -> Int) -> Maybe (Window Int) -> Int
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Int
80 Window Int -> Int
forall a. Window a -> a
width (Maybe (Window Int) -> Int) -> IO (Maybe (Window Int)) -> IO Int
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` IO (Maybe (Window Int))
forall n. Integral n => IO (Maybe (Window n))
size