ansi-terminal 0.5.0 → 0.5.1
raw patch · 3 files changed
+13/−59 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- README.textile +1/−55
- System/Console/ANSI/Windows/Foreign.hs +9/−1
- ansi-terminal.cabal +3/−3
README.textile view
@@ -1,57 +1,3 @@ h1. ANSI Terminal -You can help improve this README with extra snippets and advice by using the "GitHub wiki":http://github.com/batterseapower/ansi-terminal/wikis/readme.---h2. Installing--To just install the library:--<pre>-<code>runghc Setup.lhs configure-runghc Setup.lhs build-sudo runghc Setup.lhs install-</pre>-</code>--If you want to build the example, to check it's all working:--<pre>-<code>runghc Setup.lhs configure -fexample-runghc Setup.lhs build-dist/build/ansi-terminal-example/ansi-terminal-example-</pre>-</code>---h2. Description--"ANSI":http://en.wikipedia.org/wiki/ANSI_escape_sequences terminal support for Haskell, which allows:--* Cursor movement-* Screen and line clearing-* Color output-* Showing or hiding the cursor-* Changing the console title (though this is not strictly part of ANSI, it is widely supported in Unix)--It is compatible with Windows (via an emulation layer) and those Unixes with ANSI terminals--If you like this, you may be interested in "ansi-wl-pprint":http://github.com/batterseapower/ansi-wl-pprint, which provides a pretty-printer that can construct strings containing ANSI colorisation.---h2. Example--A full example is provided with the package, and can be compiled by suppling Cabal with the @-fexample@ flag. It is also available online at "GitHub":http://github.com/batterseapower/ansi-terminal/tree/master/System/Console/ANSI/Example.hs.--Not all of the ANSI escape codes are provided by this module, but most (if not all) of the popular and well supported ones are. For a full list, you can see the API "here":http://github.com/batterseapower/ansi-terminal/tree/master/includes/Common-Include.hs. Each supported escape code or family of codes has a corresponding function that comes in three variants:--* A straight @IO@ variant that doesn't take a @Handle@ and just applies the ANSI escape code to the terminal attached to stdout-* An @IO@ variant similar to above, but which takes a @Handle@ to which the ANSI escape should be applied-* A @String@ variant that returns a literal string that should be included to get the effect of the code. This is the only one of the three API variants that only works on Unix-like operating systems: on Windows these strings will always be blank!---h2. Linkage--* "Hackage":http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ansi-terminal-* "Bug Tracker":http://bsp.lighthouseapp.com/projects/16235-hs-ansi-terminal-* "GitHub":http://github.com/batterseapower/ansi-terminal/+For all information on this package, please consult the "homepage":http://batterseapower.github.com/ansi-terminal
System/Console/ANSI/Windows/Foreign.hs view
@@ -47,7 +47,11 @@ import GHC.IOBase (Handle(..), Handle__(..), FD) +#if __GLASGOW_HASKELL__ >= 612+import Data.Typeable+#endif + -- Some Windows types missing from System.Win32 type SHORT = CShort type WCHAR = CWchar@@ -300,8 +304,12 @@ DuplexHandle _ _ handle_mvar -> handle_mvar -- This is "write" MVar, we could also take the "read" one -- Get the FD from the algebraic data type+#if __GLASGOW_HASKELL__ < 612 fd <- fmap haFD $ readMVar write_handle_mvar- +#else+ Just fd <- fmap (\(Handle__ { haDevice = dev }) -> cast dev) $ readMVar write_handle_mvar+#endif+ -- Finally, turn that (C-land) FD into a HANDLE using msvcrt windows_handle <- cget_osfhandle fd
ansi-terminal.cabal view
@@ -1,5 +1,5 @@ Name: ansi-terminal-Version: 0.5.0+Version: 0.5.1 Cabal-Version: >= 1.2 Category: User Interfaces Synopsis: Simple ANSI terminal support, with Windows compatibility@@ -10,7 +10,7 @@ Extra-Source-Files: README.textile Author: Max Bolingbroke Maintainer: batterseapower@hotmail.com-Homepage: http://github.com/batterseapower/ansi-terminal+Homepage: http://batterseapower.github.com/ansi-terminal Build-Type: Simple Extra-Source-Files: includes/Common-Include.hs@@ -45,7 +45,7 @@ Other-Modules: System.Console.ANSI.Unix if flag(splitBase)- Build-Depends: base >= 3+ Build-Depends: base >= 3 && < 5 else Build-Depends: base < 3