diff --git a/src/System/Console/Terminal/Size.hsc b/src/System/Console/Terminal/Size.hsc
--- a/src/System/Console/Terminal/Size.hsc
+++ b/src/System/Console/Terminal/Size.hsc
@@ -9,9 +9,13 @@
   ( Window(..), size
   ) where
 
+import Control.Exception (catch)
 import Foreign
 import Foreign.C.Error
 import Foreign.C.Types
+#if defined(__GLASGOW_HASKELL__) && (__GLASGOW_HASKELL__ < 706)
+import Prelude hiding (catch)
+#endif
 
 #include <sys/ioctl.h>
 #include <unistd.h>
@@ -21,7 +25,7 @@
 
 
 -- Interesting part of @struct winsize@
-data CWin = CWin { wsRow, wsCol :: CUShort }
+data CWin = CWin CUShort CUShort
 
 instance Storable CWin where
   sizeOf _ = (#size struct winsize)
@@ -49,13 +53,17 @@
 --
 -- >>> import System.Console.Terminal.Size
 -- >>> size
--- Window {height = 60, width = 112}
-size :: Integral n => IO (Window n)
+-- Just (Window {height = 60, width = 112})
+size :: Integral n => IO (Maybe (Window n))
 size = with (CWin 0 0) $ \ws -> do
   throwErrnoIfMinus1 "ioctl" $
     ioctl (#const STDOUT_FILENO) (#const TIOCGWINSZ) ws
   CWin row col <- peek ws
-  return $ Window (fromIntegral row) (fromIntegral col)
+  return . Just $ Window (fromIntegral row) (fromIntegral col)
+ `catch` handler
+ where
+  handler :: (IOError -> IO (Maybe (Window h)))
+  handler _ = return Nothing
 
 foreign import ccall "sys/ioctl.h ioctl"
   ioctl :: CInt -> CInt -> Ptr CWin -> IO CInt
diff --git a/terminal-size.cabal b/terminal-size.cabal
--- a/terminal-size.cabal
+++ b/terminal-size.cabal
@@ -1,5 +1,5 @@
 name:                terminal-size
-version:             0.1.0.0
+version:             0.2.0.0
 synopsis:            Get terminal window height and width
 description:
   Get terminal window height and width without ncurses dependency
@@ -19,6 +19,8 @@
   build-tools:       hsc2hs
   hs-source-dirs:    src
   exposed-modules:   System.Console.Terminal.Size
+  ghc-options:       -Wall
+                     -fno-warn-unused-do-bind
 
 source-repository head
   type:     git
