terminal-size 0.3.0 → 0.3.1
raw patch · 4 files changed
+79/−30 lines, 4 filesdep +ghc-primdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: ghc-prim
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG.markdown +5/−0
- src/System/Console/Terminal/Common.hs +35/−14
- src/System/Console/Terminal/Size.hs +4/−2
- terminal-size.cabal +35/−14
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+0.3.1+=====++ * `Typeable`, `Data`, `Generic`, and `Generic1` instances for `Window`.+ 0.3.0 =====
src/System/Console/Terminal/Common.hs view
@@ -1,24 +1,45 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveTraversable #-} +#if __GLASGOW_HASKELL__ >= 702+#define LANGUAGE_DeriveGeneric+{-# LANGUAGE DeriveGeneric #-}+#endif+ module System.Console.Terminal.Common ( Window(..) ) where -import Control.Applicative-import Data.Foldable (Foldable(..))-import Data.Traversable (Traversable(..))-import Data.Monoid (mappend)+import Data.Data (Typeable, Data) +#if __GLASGOW_HASKELL__ < 710+import Data.Foldable (Foldable)+import Data.Traversable (Traversable)+#endif++#ifdef LANGUAGE_DeriveGeneric+import GHC.Generics+ ( Generic+#if __GLASGOW_HASKELL__ >= 706+ , Generic1+#endif+ )+#endif+ -- | Terminal window width and height data Window a = Window { height :: !a , width :: !a- } deriving (Show, Eq, Read)--instance Functor Window where- fmap f (Window { height = h, width = w }) = Window { height = f h, width = f w }--instance Foldable Window where- foldMap f (Window { height = h, width = w }) = f h `mappend` f w--instance Traversable Window where- traverse f (Window { height = h, width = w }) = Window <$> f h <*> f w+ } deriving+ ( Show, Eq, Read, Data, Typeable+ , Foldable, Functor, Traversable+#ifdef LANGUAGE_DeriveGeneric+ , Generic+#if __GLASGOW_HASKELL__ >= 706+ , Generic1+#endif+#endif+ )
src/System/Console/Terminal/Size.hs view
@@ -5,9 +5,11 @@ Based on answer by Andreas Hammar at <http://stackoverflow.com/a/12807521/972985> -} module System.Console.Terminal.Size- ( Window(..), size+ ( Window(..)+ , size #if !defined(mingw32_HOST_OS)- ,fdSize, hSize+ , fdSize+ , hSize #endif ) where
terminal-size.cabal view
@@ -1,5 +1,5 @@ name: terminal-size-version: 0.3.0+version: 0.3.1 synopsis: Get terminal window height and width description: Get terminal window height and width without ncurses dependency.@@ -14,20 +14,41 @@ README.markdown CHANGELOG.markdown +source-repository head+ type: git+ location: https://github.com/biegunka/terminal-size++source-repository this+ type: git+ location: https://github.com/biegunka/terminal-size+ tag: 0.3.1+ library- default-language: Haskell2010- build-depends: base >= 4 && < 5- build-tools: hsc2hs- hs-source-dirs: src- exposed-modules: System.Console.Terminal.Size- other-modules: System.Console.Terminal.Common+ default-language:+ Haskell2010++ build-depends:+ base >= 4 && < 5+ if impl(ghc >= 7.4 && < 7.6)+ build-depends:+ ghc-prim++ build-tools:+ hsc2hs+ hs-source-dirs:+ src+ exposed-modules:+ System.Console.Terminal.Size++ other-modules:+ System.Console.Terminal.Common if os(Windows)- other-modules: System.Console.Terminal.Windows+ other-modules:+ System.Console.Terminal.Windows else- other-modules: System.Console.Terminal.Posix- ghc-options: -Wall- -fno-warn-unused-do-bind+ other-modules:+ System.Console.Terminal.Posix -source-repository head- type: git- location: https://github.com/biegunka/terminal-size+ ghc-options:+ -Wall+ -fno-warn-unused-do-bind