packages feed

text-show 0.7 → 0.7.0.1

raw patch · 82 files changed

+9999/−9992 lines, 82 filesdep −silentlydep ~text-showsetup-changed

Dependencies removed: silently

Dependency ranges changed: text-show

Files

CHANGELOG.md view
@@ -1,82 +1,86 @@-# 0.7-* Added `showbConstPrec` (and corresponding `Show` and `Show1` instances for `Const`) to `Text.Show.Text.Control.Applicative`-* Added `showbUArrayPrec` (and corresponding `Show` instance for `UArray`s) and `showbIArrayPrec` to `Text.Data.Text.Data.Array`.-* Renamed `showbListDefault` to `showbListWith` to match how `Text.Show` names it-* Exposed `showbShortByteString` with all versions of `bytestring` by using the `bytestring-builder` package-* Corrected the `Show` instance for `Lexeme` (in `Text.Show.Text.Text.Read.Lex`)-* Fixed `TypeRep` output on GHC 7.10 and later-* The Template Haskell deriver now handles showable unlifted types (`Char#`, `Double#`, `Float#`, `Int#`, and `Word#`) correctly on GHC 7.12 and later-* Removed `LitChar` and `LitString` from `Text.Show.Text.Data.Char`, as they were not as useful as I had imagined.-* Removed the deprecated `replicateB` function-* `Typable` instances for `Show`, `Show1`, and `GShow` (with GHC 7.8 and later)-* `Typeable` instance for `ConType`-* Only derive `Eq` and `Ord` for `ConType` if a recent-enough version of `text` is used-* Changed the implementations of some functions in `Text.Show.Text.Debug.Trace` to use `ByteString`s instead of `String`s--### 0.6.0.1-* Forgot to include some header files in `text-show.cabal`--# 0.6-* `deriveShow` can now construct instances for data families, using either the data family name or a data instance constructor as an argument. See the documentation in `Text.Show.Text.TH` for more details.-* Fixed a bug in which infix backticked data constructors (e.g., ```data Add = Int `Plus` Int```) would not be shown correctly.-* Fixed typo in `Text.Show.Text.GHC.RTS.Flags`-* Removed the phantom-type detecting mechanism with `template-haskell-2.9.0.0` or higher. This method of finding phantom types is intrinsically flawed and is not usable on older GHCs. I plan on introducing a more robust mechanism for detecting phantom types on more versions of Template Haskell in `text-show-0.7`.-* Added generics support with the `Text.Show.Text.Generic` and `Text.Show.Text.Debug.Trace.Generic` modules-* Deprecated `replicateB` in favor of `timesN` from the `semigroups` library-* Added `FromTextShow` to `Text.Show.Text`, which admits a `String` `Show` instance for any data type with a `Text` `Show` instance (the counterpart of `FromStringShow`)-* Added `Monoid` and `Semigroup` instances for `FromStringShow`, `Semigroup` instance for `LitString`, `IsChar` instance for `LitChar`, and `IsString` instance for `[LitChar]`-* Changed the `String` `Show` instances of `FromStringShow`, `LitChar`, and `LitString` to more closely match the `Text` `Show` instances. As a result, the `Read` instances for these data types were also changed so that `read . show = read . show = id`.-* Removed the `recent-text` flag. We'll allow users to build with older versions of `text`, but the latest version is recommended. Because of this, the `integer-simple` and `integer-gmp` flags are not needed.-* Removed the `integer-gmp2` flag, as it supported a configuration that didn't actually compile on GHC-* Removed the `transformers-four` flag, as it is not needed now that `transformers-compat` is a dependency--# 0.5-* Fix build for GHC 7.10, old GHC versions, and Windows-* Removed the `Text.Show.Text.Data.Containers` and `Text.Show.Text.Data.Time` modules. The modules for the data types in `containers` and `time` were migrated to a separate library, `text-show-instances`.-* Removed the `-ftext-format` flag, as `text-show` no longer uses `text-format`.-* A [serious bug](https://github.com/bos/text/issues/99) in the `text` package that caused segfaults when building large `Integer`s was fixed in `text-1.2.0.2`. A flag (`-frecent-text`) was added that allows you to take advantage of this.-* Fixed a bug that would cause the output of functions in the `Text.Show.Text.Data.Floating` module to not match `base` depending on what version of `base` is used.-* The type signatures of lambda expressions generated by `mkShow` and related functions were loosened to allow them to be used to "manually" derive `Show` instances for data types with higher-kinded type parameters or type arguments with restricted `Show` instances. This should not be a breaking change; you can simply do more with `mkShow` et al. than you could before. For more information, see the documentation in `Text.Show.Text.TH`.-* Loosened the `Show` instance of `Complex a` to only depend on `Show a` (previously required `RealFloat a`) if using base-4.4.0.0 or later-* Moved `showbRatioPrec` to `Text.Show.Text.Data.Ratio`, `showbComplexPrec` to `Text.Show.Text.Data.Complex`, `showbProxy` to `Text.Show.Text.Data.Proxy`, and `showbFingerprint` to `Text.Show.Text.GHC.Fingerprint`-* Added `deriveShowPragmas` to `Text.Show.Text.TH` to allow users to specify `INLINE` or `SPECIALIZE instance` pragmas with `Show` instances.-* Added `FromStringShow`, `showbSpace`, `showbUnary`, `showbUnary1`, and `showbBinary1` to `Text.Show.Text`-* Added `mkShowList`, `mkShowListLazy`, and `mkShowbList` to `Text.Data.Text.TH`-* For base-4.8.0.0 and above, added the `Text.Show.Text.Data.Functor.Identity`, `Text.Show.Text.Data.Void`, `Text.Show.Text.GHC.RTS.Flags`, `Text.Show.Text.GHC.StaticPtr`, and `Text.Show.Text.Numeric.Natural` modules. Also added `Show` instances for `AllocationLimitExceeded` in `Text.Show.Text.Control.Exception` and `Alt` in `Text.Show.Text.Data.Monoid`. Also fixed the `Show` instance for `Fixed` values.-* Added the `Text.Show.Text.Data.GHC.Conc.Windows` module (Windows-only)-* Added the `Text.Show.Text.Data.OldTypeable` module for base-4.7-* Added the `Text.Show.Text.GHC.TypeLits` module for base-4.6 and above-* Added the `Text.Show.Text.Debug.Trace` and `Text.Show.Text.Debug.Trace.TH` modules as an analog to `Debug.Trace`-* Added the `Show1` class and corresponding instances for unary type constructors.-* Added `LitChar` and `LitString` to `Text.Show.Text.Data.Char`-* Exported `asciiTabB` in `Text.Show.Text.Data.Char`-* Renamed `showbTextStrict` to 'showbText' (to keep with naming conventions in the `text` library) and added `showbBuilder` to `Text.Show.Text.Data.Text`.--## 0.4.1-* Added the utility functions `toText` and `toString` for working with `Builder`s.--# 0.4-* Due to [GHC bug #5289](http://ghc.haskell.org/trac/ghc/ticket/5289), projects that depend on the `double-conversion` library (such as `text-format`, a dependency of `text-show`) may break due to GHC incorrectly linking against libstdc++. Therefore, `text-show` was changed so that it does not depend on `text-format` by default. This behavior can be changed by using the `-ftext-format` flag when using `cabal`.-* Added `showbZonedTime` to `Text.Show.Text.Data.Time` (and corresponding `Show` instance for `ZonedTime`)-* Exposed `showbMaskingState` (is was already there, I just forgot to export it)-* If using GHC 7.6 or earlier, depend on tagged so that `Data.Proxy` (and thus `showbProxy` from `Text.Show.Text.Data.Typeable`) can be used-* Refactored code to use Template Haskell derivations when possible--## 0.3.1.0-* Added `showList` and `showListLazy`-* Don't use `showbListDefault` to show `containers` data types-* Added the ability to splice `show` functions for arbitrary data types (even if they aren't `Show` instances). These functions are `mkShow`, `mkShowLazy`, `mkShowPrec`, `mkShowPrecLazy`, `mkShowb`, `mkShowbPrec`, `mkPrint`, `mkPrintLazy`, `mkHPrint`, and `mkHPrintLazy`.--# 0.3.0.0-* Lots of bugfixes-* `Show` instances for many other data types in `base`, `containers` and `time`-* Exposed internal modules with monomorphic functions-* `Text.Show.Text` now exports `Data.Text.Lazy.Builder` for convenience-* Add `showLazy`, `showPrec`, `showPrecLazy`, `printLazy`, `hPrint`, `hPrintLazy`, `lengthB`, and `replicateB`-* Template Haskell derivation of `Show` instances (doesn't support data families yet)--# 0.2.0.0-* Added `Show` instances for strict and lazy `Text`--# 0.1.0.0-* Initial commit+### 0.7.0.1
+* Disabled `print`-related tests, as they sporadically break referential transparency for unknown reasons
+* Fixed build on Windows
+
+# 0.7
+* Added `showbConstPrec` (and corresponding `Show` and `Show1` instances for `Const`) to `Text.Show.Text.Control.Applicative`
+* Added `showbUArrayPrec` (and corresponding `Show` instance for `UArray`s) and `showbIArrayPrec` to `Text.Data.Text.Data.Array`.
+* Renamed `showbListDefault` to `showbListWith` to match how `Text.Show` names it
+* Exposed `showbShortByteString` with all versions of `bytestring` by using the `bytestring-builder` package
+* Corrected the `Show` instance for `Lexeme` (in `Text.Show.Text.Text.Read.Lex`)
+* Fixed `TypeRep` output on GHC 7.10 and later
+* The Template Haskell deriver now handles showable unlifted types (`Char#`, `Double#`, `Float#`, `Int#`, and `Word#`) correctly on GHC 7.12 and later
+* Removed `LitChar` and `LitString` from `Text.Show.Text.Data.Char`, as they were not as useful as I had imagined.
+* Removed the deprecated `replicateB` function
+* `Typable` instances for `Show`, `Show1`, and `GShow` (with GHC 7.8 and later)
+* `Typeable` instance for `ConType`
+* Only derive `Eq` and `Ord` for `ConType` if a recent-enough version of `text` is used
+* Changed the implementations of some functions in `Text.Show.Text.Debug.Trace` to use `ByteString`s instead of `String`s
+
+### 0.6.0.1
+* Forgot to include some header files in `text-show.cabal`
+
+# 0.6
+* `deriveShow` can now construct instances for data families, using either the data family name or a data instance constructor as an argument. See the documentation in `Text.Show.Text.TH` for more details.
+* Fixed a bug in which infix backticked data constructors (e.g., ```data Add = Int `Plus` Int```) would not be shown correctly.
+* Fixed typo in `Text.Show.Text.GHC.RTS.Flags`
+* Removed the phantom-type detecting mechanism with `template-haskell-2.9.0.0` or higher. This method of finding phantom types is intrinsically flawed and is not usable on older GHCs. I plan on introducing a more robust mechanism for detecting phantom types on more versions of Template Haskell in `text-show-0.7`.
+* Added generics support with the `Text.Show.Text.Generic` and `Text.Show.Text.Debug.Trace.Generic` modules
+* Deprecated `replicateB` in favor of `timesN` from the `semigroups` library
+* Added `FromTextShow` to `Text.Show.Text`, which admits a `String` `Show` instance for any data type with a `Text` `Show` instance (the counterpart of `FromStringShow`)
+* Added `Monoid` and `Semigroup` instances for `FromStringShow`, `Semigroup` instance for `LitString`, `IsChar` instance for `LitChar`, and `IsString` instance for `[LitChar]`
+* Changed the `String` `Show` instances of `FromStringShow`, `LitChar`, and `LitString` to more closely match the `Text` `Show` instances. As a result, the `Read` instances for these data types were also changed so that `read . show = read . show = id`.
+* Removed the `recent-text` flag. We'll allow users to build with older versions of `text`, but the latest version is recommended. Because of this, the `integer-simple` and `integer-gmp` flags are not needed.
+* Removed the `integer-gmp2` flag, as it supported a configuration that didn't actually compile on GHC
+* Removed the `transformers-four` flag, as it is not needed now that `transformers-compat` is a dependency
+
+# 0.5
+* Fix build for GHC 7.10, old GHC versions, and Windows
+* Removed the `Text.Show.Text.Data.Containers` and `Text.Show.Text.Data.Time` modules. The modules for the data types in `containers` and `time` were migrated to a separate library, `text-show-instances`.
+* Removed the `-ftext-format` flag, as `text-show` no longer uses `text-format`.
+* A [serious bug](https://github.com/bos/text/issues/99) in the `text` package that caused segfaults when building large `Integer`s was fixed in `text-1.2.0.2`. A flag (`-frecent-text`) was added that allows you to take advantage of this.
+* Fixed a bug that would cause the output of functions in the `Text.Show.Text.Data.Floating` module to not match `base` depending on what version of `base` is used.
+* The type signatures of lambda expressions generated by `mkShow` and related functions were loosened to allow them to be used to "manually" derive `Show` instances for data types with higher-kinded type parameters or type arguments with restricted `Show` instances. This should not be a breaking change; you can simply do more with `mkShow` et al. than you could before. For more information, see the documentation in `Text.Show.Text.TH`.
+* Loosened the `Show` instance of `Complex a` to only depend on `Show a` (previously required `RealFloat a`) if using base-4.4.0.0 or later
+* Moved `showbRatioPrec` to `Text.Show.Text.Data.Ratio`, `showbComplexPrec` to `Text.Show.Text.Data.Complex`, `showbProxy` to `Text.Show.Text.Data.Proxy`, and `showbFingerprint` to `Text.Show.Text.GHC.Fingerprint`
+* Added `deriveShowPragmas` to `Text.Show.Text.TH` to allow users to specify `INLINE` or `SPECIALIZE instance` pragmas with `Show` instances.
+* Added `FromStringShow`, `showbSpace`, `showbUnary`, `showbUnary1`, and `showbBinary1` to `Text.Show.Text`
+* Added `mkShowList`, `mkShowListLazy`, and `mkShowbList` to `Text.Data.Text.TH`
+* For base-4.8.0.0 and above, added the `Text.Show.Text.Data.Functor.Identity`, `Text.Show.Text.Data.Void`, `Text.Show.Text.GHC.RTS.Flags`, `Text.Show.Text.GHC.StaticPtr`, and `Text.Show.Text.Numeric.Natural` modules. Also added `Show` instances for `AllocationLimitExceeded` in `Text.Show.Text.Control.Exception` and `Alt` in `Text.Show.Text.Data.Monoid`. Also fixed the `Show` instance for `Fixed` values.
+* Added the `Text.Show.Text.Data.GHC.Conc.Windows` module (Windows-only)
+* Added the `Text.Show.Text.Data.OldTypeable` module for base-4.7
+* Added the `Text.Show.Text.GHC.TypeLits` module for base-4.6 and above
+* Added the `Text.Show.Text.Debug.Trace` and `Text.Show.Text.Debug.Trace.TH` modules as an analog to `Debug.Trace`
+* Added the `Show1` class and corresponding instances for unary type constructors.
+* Added `LitChar` and `LitString` to `Text.Show.Text.Data.Char`
+* Exported `asciiTabB` in `Text.Show.Text.Data.Char`
+* Renamed `showbTextStrict` to 'showbText' (to keep with naming conventions in the `text` library) and added `showbBuilder` to `Text.Show.Text.Data.Text`.
+
+## 0.4.1
+* Added the utility functions `toText` and `toString` for working with `Builder`s.
+
+# 0.4
+* Due to [GHC bug #5289](http://ghc.haskell.org/trac/ghc/ticket/5289), projects that depend on the `double-conversion` library (such as `text-format`, a dependency of `text-show`) may break due to GHC incorrectly linking against libstdc++. Therefore, `text-show` was changed so that it does not depend on `text-format` by default. This behavior can be changed by using the `-ftext-format` flag when using `cabal`.
+* Added `showbZonedTime` to `Text.Show.Text.Data.Time` (and corresponding `Show` instance for `ZonedTime`)
+* Exposed `showbMaskingState` (is was already there, I just forgot to export it)
+* If using GHC 7.6 or earlier, depend on tagged so that `Data.Proxy` (and thus `showbProxy` from `Text.Show.Text.Data.Typeable`) can be used
+* Refactored code to use Template Haskell derivations when possible
+
+## 0.3.1.0
+* Added `showList` and `showListLazy`
+* Don't use `showbListDefault` to show `containers` data types
+* Added the ability to splice `show` functions for arbitrary data types (even if they aren't `Show` instances). These functions are `mkShow`, `mkShowLazy`, `mkShowPrec`, `mkShowPrecLazy`, `mkShowb`, `mkShowbPrec`, `mkPrint`, `mkPrintLazy`, `mkHPrint`, and `mkHPrintLazy`.
+
+# 0.3.0.0
+* Lots of bugfixes
+* `Show` instances for many other data types in `base`, `containers` and `time`
+* Exposed internal modules with monomorphic functions
+* `Text.Show.Text` now exports `Data.Text.Lazy.Builder` for convenience
+* Add `showLazy`, `showPrec`, `showPrecLazy`, `printLazy`, `hPrint`, `hPrintLazy`, `lengthB`, and `replicateB`
+* Template Haskell derivation of `Show` instances (doesn't support data families yet)
+
+# 0.2.0.0
+* Added `Show` instances for strict and lazy `Text`
+
+# 0.1.0.0
+* Initial commit
LICENSE view
@@ -1,30 +1,30 @@-Copyright (c) 2014, Ryan Scott--All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:--    * Redistributions of source code must retain the above copyright-      notice, this list of conditions and the following disclaimer.--    * Redistributions in binary form must reproduce the above-      copyright notice, this list of conditions and the following-      disclaimer in the documentation and/or other materials provided-      with the distribution.--    * Neither the name of Ryan Scott nor the names of other-      contributors may be used to endorse or promote products derived-      from this software without specific prior written permission.--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+Copyright (c) 2014, Ryan Scott
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of Ryan Scott nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
README.md view
@@ -1,23 +1,23 @@-# `text-show` [![Hackage version](https://img.shields.io/hackage/v/text-show.svg?style=flat)](http://hackage.haskell.org/package/text-show) [![Build Status](https://img.shields.io/travis/RyanGlScott/text-show.svg?style=flat)](https://travis-ci.org/RyanGlScott/text-show)--`text-show` offers a replacement for the `Show` typeclass intended for use with `Text` instead of `String`s. This package was created in the spirit of [`bytestring-show`](http://hackage.haskell.org/package/bytestring-show).--At the moment, `text-show` provides `Show` instances for most data types in the [`array`](http://hackage.haskell.org/package/array), [`base`](http://hackage.haskell.org/package/base), [`bytestring`](http://hackage.haskell.org/package/bytestring), and [`text`](http://hackage.haskell.org/package/text) packages. Therefore, much of the source code for `text-show` consists of borrowed code from those packages in order to ensure that the behaviors of the two `Show` typeclasses coincide.--For most uses, simply importing `Text.Show.Text` will suffice:--```haskell-module Main where--import Data.Text (Text)-import Prelude hiding (Show(..), print)-import Text.Show.Text--hello :: Text-hello = show (Just "Hello, World!")--main :: IO ()-main = print hello-```--If you desire it, there are also monomorphic versions of the `showb` function available in the submodules of `Text.Show.Text`. A naming convention is present in which functions that show different values depending on the precedence end with `Prec`(e.g., `showbIntPrec`), whereas functions that show the same values regardless of precedence do not end with `Prec` (e.g., `showbBool`).+# `text-show` [![Hackage version](https://img.shields.io/hackage/v/text-show.svg?style=flat)](http://hackage.haskell.org/package/text-show) [![Build Status](https://img.shields.io/travis/RyanGlScott/text-show.svg?style=flat)](https://travis-ci.org/RyanGlScott/text-show)
+
+`text-show` offers a replacement for the `Show` typeclass intended for use with `Text` instead of `String`s. This package was created in the spirit of [`bytestring-show`](http://hackage.haskell.org/package/bytestring-show).
+
+At the moment, `text-show` provides `Show` instances for most data types in the [`array`](http://hackage.haskell.org/package/array), [`base`](http://hackage.haskell.org/package/base), [`bytestring`](http://hackage.haskell.org/package/bytestring), and [`text`](http://hackage.haskell.org/package/text) packages. Therefore, much of the source code for `text-show` consists of borrowed code from those packages in order to ensure that the behaviors of the two `Show` typeclasses coincide.
+
+For most uses, simply importing `Text.Show.Text` will suffice:
+
+```haskell
+module Main where
+
+import Data.Text (Text)
+import Prelude hiding (Show(..), print)
+import Text.Show.Text
+
+hello :: Text
+hello = show (Just "Hello, World!")
+
+main :: IO ()
+main = print hello
+```
+
+If you desire it, there are also monomorphic versions of the `showb` function available in the submodules of `Text.Show.Text`. A naming convention is present in which functions that show different values depending on the precedence end with `Prec`(e.g., `showbIntPrec`), whereas functions that show the same values regardless of precedence do not end with `Prec` (e.g., `showbBool`).
Setup.hs view
@@ -1,2 +1,2 @@-import Distribution.Simple-main = defaultMain+import Distribution.Simple
+main = defaultMain
include/inline.h view
@@ -1,12 +1,12 @@-#ifndef INLINE_H-#define INLINE_H--#include "utils.h"--#if __GLASGOW_HASKELL__ >= 702-# define INLINE_INST_FUN(F) OPEN_PRAGMA INLINE F CLOSE_PRAGMA-#else-# define INLINE_INST_FUN(F)-#endif--#endif+#ifndef INLINE_H
+#define INLINE_H
+
+#include "utils.h"
+
+#if __GLASGOW_HASKELL__ >= 702
+# define INLINE_INST_FUN(F) OPEN_PRAGMA INLINE F CLOSE_PRAGMA
+#else
+# define INLINE_INST_FUN(F)
+#endif
+
+#endif
include/overlap.h view
@@ -1,18 +1,18 @@-#ifndef OVERLAP_H-#define OVERLAP_H--#include "utils.h"--#if __GLASGOW_HASKELL__ >= 710-# define __LANGUAGE_OVERLAPPING_INSTANCES__-# define __OVERLAPPABLE__ OPEN_PRAGMA OVERLAPPABLE CLOSE_PRAGMA-# define __OVERLAPPING__ OPEN_PRAGMA OVERLAPPING CLOSE_PRAGMA-# define __OVERLAPS__ OPEN_PRAGMA OVERLAPPABLE CLOSE_PRAGMA-#else-# define __LANGUAGE_OVERLAPPING_INSTANCES__ OPEN_PRAGMA LANGUAGE OverlappingInstances CLOSE_PRAGMA-# define __OVERLAPPABLE__-# define __OVERLAPPING__-# define __OVERLAPS__-#endif--#endif+#ifndef OVERLAP_H
+#define OVERLAP_H
+
+#include "utils.h"
+
+#if __GLASGOW_HASKELL__ >= 710
+# define __LANGUAGE_OVERLAPPING_INSTANCES__
+# define __OVERLAPPABLE__ OPEN_PRAGMA OVERLAPPABLE CLOSE_PRAGMA
+# define __OVERLAPPING__ OPEN_PRAGMA OVERLAPPING CLOSE_PRAGMA
+# define __OVERLAPS__ OPEN_PRAGMA OVERLAPPABLE CLOSE_PRAGMA
+#else
+# define __LANGUAGE_OVERLAPPING_INSTANCES__ OPEN_PRAGMA LANGUAGE OverlappingInstances CLOSE_PRAGMA
+# define __OVERLAPPABLE__
+# define __OVERLAPPING__
+# define __OVERLAPS__
+#endif
+
+#endif
include/utils.h view
@@ -1,7 +1,7 @@-#ifndef UTILS_H-#define UTILS_H--#define OPEN_PRAGMA {-#-#define CLOSE_PRAGMA #-}--#endif+#ifndef UTILS_H
+#define UTILS_H
+
+#define OPEN_PRAGMA {-#
+#define CLOSE_PRAGMA #-}
+
+#endif
src/Text/Show/Text.hs view
@@ -1,52 +1,52 @@-{-|-Module:      Text.Show.Text-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Efficiently convert from values to 'Text' via 'Builder's.--/Since: 0.1/--}-module Text.Show.Text (-      -- * The 'Show' class-      Show(..)-    , show-    , showLazy-    , showPrec-    , showPrecLazy-    , showList-    , showListLazy-    , showbParen-    , showbSpace-    , showbUnary-    , Show1(..)-    , showbUnary1-    , showbBinary1-      -- * 'Builder's-    , module Data.Text.Lazy.Builder-    , toString-    , toText-    , lengthB-    , unlinesB-    , unwordsB-      -- * Printing values-    , print-    , printLazy-    , hPrint-    , hPrintLazy-      -- * Conversion between @String@ and @Text@ 'Show'-    , FromStringShow(..)-    , FromTextShow(..)-    ) where--import Data.Text.Lazy.Builder--import Prelude hiding (Show(show, showList), print)--import Text.Show.Text.Classes-import Text.Show.Text.Instances ()-import Text.Show.Text.Utils (toString, toText, lengthB,-                             unlinesB, unwordsB)+{-|
+Module:      Text.Show.Text
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Efficiently convert from values to 'Text' via 'Builder's.
+
+/Since: 0.1/
+-}
+module Text.Show.Text (
+      -- * The 'Show' class
+      Show(..)
+    , show
+    , showLazy
+    , showPrec
+    , showPrecLazy
+    , showList
+    , showListLazy
+    , showbParen
+    , showbSpace
+    , showbUnary
+    , Show1(..)
+    , showbUnary1
+    , showbBinary1
+      -- * 'Builder's
+    , module Data.Text.Lazy.Builder
+    , toString
+    , toText
+    , lengthB
+    , unlinesB
+    , unwordsB
+      -- * Printing values
+    , print
+    , printLazy
+    , hPrint
+    , hPrintLazy
+      -- * Conversion between @String@ and @Text@ 'Show'
+    , FromStringShow(..)
+    , FromTextShow(..)
+    ) where
+
+import Data.Text.Lazy.Builder
+
+import Prelude hiding (Show(show, showList), print)
+
+import Text.Show.Text.Classes
+import Text.Show.Text.Instances ()
+import Text.Show.Text.Utils (toString, toText, lengthB,
+                             unlinesB, unwordsB)
src/Text/Show/Text/Classes.hs view
@@ -1,476 +1,476 @@-{-# LANGUAGE CPP                        #-}-{-# LANGUAGE DeriveDataTypeable         #-}-{-# LANGUAGE DeriveFoldable             #-}-{-# LANGUAGE DeriveFunctor              #-}-{-# LANGUAGE DeriveTraversable          #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE OverloadedStrings          #-}--#if MIN_VERSION_base(4,4,0)-{-# LANGUAGE DeriveGeneric              #-}-#endif--#if __GLASGOW_HASKELL__ >= 708-{-# LANGUAGE StandaloneDeriving         #-}-{-# LANGUAGE TypeFamilies               #-}-#endif-{-|-Module:      Text.Show.Text.Classes-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--The 'Show' and 'Show1' typeclasses.--}-module Text.Show.Text.Classes where--#if !(MIN_VERSION_base(4,8,0))-import           Control.Applicative (Applicative((<*>), pure))-import           Data.Foldable (Foldable)-import           Data.Functor ((<$>))-import           Data.Monoid (Monoid)-import           Data.Traversable (Traversable)-#endif--import           Control.Monad.Fix (MonadFix(..))-#if MIN_VERSION_base(4,4,0)-import           Control.Monad.Zip (MonadZip(..))-#endif--import           Data.Bits (Bits)-#if MIN_VERSION_base(4,7,0)-import           Data.Bits (FiniteBits)-#endif-import           Data.Data (Data, Typeable)-import           Data.Ix (Ix)-import           Data.Semigroup (Semigroup)-import           Data.String (IsString)-import           Data.Text         as TS (Text)-import qualified Data.Text.IO      as TS (putStrLn, hPutStrLn)-import qualified Data.Text.Lazy    as TL (Text)-import qualified Data.Text.Lazy.IO as TL (putStrLn, hPutStrLn)-import           Data.Text.Lazy (toStrict)-import           Data.Text.Lazy.Builder (Builder, fromString, toLazyText)--import           Foreign.Storable (Storable)--#if __GLASGOW_HASKELL__ >= 708-import           GHC.Exts (IsList(Item, fromList, toList))-#endif-#if MIN_VERSION_base(4,4,0)-import           GHC.Generics (Generic)-# if __GLASGOW_HASKELL__ >= 706-import           GHC.Generics (Generic1)-# endif-#endif-import           GHC.Show (appPrec, appPrec1)--import           Prelude hiding (Show(..))--import           System.IO (Handle)--import           Text.Printf (PrintfArg, PrintfType)-import           Text.Read (Read(..), readListPrecDefault)-import qualified Text.Show as S (Show(..))-import           Text.Show.Text.Utils ((<>), s, toString)--#include "inline.h"---- | Conversion of values to @Text@. Because there are both strict and lazy @Text@--- variants, the 'Show' class deliberately avoids using @Text@ in its functions.--- Instead, 'showbPrec', 'showb', and 'showbList' all return 'Builder', an--- efficient intermediate form that can be converted to either kind of @Text@.--- --- 'Builder' is a 'Monoid', so it is useful to use the 'mappend' (or '<>') function--- to combine 'Builder's when creating 'Show' instances. As an example:--- --- @--- import Text.Show.Text--- --- data Example = Example Int Int--- instance Show Example where---     showb (Example i1 i2) = showb i1 <> showbSpace <> showb i2--- @--- --- If you do not want to create 'Show' instances manually, you can alternatively--- use the "Text.Show.Text.TH" module to automatically generate default 'Show'--- instances using Template Haskell, or the "Text.Show.Text.Generic" module to--- quickly define 'Show' instances using 'genericShowbPrec'.--- --- /Since: 0.1/-class Show a where-    -- | Convert a value to a 'Builder' with the given predence.-    -- -    -- /Since: 0.1/-    showbPrec :: Int -- ^ The operator precedence of the enclosing context (a number-                     -- from @0@ to @11@). Function application has precedence @10@.-              -> a   -- ^ The value to be converted to a 'String'.-              -> Builder-    -    -- | A specialized variant of 'showbPrec' using precedence context zero.-    -- -    -- /Since: 0.1/-    showb :: a -> Builder-    -    -- | Allows for specialized display of lists. This is used, for example, when-    -- showing lists of 'Char's.-    -- -    -- /Since: 0.1/-    showbList :: [a] -> Builder-    -    showbPrec _ = showb-    -    showb = showbPrec 0-    -    showbList = showbListWith showb-#if __GLASGOW_HASKELL__ >= 708-    {-# MINIMAL showbPrec | showb #-}--deriving instance Typeable Show-#endif---- | Lifting of the 'Show' class to unary type constructors.--- --- /Since: 0.5/-class Show1 f where-    -- | 'Builder' conversion for values of a type that has a unary type constructor.-    -- -    -- /Since: 0.5/-    showbPrec1 :: Show a => Int -> f a -> Builder--#if __GLASGOW_HASKELL__ >= 708-deriving instance Typeable Show1-#endif---- | Constructs a strict 'TS.Text' from a single value.--- --- /Since: 0.1/-show :: Show a => a -> TS.Text-show = toStrict . showLazy-{-# INLINE show #-}---- | Constructs a lazy 'TL.Text' from a single value.--- --- /Since: 0.3/-showLazy :: Show a => a -> TL.Text-showLazy = toLazyText . showb-{-# INLINE showLazy #-}---- | Constructs a strict 'TS.Text' from a single value with the given precedence.--- --- /Since: 0.3/-showPrec :: Show a => Int -> a -> TS.Text-showPrec p = toStrict . showPrecLazy p-{-# INLINE showPrec #-}---- | Constructs a lazy 'TL.Text' from a single value with the given precedence.--- --- /Since: 0.3/-showPrecLazy :: Show a => Int -> a -> TL.Text-showPrecLazy p = toLazyText . showbPrec p-{-# INLINE showPrecLazy #-}---- | Construct a strict 'TS.Text' from a list of values.--- --- /Since: 0.3.1/-showList :: Show a => [a] -> TS.Text-showList = toStrict . showListLazy-{-# INLINE showList #-}---- | Construct a lazy 'TL.Text' from a list of values.--- --- /Since: 0.3.1/-showListLazy :: Show a => [a] -> TL.Text-showListLazy = toLazyText . showbList-{-# INLINE showListLazy #-}---- | Surrounds 'Builder' output with parentheses if the 'Bool' parameter is 'True'.--- --- /Since: 0.1/-showbParen :: Bool -> Builder -> Builder-showbParen p builder | p         = s '(' <> builder <> s ')'-                     | otherwise = builder-{-# INLINE showbParen #-}---- | Construct a 'Builder' containing a single space character.--- --- /Since: 0.5/-showbSpace :: Builder-showbSpace = s ' '-{-# INLINE showbSpace #-}---- | Converts a list of values into a 'Builder' in which the values are surrounded--- by square brackets and each value is separated by a comma. The function argument--- controls how each element is shown.---- @'showbListWith' 'showb'@ is the default implementation of 'showbList' save for--- a few special cases (e.g., 'String').--- --- /Since: 0.7/-showbListWith :: (a -> Builder) -> [a] -> Builder-showbListWith _      []     = "[]"-showbListWith showbx (x:xs) = s '[' <> showbx x <> go xs -- "[..-  where-    go (y:ys) = s ',' <> showbx y <> go ys               -- ..,..-    go []     = s ']'                                    -- ..]"-{-# INLINE showbListWith #-}---- | @'showbUnary' n p x@ produces the 'Builder' representation of a unary data--- constructor with name @n@ and argument @x@, in precedence context @p@.--- --- /Since: 0.5/-showbUnary :: Show a => Builder -> Int -> a -> Builder-showbUnary nameB p x = showbParen (p > appPrec) $-    nameB <> showbSpace <> showbPrec appPrec1 x-{-# INLINE showbUnary #-}---- | @'showbUnary1' n p x@ produces the 'Builder' representation of a unary data--- constructor with name @n@ and argument @x@, in precedence context @p@.--- --- /Since: 0.5/-showbUnary1 :: (Show1 f, Show a) => Builder -> Int -> f a -> Builder-showbUnary1 nameB p x = showbParen (p > appPrec) $-    nameB <> showbSpace <> showbPrec1 appPrec1 x-{-# INLINE showbUnary1 #-}---- | @'showbBinary1' n p x y@ produces the 'Builder' representation of a binary--- data constructor with name @n@ and arguments @x@ and @y@, in precedence--- context @p@.--- --- /Since: 0.5/-showbBinary1 :: (Show1 f, Show1 g, Show a) => Builder -> Int -> f a -> g a -> Builder-showbBinary1 nameB p x y = showbParen (p > appPrec) $ nameB-    <> showbSpace <> showbPrec1 appPrec1 x-    <> showbSpace <> showbPrec1 appPrec1 y-{-# INLINE showbBinary1 #-}---- | Writes a value's strict 'TS.Text' representation to the standard output, followed---   by a newline.--- --- /Since: 0.1/-print :: Show a => a -> IO ()-print = TS.putStrLn . show-{-# INLINE print #-}---- | Writes a value's lazy 'TL.Text' representation to the standard output, followed---   by a newline.--- --- /Since: 0.3/-printLazy :: Show a => a -> IO ()-printLazy = TL.putStrLn . showLazy-{-# INLINE printLazy #-}---- | Writes a value's strict 'TS.Text' representation to a file handle, followed---   by a newline.--- --- /Since: 0.3/-hPrint :: Show a => Handle -> a -> IO ()-hPrint h = TS.hPutStrLn h . show-{-# INLINE hPrint #-}---- | Writes a value's lazy 'TL.Text' representation to a file handle, followed---   by a newline.--- --- /Since: 0.3/-hPrintLazy :: Show a => Handle -> a -> IO ()-hPrintLazy h = TL.hPutStrLn h . showLazy-{-# INLINE hPrintLazy #-}---- | The @Text@ 'T.Show' instance for 'FromStringShow' is based on its @String@--- 'S.Show' instance. That is,--- --- @--- showbPrec p ('FromStringShow' x) = 'fromString' (showsPrec p x "")--- @--- --- /Since: 0.5/-newtype FromStringShow a = FromStringShow { fromStringShow :: a }-  deriving ( Bits-           , Bounded-           , Data-           , Enum-           , Eq-#if MIN_VERSION_base(4,7,0)-           , FiniteBits-#endif-           , Floating-           , Foldable-           , Fractional-           , Functor-#if MIN_VERSION_base(4,4,0)-           , Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-#endif-           , Integral-           , IsString-           , Ix-           , Monoid-           , Num-           , Ord-           , PrintfArg-           , PrintfType-           , Real-           , RealFloat-           , RealFrac-           , Semigroup-           , Storable-           , Traversable-           , Typeable-           )--instance Applicative FromStringShow where-    pure = FromStringShow-    INLINE_INST_FUN(pure)-    -    FromStringShow f <*> FromStringShow x = FromStringShow $ f x-    INLINE_INST_FUN((<*>))--#if __GLASGOW_HASKELL__ >= 708-instance IsList a => IsList (FromStringShow a) where-    type Item (FromStringShow a) = Item a-    fromList = FromStringShow . fromList-    {-# INLINE fromList #-}-    toList = toList . fromStringShow-    {-# INLINE toList #-}-#endif--instance Monad FromStringShow where-    return = FromStringShow-    INLINE_INST_FUN(return)-    -    FromStringShow a >>= f = f a-    INLINE_INST_FUN((>>=))--instance MonadFix FromStringShow where-    mfix f = FromStringShow $ let FromStringShow a = f a in a-    INLINE_INST_FUN(mfix)--#if MIN_VERSION_base(4,4,0)-instance MonadZip FromStringShow where-    mzip (FromStringShow a) (FromStringShow b) = FromStringShow (a, b)-    INLINE_INST_FUN(mzip)-    -    mzipWith f (FromStringShow a) (FromStringShow b) = FromStringShow $ f a b-    INLINE_INST_FUN(mzipWith)-    -    munzip (FromStringShow (a, b)) = (FromStringShow a, FromStringShow b)-    INLINE_INST_FUN(munzip)-#endif--instance Read a => Read (FromStringShow a) where-    readPrec = FromStringShow <$> readPrec-    INLINE_INST_FUN(readPrec)-    -    readListPrec = readListPrecDefault-    INLINE_INST_FUN(readListPrec)--instance S.Show a => Show (FromStringShow a) where-    showbPrec p (FromStringShow x) = fromString $ S.showsPrec p x ""-    INLINE_INST_FUN(showbPrec)--instance S.Show a => S.Show (FromStringShow a) where-    showsPrec p (FromStringShow x) = S.showsPrec p x-    INLINE_INST_FUN(showsPrec)---- | The @String@ 'S.Show' instance for 'FromTextShow' is based on its @Text@--- 'T.Show' instance. That is,--- --- @--- showsPrec p ('FromTextShow' x) str = 'toString' (showbPrec p x) ++ str--- @--- --- /Since: 0.6/-newtype FromTextShow a = FromTextShow { fromTextShow :: a }-  deriving ( Bits-           , Bounded-           , Data-           , Enum-           , Eq-#if MIN_VERSION_base(4,7,0)-           , FiniteBits-#endif-           , Floating-           , Foldable-           , Fractional-           , Functor-#if MIN_VERSION_base(4,4,0)-           , Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-#endif-           , Integral-           , IsString-           , Ix-           , Monoid-           , Num-           , Ord-           , PrintfArg-           , PrintfType-           , Real-           , RealFloat-           , RealFrac-           , Semigroup-           , Show-           , Storable-           , Traversable-           , Typeable-           )--instance Applicative FromTextShow where-    pure = FromTextShow-    INLINE_INST_FUN(pure)-    -    FromTextShow f <*> FromTextShow x = FromTextShow $ f x-    INLINE_INST_FUN((<*>))--#if __GLASGOW_HASKELL__ >= 708-instance IsList a => IsList (FromTextShow a) where-    type Item (FromTextShow a) = Item a-    fromList = FromTextShow . fromList-    {-# INLINE fromList #-}-    toList = toList . fromTextShow-    {-# INLINE toList #-}-#endif--instance Monad FromTextShow where-    return = FromTextShow-    INLINE_INST_FUN(return)-    -    FromTextShow a >>= f = f a-    INLINE_INST_FUN((>>=))--instance MonadFix FromTextShow where-    mfix f = FromTextShow $ let FromTextShow a = f a in a-    INLINE_INST_FUN(mfix)--#if MIN_VERSION_base(4,4,0)-instance MonadZip FromTextShow where-    mzip (FromTextShow a) (FromTextShow b) = FromTextShow (a, b)-    INLINE_INST_FUN(mzip)-    -    mzipWith f (FromTextShow a) (FromTextShow b) = FromTextShow $ f a b-    INLINE_INST_FUN(mzipWith)-    -    munzip (FromTextShow (a, b)) = (FromTextShow a, FromTextShow b)-    INLINE_INST_FUN(munzip)-#endif--instance Read a => Read (FromTextShow a) where-    readPrec = FromTextShow <$> readPrec-    INLINE_INST_FUN(readPrec)-    -    readListPrec = readListPrecDefault-    INLINE_INST_FUN(readListPrec)--instance Show a => S.Show (FromTextShow a) where-    showsPrec p (FromTextShow x) str = toString (showbPrec p x) ++ str-    INLINE_INST_FUN(showsPrec)--instance Show1 FromTextShow where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE DeriveDataTypeable         #-}
+{-# LANGUAGE DeriveFoldable             #-}
+{-# LANGUAGE DeriveFunctor              #-}
+{-# LANGUAGE DeriveTraversable          #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE OverloadedStrings          #-}
+
+#if MIN_VERSION_base(4,4,0)
+{-# LANGUAGE DeriveGeneric              #-}
+#endif
+
+#if __GLASGOW_HASKELL__ >= 708
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# LANGUAGE TypeFamilies               #-}
+#endif
+{-|
+Module:      Text.Show.Text.Classes
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+The 'Show' and 'Show1' typeclasses.
+-}
+module Text.Show.Text.Classes where
+
+#if !(MIN_VERSION_base(4,8,0))
+import           Control.Applicative (Applicative((<*>), pure))
+import           Data.Foldable (Foldable)
+import           Data.Functor ((<$>))
+import           Data.Monoid (Monoid)
+import           Data.Traversable (Traversable)
+#endif
+
+import           Control.Monad.Fix (MonadFix(..))
+#if MIN_VERSION_base(4,4,0)
+import           Control.Monad.Zip (MonadZip(..))
+#endif
+
+import           Data.Bits (Bits)
+#if MIN_VERSION_base(4,7,0)
+import           Data.Bits (FiniteBits)
+#endif
+import           Data.Data (Data, Typeable)
+import           Data.Ix (Ix)
+import           Data.Semigroup (Semigroup)
+import           Data.String (IsString)
+import           Data.Text         as TS (Text)
+import qualified Data.Text.IO      as TS (putStrLn, hPutStrLn)
+import qualified Data.Text.Lazy    as TL (Text)
+import qualified Data.Text.Lazy.IO as TL (putStrLn, hPutStrLn)
+import           Data.Text.Lazy (toStrict)
+import           Data.Text.Lazy.Builder (Builder, fromString, toLazyText)
+
+import           Foreign.Storable (Storable)
+
+#if __GLASGOW_HASKELL__ >= 708
+import           GHC.Exts (IsList(Item, fromList, toList))
+#endif
+#if MIN_VERSION_base(4,4,0)
+import           GHC.Generics (Generic)
+# if __GLASGOW_HASKELL__ >= 706
+import           GHC.Generics (Generic1)
+# endif
+#endif
+import           GHC.Show (appPrec, appPrec1)
+
+import           Prelude hiding (Show(..))
+
+import           System.IO (Handle)
+
+import           Text.Printf (PrintfArg, PrintfType)
+import           Text.Read (Read(..), readListPrecDefault)
+import qualified Text.Show as S (Show(..))
+import           Text.Show.Text.Utils ((<>), s, toString)
+
+#include "inline.h"
+
+-- | Conversion of values to @Text@. Because there are both strict and lazy @Text@
+-- variants, the 'Show' class deliberately avoids using @Text@ in its functions.
+-- Instead, 'showbPrec', 'showb', and 'showbList' all return 'Builder', an
+-- efficient intermediate form that can be converted to either kind of @Text@.
+-- 
+-- 'Builder' is a 'Monoid', so it is useful to use the 'mappend' (or '<>') function
+-- to combine 'Builder's when creating 'Show' instances. As an example:
+-- 
+-- @
+-- import Text.Show.Text
+-- 
+-- data Example = Example Int Int
+-- instance Show Example where
+--     showb (Example i1 i2) = showb i1 <> showbSpace <> showb i2
+-- @
+-- 
+-- If you do not want to create 'Show' instances manually, you can alternatively
+-- use the "Text.Show.Text.TH" module to automatically generate default 'Show'
+-- instances using Template Haskell, or the "Text.Show.Text.Generic" module to
+-- quickly define 'Show' instances using 'genericShowbPrec'.
+-- 
+-- /Since: 0.1/
+class Show a where
+    -- | Convert a value to a 'Builder' with the given predence.
+    -- 
+    -- /Since: 0.1/
+    showbPrec :: Int -- ^ The operator precedence of the enclosing context (a number
+                     -- from @0@ to @11@). Function application has precedence @10@.
+              -> a   -- ^ The value to be converted to a 'String'.
+              -> Builder
+    
+    -- | A specialized variant of 'showbPrec' using precedence context zero.
+    -- 
+    -- /Since: 0.1/
+    showb :: a -> Builder
+    
+    -- | Allows for specialized display of lists. This is used, for example, when
+    -- showing lists of 'Char's.
+    -- 
+    -- /Since: 0.1/
+    showbList :: [a] -> Builder
+    
+    showbPrec _ = showb
+    
+    showb = showbPrec 0
+    
+    showbList = showbListWith showb
+#if __GLASGOW_HASKELL__ >= 708
+    {-# MINIMAL showbPrec | showb #-}
+
+deriving instance Typeable Show
+#endif
+
+-- | Lifting of the 'Show' class to unary type constructors.
+-- 
+-- /Since: 0.5/
+class Show1 f where
+    -- | 'Builder' conversion for values of a type that has a unary type constructor.
+    -- 
+    -- /Since: 0.5/
+    showbPrec1 :: Show a => Int -> f a -> Builder
+
+#if __GLASGOW_HASKELL__ >= 708
+deriving instance Typeable Show1
+#endif
+
+-- | Constructs a strict 'TS.Text' from a single value.
+-- 
+-- /Since: 0.1/
+show :: Show a => a -> TS.Text
+show = toStrict . showLazy
+{-# INLINE show #-}
+
+-- | Constructs a lazy 'TL.Text' from a single value.
+-- 
+-- /Since: 0.3/
+showLazy :: Show a => a -> TL.Text
+showLazy = toLazyText . showb
+{-# INLINE showLazy #-}
+
+-- | Constructs a strict 'TS.Text' from a single value with the given precedence.
+-- 
+-- /Since: 0.3/
+showPrec :: Show a => Int -> a -> TS.Text
+showPrec p = toStrict . showPrecLazy p
+{-# INLINE showPrec #-}
+
+-- | Constructs a lazy 'TL.Text' from a single value with the given precedence.
+-- 
+-- /Since: 0.3/
+showPrecLazy :: Show a => Int -> a -> TL.Text
+showPrecLazy p = toLazyText . showbPrec p
+{-# INLINE showPrecLazy #-}
+
+-- | Construct a strict 'TS.Text' from a list of values.
+-- 
+-- /Since: 0.3.1/
+showList :: Show a => [a] -> TS.Text
+showList = toStrict . showListLazy
+{-# INLINE showList #-}
+
+-- | Construct a lazy 'TL.Text' from a list of values.
+-- 
+-- /Since: 0.3.1/
+showListLazy :: Show a => [a] -> TL.Text
+showListLazy = toLazyText . showbList
+{-# INLINE showListLazy #-}
+
+-- | Surrounds 'Builder' output with parentheses if the 'Bool' parameter is 'True'.
+-- 
+-- /Since: 0.1/
+showbParen :: Bool -> Builder -> Builder
+showbParen p builder | p         = s '(' <> builder <> s ')'
+                     | otherwise = builder
+{-# INLINE showbParen #-}
+
+-- | Construct a 'Builder' containing a single space character.
+-- 
+-- /Since: 0.5/
+showbSpace :: Builder
+showbSpace = s ' '
+{-# INLINE showbSpace #-}
+
+-- | Converts a list of values into a 'Builder' in which the values are surrounded
+-- by square brackets and each value is separated by a comma. The function argument
+-- controls how each element is shown.
+
+-- @'showbListWith' 'showb'@ is the default implementation of 'showbList' save for
+-- a few special cases (e.g., 'String').
+-- 
+-- /Since: 0.7/
+showbListWith :: (a -> Builder) -> [a] -> Builder
+showbListWith _      []     = "[]"
+showbListWith showbx (x:xs) = s '[' <> showbx x <> go xs -- "[..
+  where
+    go (y:ys) = s ',' <> showbx y <> go ys               -- ..,..
+    go []     = s ']'                                    -- ..]"
+{-# INLINE showbListWith #-}
+
+-- | @'showbUnary' n p x@ produces the 'Builder' representation of a unary data
+-- constructor with name @n@ and argument @x@, in precedence context @p@.
+-- 
+-- /Since: 0.5/
+showbUnary :: Show a => Builder -> Int -> a -> Builder
+showbUnary nameB p x = showbParen (p > appPrec) $
+    nameB <> showbSpace <> showbPrec appPrec1 x
+{-# INLINE showbUnary #-}
+
+-- | @'showbUnary1' n p x@ produces the 'Builder' representation of a unary data
+-- constructor with name @n@ and argument @x@, in precedence context @p@.
+-- 
+-- /Since: 0.5/
+showbUnary1 :: (Show1 f, Show a) => Builder -> Int -> f a -> Builder
+showbUnary1 nameB p x = showbParen (p > appPrec) $
+    nameB <> showbSpace <> showbPrec1 appPrec1 x
+{-# INLINE showbUnary1 #-}
+
+-- | @'showbBinary1' n p x y@ produces the 'Builder' representation of a binary
+-- data constructor with name @n@ and arguments @x@ and @y@, in precedence
+-- context @p@.
+-- 
+-- /Since: 0.5/
+showbBinary1 :: (Show1 f, Show1 g, Show a) => Builder -> Int -> f a -> g a -> Builder
+showbBinary1 nameB p x y = showbParen (p > appPrec) $ nameB
+    <> showbSpace <> showbPrec1 appPrec1 x
+    <> showbSpace <> showbPrec1 appPrec1 y
+{-# INLINE showbBinary1 #-}
+
+-- | Writes a value's strict 'TS.Text' representation to the standard output, followed
+--   by a newline.
+-- 
+-- /Since: 0.1/
+print :: Show a => a -> IO ()
+print = TS.putStrLn . show
+{-# INLINE print #-}
+
+-- | Writes a value's lazy 'TL.Text' representation to the standard output, followed
+--   by a newline.
+-- 
+-- /Since: 0.3/
+printLazy :: Show a => a -> IO ()
+printLazy = TL.putStrLn . showLazy
+{-# INLINE printLazy #-}
+
+-- | Writes a value's strict 'TS.Text' representation to a file handle, followed
+--   by a newline.
+-- 
+-- /Since: 0.3/
+hPrint :: Show a => Handle -> a -> IO ()
+hPrint h = TS.hPutStrLn h . show
+{-# INLINE hPrint #-}
+
+-- | Writes a value's lazy 'TL.Text' representation to a file handle, followed
+--   by a newline.
+-- 
+-- /Since: 0.3/
+hPrintLazy :: Show a => Handle -> a -> IO ()
+hPrintLazy h = TL.hPutStrLn h . showLazy
+{-# INLINE hPrintLazy #-}
+
+-- | The @Text@ 'T.Show' instance for 'FromStringShow' is based on its @String@
+-- 'S.Show' instance. That is,
+-- 
+-- @
+-- showbPrec p ('FromStringShow' x) = 'fromString' (showsPrec p x "")
+-- @
+-- 
+-- /Since: 0.5/
+newtype FromStringShow a = FromStringShow { fromStringShow :: a }
+  deriving ( Bits
+           , Bounded
+           , Data
+           , Enum
+           , Eq
+#if MIN_VERSION_base(4,7,0)
+           , FiniteBits
+#endif
+           , Floating
+           , Foldable
+           , Fractional
+           , Functor
+#if MIN_VERSION_base(4,4,0)
+           , Generic
+# if __GLASGOW_HASKELL__ >= 706
+           , Generic1
+# endif
+#endif
+           , Integral
+           , IsString
+           , Ix
+           , Monoid
+           , Num
+           , Ord
+           , PrintfArg
+           , PrintfType
+           , Real
+           , RealFloat
+           , RealFrac
+           , Semigroup
+           , Storable
+           , Traversable
+           , Typeable
+           )
+
+instance Applicative FromStringShow where
+    pure = FromStringShow
+    INLINE_INST_FUN(pure)
+    
+    FromStringShow f <*> FromStringShow x = FromStringShow $ f x
+    INLINE_INST_FUN((<*>))
+
+#if __GLASGOW_HASKELL__ >= 708
+instance IsList a => IsList (FromStringShow a) where
+    type Item (FromStringShow a) = Item a
+    fromList = FromStringShow . fromList
+    {-# INLINE fromList #-}
+    toList = toList . fromStringShow
+    {-# INLINE toList #-}
+#endif
+
+instance Monad FromStringShow where
+    return = FromStringShow
+    INLINE_INST_FUN(return)
+    
+    FromStringShow a >>= f = f a
+    INLINE_INST_FUN((>>=))
+
+instance MonadFix FromStringShow where
+    mfix f = FromStringShow $ let FromStringShow a = f a in a
+    INLINE_INST_FUN(mfix)
+
+#if MIN_VERSION_base(4,4,0)
+instance MonadZip FromStringShow where
+    mzip (FromStringShow a) (FromStringShow b) = FromStringShow (a, b)
+    INLINE_INST_FUN(mzip)
+    
+    mzipWith f (FromStringShow a) (FromStringShow b) = FromStringShow $ f a b
+    INLINE_INST_FUN(mzipWith)
+    
+    munzip (FromStringShow (a, b)) = (FromStringShow a, FromStringShow b)
+    INLINE_INST_FUN(munzip)
+#endif
+
+instance Read a => Read (FromStringShow a) where
+    readPrec = FromStringShow <$> readPrec
+    INLINE_INST_FUN(readPrec)
+    
+    readListPrec = readListPrecDefault
+    INLINE_INST_FUN(readListPrec)
+
+instance S.Show a => Show (FromStringShow a) where
+    showbPrec p (FromStringShow x) = fromString $ S.showsPrec p x ""
+    INLINE_INST_FUN(showbPrec)
+
+instance S.Show a => S.Show (FromStringShow a) where
+    showsPrec p (FromStringShow x) = S.showsPrec p x
+    INLINE_INST_FUN(showsPrec)
+
+-- | The @String@ 'S.Show' instance for 'FromTextShow' is based on its @Text@
+-- 'T.Show' instance. That is,
+-- 
+-- @
+-- showsPrec p ('FromTextShow' x) str = 'toString' (showbPrec p x) ++ str
+-- @
+-- 
+-- /Since: 0.6/
+newtype FromTextShow a = FromTextShow { fromTextShow :: a }
+  deriving ( Bits
+           , Bounded
+           , Data
+           , Enum
+           , Eq
+#if MIN_VERSION_base(4,7,0)
+           , FiniteBits
+#endif
+           , Floating
+           , Foldable
+           , Fractional
+           , Functor
+#if MIN_VERSION_base(4,4,0)
+           , Generic
+# if __GLASGOW_HASKELL__ >= 706
+           , Generic1
+# endif
+#endif
+           , Integral
+           , IsString
+           , Ix
+           , Monoid
+           , Num
+           , Ord
+           , PrintfArg
+           , PrintfType
+           , Real
+           , RealFloat
+           , RealFrac
+           , Semigroup
+           , Show
+           , Storable
+           , Traversable
+           , Typeable
+           )
+
+instance Applicative FromTextShow where
+    pure = FromTextShow
+    INLINE_INST_FUN(pure)
+    
+    FromTextShow f <*> FromTextShow x = FromTextShow $ f x
+    INLINE_INST_FUN((<*>))
+
+#if __GLASGOW_HASKELL__ >= 708
+instance IsList a => IsList (FromTextShow a) where
+    type Item (FromTextShow a) = Item a
+    fromList = FromTextShow . fromList
+    {-# INLINE fromList #-}
+    toList = toList . fromTextShow
+    {-# INLINE toList #-}
+#endif
+
+instance Monad FromTextShow where
+    return = FromTextShow
+    INLINE_INST_FUN(return)
+    
+    FromTextShow a >>= f = f a
+    INLINE_INST_FUN((>>=))
+
+instance MonadFix FromTextShow where
+    mfix f = FromTextShow $ let FromTextShow a = f a in a
+    INLINE_INST_FUN(mfix)
+
+#if MIN_VERSION_base(4,4,0)
+instance MonadZip FromTextShow where
+    mzip (FromTextShow a) (FromTextShow b) = FromTextShow (a, b)
+    INLINE_INST_FUN(mzip)
+    
+    mzipWith f (FromTextShow a) (FromTextShow b) = FromTextShow $ f a b
+    INLINE_INST_FUN(mzipWith)
+    
+    munzip (FromTextShow (a, b)) = (FromTextShow a, FromTextShow b)
+    INLINE_INST_FUN(munzip)
+#endif
+
+instance Read a => Read (FromTextShow a) where
+    readPrec = FromTextShow <$> readPrec
+    INLINE_INST_FUN(readPrec)
+    
+    readListPrec = readListPrecDefault
+    INLINE_INST_FUN(readListPrec)
+
+instance Show a => S.Show (FromTextShow a) where
+    showsPrec p (FromTextShow x) str = toString (showbPrec p x) ++ str
+    INLINE_INST_FUN(showsPrec)
+
+instance Show1 FromTextShow where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Control.hs view
@@ -1,16 +1,16 @@-{-|-Module:      Text.Show.Text.Control-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Imports 'Show' instances for @Control@ modules.--}-module Text.Show.Text.Control () where --import Text.Show.Text.Control.Applicative ()-import Text.Show.Text.Control.Concurrent  ()-import Text.Show.Text.Control.Exception   ()+{-|
+Module:      Text.Show.Text.Control
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Imports 'Show' instances for @Control@ modules.
+-}
+module Text.Show.Text.Control () where 
+
+import Text.Show.Text.Control.Applicative ()
+import Text.Show.Text.Control.Concurrent  ()
+import Text.Show.Text.Control.Exception   ()
 import Text.Show.Text.Control.Monad.ST    ()
src/Text/Show/Text/Control/Applicative.hs view
@@ -1,54 +1,57 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell   #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Control.Applicative-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'ZipList'.--/Since: 0.3/--}-module Text.Show.Text.Control.Applicative (showbConstPrec, showbZipListPrec) where--import Control.Applicative (Const(..), ZipList)--import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1), showbUnary)-import Text.Show.Text.Data.List ()-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)--#include "inline.h"--showbConstPrec :: Show a => Int -> Const a b -> Builder-showbConstPrec p (Const x) = showbUnary "Const" p x-{-# INLINE showbConstPrec #-}---- | Convert a 'ZipList' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbZipListPrec :: Show a => Int -> ZipList a -> Builder-showbZipListPrec = showbPrec-{-# INLINE showbZipListPrec #-}--instance Show a => Show (Const a b) where-    showbPrec = showbConstPrec-    INLINE_INST_FUN(showbPrec)--instance Show a => Show1 (Const a) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--$(deriveShowPragmas defaultInlineShowbPrec ''ZipList)--instance Show1 ZipList where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell   #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Control.Applicative
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'ZipList'.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Control.Applicative (showbConstPrec, showbZipListPrec) where
+
+import Control.Applicative (Const(..), ZipList)
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1), showbUnary)
+import Text.Show.Text.Data.List ()
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)
+
+#include "inline.h"
+
+-- | Convert a 'Const' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.7/
+showbConstPrec :: Show a => Int -> Const a b -> Builder
+showbConstPrec p (Const x) = showbUnary "Const" p x
+{-# INLINE showbConstPrec #-}
+
+-- | Convert a 'ZipList' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbZipListPrec :: Show a => Int -> ZipList a -> Builder
+showbZipListPrec = showbPrec
+{-# INLINE showbZipListPrec #-}
+
+instance Show a => Show (Const a b) where
+    showbPrec = showbConstPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show a => Show1 (Const a) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+$(deriveShowPragmas defaultInlineShowbPrec ''ZipList)
+
+instance Show1 ZipList where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Control/Concurrent.hs view
@@ -1,59 +1,59 @@-{-# LANGUAGE CPP             #-}-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Control.Concurrent-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for concurrency-related data types.--/Since: 0.3/--}-module Text.Show.Text.Control.Concurrent (-      showbThreadIdPrec-    , showbThreadStatusPrec-    , showbBlockReason-    ) where--import Data.Text.Lazy.Builder (Builder)--import GHC.Conc (BlockReason, ThreadId, ThreadStatus)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))-import Text.Show.Text.TH.Internal (deriveShow)--#include "inline.h"---- | Convert a 'ThreadId' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbThreadIdPrec :: Int -> ThreadId -> Builder-showbThreadIdPrec p = showbPrec p . FromStringShow-{-# INLINE showbThreadIdPrec #-}---- | Convert a 'ThreadStatus' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbThreadStatusPrec :: Int -> ThreadStatus -> Builder-showbThreadStatusPrec = showbPrec-{-# INLINE showbThreadStatusPrec #-}---- | Convert a 'BlockReason' to a 'Builder'.--- --- /Since: 0.3/-showbBlockReason :: BlockReason -> Builder-showbBlockReason = showb-{-# INLINE showbBlockReason #-}--instance Show ThreadId where-    showbPrec = showbThreadIdPrec-    INLINE_INST_FUN(showbPrec)--$(deriveShow ''ThreadStatus)-$(deriveShow ''BlockReason)+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Control.Concurrent
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for concurrency-related data types.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Control.Concurrent (
+      showbThreadIdPrec
+    , showbThreadStatusPrec
+    , showbBlockReason
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import GHC.Conc (BlockReason, ThreadId, ThreadStatus)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))
+import Text.Show.Text.TH.Internal (deriveShow)
+
+#include "inline.h"
+
+-- | Convert a 'ThreadId' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbThreadIdPrec :: Int -> ThreadId -> Builder
+showbThreadIdPrec p = showbPrec p . FromStringShow
+{-# INLINE showbThreadIdPrec #-}
+
+-- | Convert a 'ThreadStatus' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbThreadStatusPrec :: Int -> ThreadStatus -> Builder
+showbThreadStatusPrec = showbPrec
+{-# INLINE showbThreadStatusPrec #-}
+
+-- | Convert a 'BlockReason' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbBlockReason :: BlockReason -> Builder
+showbBlockReason = showb
+{-# INLINE showbBlockReason #-}
+
+instance Show ThreadId where
+    showbPrec = showbThreadIdPrec
+    INLINE_INST_FUN(showbPrec)
+
+$(deriveShow ''ThreadStatus)
+$(deriveShow ''BlockReason)
src/Text/Show/Text/Control/Exception.hs view
@@ -1,301 +1,301 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell   #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Control.Exception-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for 'Exception's.--/Since: 0.3/--}-module Text.Show.Text.Control.Exception (-    showbSomeExceptionPrec-  , showbIOException-  , showbArithException-  , showbArrayException-  , showbAssertionFailed-#if MIN_VERSION_base(4,7,0)-  , showbSomeAsyncException-#endif-  , showbAsyncException-  , showbNonTermination-  , showbNestedAtomically-  , showbBlockedIndefinitelyOnMVar-  , showbBlockedIndefinitelyOnSTM-#if MIN_VERSION_base(4,8,0)-  , showbAllocationLimitExceeded-#endif-  , showbDeadlock-  , showbNoMethodError-  , showbPatternMatchFail-  , showbRecConError-  , showbRecSelError-  , showbRecUpdError-  , showbErrorCall-  , showbMaskingState-  ) where--import Control.Exception.Base--#if !(MIN_VERSION_base(4,8,0))-import Data.Monoid (mempty)-#endif-import Data.Text.Lazy.Builder (Builder, fromString)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb)-import Text.Show.Text.Utils ((<>))--#include "inline.h"---- | Convert a 'SomeException' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbSomeExceptionPrec :: Int -> SomeException -> Builder-showbSomeExceptionPrec p (SomeException e) = showbPrec p $ FromStringShow e-{-# INLINE showbSomeExceptionPrec #-}---- | Convert an 'IOException' to a 'Builder'.--- --- /Since: 0.3/-showbIOException :: IOException -> Builder-showbIOException = showb . FromStringShow-{-# INLINE showbIOException #-}---- | Convert an 'ArithException' to a 'Builder'.--- --- /Since: 0.3/-showbArithException :: ArithException -> Builder-showbArithException Overflow             = "arithmetic overflow"-showbArithException Underflow            = "arithmetic underflow"-showbArithException LossOfPrecision      = "loss of precision"-showbArithException DivideByZero         = "divide by zero"-showbArithException Denormal             = "denormal"-#if MIN_VERSION_base(4,6,0)-showbArithException RatioZeroDenominator = "Ratio has zero denominator"-#endif---- | Convert an 'ArrayException' to a 'Builder'.--- --- /Since: 0.3/-showbArrayException :: ArrayException -> Builder-showbArrayException (IndexOutOfBounds s)-    =  "array index out of range"-    <> (if not $ null s then ": " <> fromString s-                        else mempty)-showbArrayException (UndefinedElement s)-    =  "undefined array element"-    <> (if not $ null s then ": " <> fromString s-                        else mempty)-{-# INLINE showbArrayException #-}---- | Convert an 'AssertionFailed' exception to a 'Builder'.--- --- /Since: 0.3/-showbAssertionFailed :: AssertionFailed -> Builder-showbAssertionFailed (AssertionFailed err) = fromString err-{-# INLINE showbAssertionFailed #-}--#if MIN_VERSION_base(4,7,0)--- | Convert a 'SomeAsyncException' value to a 'Builder'.--- This function is only available with @base-4.7.0.0@ or later.--- --- /Since: 0.3/-showbSomeAsyncException :: SomeAsyncException -> Builder-showbSomeAsyncException (SomeAsyncException e) = showb $ FromStringShow e-{-# INLINE showbSomeAsyncException #-}-#endif---- | Convert an 'AsyncException' to a 'Builder'.--- --- /Since: 0.3/-showbAsyncException :: AsyncException -> Builder-showbAsyncException StackOverflow = "stack overflow"-showbAsyncException HeapOverflow  = "heap overflow"-showbAsyncException ThreadKilled  = "thread killed"-showbAsyncException UserInterrupt = "user interrupt"-{-# INLINE showbAsyncException #-}---- | Convert a 'NonTermination' exception to a 'Builder'.--- --- /Since: 0.3/-showbNonTermination :: NonTermination -> Builder-showbNonTermination NonTermination = "<<loop>>"-{-# INLINE showbNonTermination #-}---- | Convert a 'NestedAtomically' exception to a 'Builder'.--- --- /Since: 0.3/-showbNestedAtomically :: NestedAtomically -> Builder-showbNestedAtomically NestedAtomically = "Control.Concurrent.STM.atomically was nested"-{-# INLINE showbNestedAtomically #-}---- | Convert a 'BlockedIndefinitelyOnMVar' exception to a 'Builder'.--- --- /Since: 0.3/-showbBlockedIndefinitelyOnMVar :: BlockedIndefinitelyOnMVar -> Builder-showbBlockedIndefinitelyOnMVar BlockedIndefinitelyOnMVar = "thread blocked indefinitely in an MVar operation"-{-# INLINE showbBlockedIndefinitelyOnMVar #-}---- | Convert a 'BlockedIndefinitelyOnSTM' exception to a 'Builder'.--- --- /Since: 0.3/-showbBlockedIndefinitelyOnSTM :: BlockedIndefinitelyOnSTM -> Builder-showbBlockedIndefinitelyOnSTM BlockedIndefinitelyOnSTM = "thread blocked indefinitely in an STM transaction"-{-# INLINE showbBlockedIndefinitelyOnSTM #-}--#if MIN_VERSION_base(4,8,0)--- | Convert an 'AllocationLimitExceeded' exception to a 'Builder'.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbAllocationLimitExceeded :: AllocationLimitExceeded -> Builder-showbAllocationLimitExceeded AllocationLimitExceeded = "allocation limit exceeded"-{-# INLINE showbAllocationLimitExceeded #-}-#endif---- | Convert a 'Deadlock' exception to a 'Builder'.--- --- /Since: 0.3/-showbDeadlock :: Deadlock -> Builder-showbDeadlock Deadlock = "<<deadlock>>"-{-# INLINE showbDeadlock #-}---- | Convert a 'NoMethodError' to a 'Builder'.--- --- /Since: 0.3/-showbNoMethodError :: NoMethodError -> Builder-showbNoMethodError (NoMethodError err) = fromString err-{-# INLINE showbNoMethodError #-}---- | Convert a 'PatternMatchFail' to a 'Builder'.--- --- /Since: 0.3/-showbPatternMatchFail :: PatternMatchFail -> Builder-showbPatternMatchFail (PatternMatchFail err) = fromString err-{-# INLINE showbPatternMatchFail #-}---- | Convert a 'RecConError' to a 'Builder'.--- --- /Since: 0.3/-showbRecConError :: RecConError -> Builder-showbRecConError (RecConError err) = fromString err-{-# INLINE showbRecConError #-}---- | Convert a 'RecSelError' to a 'Builder'.--- --- /Since: 0.3/-showbRecSelError :: RecSelError -> Builder-showbRecSelError (RecSelError err) = fromString err-{-# INLINE showbRecSelError #-}---- | Convert a 'RecUpdError' to a 'Builder'.--- --- /Since: 0.3/-showbRecUpdError :: RecUpdError -> Builder-showbRecUpdError (RecUpdError err) = fromString err-{-# INLINE showbRecUpdError #-}---- | Convert an 'ErrorCall' to a 'Builder'.--- --- /Since: 0.3/-showbErrorCall :: ErrorCall -> Builder-showbErrorCall (ErrorCall err) = fromString err-{-# INLINE showbErrorCall #-}---- | Convert a 'MaskingState' to a 'Builder'.--- --- /Since: 0.4/-showbMaskingState :: MaskingState -> Builder-showbMaskingState = showb-{-# INLINE showbMaskingState #-}--instance Show SomeException where-    showbPrec = showbSomeExceptionPrec-    INLINE_INST_FUN(showbPrec)--instance Show IOException where-    showb = showbIOException-    INLINE_INST_FUN(showb)--instance Show ArithException where-    showb = showbArithException-    INLINE_INST_FUN(showb)--instance Show ArrayException where-    showb = showbArrayException-    INLINE_INST_FUN(showb)--instance Show AssertionFailed where-    showb = showbAssertionFailed-    INLINE_INST_FUN(showb)--#if MIN_VERSION_base(4,7,0)-instance Show SomeAsyncException where-    showb = showbSomeAsyncException-    {-# INLINE showb #-}-#endif--instance Show AsyncException where-    showb = showbAsyncException-    INLINE_INST_FUN(showb)--instance Show NonTermination where-    showb = showbNonTermination-    INLINE_INST_FUN(showb)--instance Show NestedAtomically where-    showb = showbNestedAtomically-    INLINE_INST_FUN(showb)--instance Show BlockedIndefinitelyOnMVar where-    showb = showbBlockedIndefinitelyOnMVar-    INLINE_INST_FUN(showb)--instance Show BlockedIndefinitelyOnSTM where-    showb = showbBlockedIndefinitelyOnSTM-    INLINE_INST_FUN(showb)--#if MIN_VERSION_base(4,8,0)-instance Show AllocationLimitExceeded where-    showb = showbAllocationLimitExceeded-    {-# INLINE showb #-}-#endif--instance Show Deadlock where-    showb = showbDeadlock-    INLINE_INST_FUN(showb)--instance Show NoMethodError where-    showb = showbNoMethodError-    INLINE_INST_FUN(showb)--instance Show PatternMatchFail where-    showb = showbPatternMatchFail-    INLINE_INST_FUN(showb)--instance Show RecConError where-    showb = showbRecConError-    INLINE_INST_FUN(showb)--instance Show RecSelError where-    showb = showbRecSelError-    INLINE_INST_FUN(showb)--instance Show RecUpdError where-    showb = showbRecUpdError-    INLINE_INST_FUN(showb)--instance Show ErrorCall where-    showb = showbErrorCall-    INLINE_INST_FUN(showb)--$(deriveShowPragmas defaultInlineShowb ''MaskingState)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell   #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Control.Exception
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for 'Exception's.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Control.Exception (
+    showbSomeExceptionPrec
+  , showbIOException
+  , showbArithException
+  , showbArrayException
+  , showbAssertionFailed
+#if MIN_VERSION_base(4,7,0)
+  , showbSomeAsyncException
+#endif
+  , showbAsyncException
+  , showbNonTermination
+  , showbNestedAtomically
+  , showbBlockedIndefinitelyOnMVar
+  , showbBlockedIndefinitelyOnSTM
+#if MIN_VERSION_base(4,8,0)
+  , showbAllocationLimitExceeded
+#endif
+  , showbDeadlock
+  , showbNoMethodError
+  , showbPatternMatchFail
+  , showbRecConError
+  , showbRecSelError
+  , showbRecUpdError
+  , showbErrorCall
+  , showbMaskingState
+  ) where
+
+import Control.Exception.Base
+
+#if !(MIN_VERSION_base(4,8,0))
+import Data.Monoid (mempty)
+#endif
+import Data.Text.Lazy.Builder (Builder, fromString)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb)
+import Text.Show.Text.Utils ((<>))
+
+#include "inline.h"
+
+-- | Convert a 'SomeException' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbSomeExceptionPrec :: Int -> SomeException -> Builder
+showbSomeExceptionPrec p (SomeException e) = showbPrec p $ FromStringShow e
+{-# INLINE showbSomeExceptionPrec #-}
+
+-- | Convert an 'IOException' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbIOException :: IOException -> Builder
+showbIOException = showb . FromStringShow
+{-# INLINE showbIOException #-}
+
+-- | Convert an 'ArithException' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbArithException :: ArithException -> Builder
+showbArithException Overflow             = "arithmetic overflow"
+showbArithException Underflow            = "arithmetic underflow"
+showbArithException LossOfPrecision      = "loss of precision"
+showbArithException DivideByZero         = "divide by zero"
+showbArithException Denormal             = "denormal"
+#if MIN_VERSION_base(4,6,0)
+showbArithException RatioZeroDenominator = "Ratio has zero denominator"
+#endif
+
+-- | Convert an 'ArrayException' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbArrayException :: ArrayException -> Builder
+showbArrayException (IndexOutOfBounds s)
+    =  "array index out of range"
+    <> (if not $ null s then ": " <> fromString s
+                        else mempty)
+showbArrayException (UndefinedElement s)
+    =  "undefined array element"
+    <> (if not $ null s then ": " <> fromString s
+                        else mempty)
+{-# INLINE showbArrayException #-}
+
+-- | Convert an 'AssertionFailed' exception to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbAssertionFailed :: AssertionFailed -> Builder
+showbAssertionFailed (AssertionFailed err) = fromString err
+{-# INLINE showbAssertionFailed #-}
+
+#if MIN_VERSION_base(4,7,0)
+-- | Convert a 'SomeAsyncException' value to a 'Builder'.
+-- This function is only available with @base-4.7.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbSomeAsyncException :: SomeAsyncException -> Builder
+showbSomeAsyncException (SomeAsyncException e) = showb $ FromStringShow e
+{-# INLINE showbSomeAsyncException #-}
+#endif
+
+-- | Convert an 'AsyncException' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbAsyncException :: AsyncException -> Builder
+showbAsyncException StackOverflow = "stack overflow"
+showbAsyncException HeapOverflow  = "heap overflow"
+showbAsyncException ThreadKilled  = "thread killed"
+showbAsyncException UserInterrupt = "user interrupt"
+{-# INLINE showbAsyncException #-}
+
+-- | Convert a 'NonTermination' exception to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbNonTermination :: NonTermination -> Builder
+showbNonTermination NonTermination = "<<loop>>"
+{-# INLINE showbNonTermination #-}
+
+-- | Convert a 'NestedAtomically' exception to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbNestedAtomically :: NestedAtomically -> Builder
+showbNestedAtomically NestedAtomically = "Control.Concurrent.STM.atomically was nested"
+{-# INLINE showbNestedAtomically #-}
+
+-- | Convert a 'BlockedIndefinitelyOnMVar' exception to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbBlockedIndefinitelyOnMVar :: BlockedIndefinitelyOnMVar -> Builder
+showbBlockedIndefinitelyOnMVar BlockedIndefinitelyOnMVar = "thread blocked indefinitely in an MVar operation"
+{-# INLINE showbBlockedIndefinitelyOnMVar #-}
+
+-- | Convert a 'BlockedIndefinitelyOnSTM' exception to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbBlockedIndefinitelyOnSTM :: BlockedIndefinitelyOnSTM -> Builder
+showbBlockedIndefinitelyOnSTM BlockedIndefinitelyOnSTM = "thread blocked indefinitely in an STM transaction"
+{-# INLINE showbBlockedIndefinitelyOnSTM #-}
+
+#if MIN_VERSION_base(4,8,0)
+-- | Convert an 'AllocationLimitExceeded' exception to a 'Builder'.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbAllocationLimitExceeded :: AllocationLimitExceeded -> Builder
+showbAllocationLimitExceeded AllocationLimitExceeded = "allocation limit exceeded"
+{-# INLINE showbAllocationLimitExceeded #-}
+#endif
+
+-- | Convert a 'Deadlock' exception to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbDeadlock :: Deadlock -> Builder
+showbDeadlock Deadlock = "<<deadlock>>"
+{-# INLINE showbDeadlock #-}
+
+-- | Convert a 'NoMethodError' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbNoMethodError :: NoMethodError -> Builder
+showbNoMethodError (NoMethodError err) = fromString err
+{-# INLINE showbNoMethodError #-}
+
+-- | Convert a 'PatternMatchFail' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbPatternMatchFail :: PatternMatchFail -> Builder
+showbPatternMatchFail (PatternMatchFail err) = fromString err
+{-# INLINE showbPatternMatchFail #-}
+
+-- | Convert a 'RecConError' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbRecConError :: RecConError -> Builder
+showbRecConError (RecConError err) = fromString err
+{-# INLINE showbRecConError #-}
+
+-- | Convert a 'RecSelError' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbRecSelError :: RecSelError -> Builder
+showbRecSelError (RecSelError err) = fromString err
+{-# INLINE showbRecSelError #-}
+
+-- | Convert a 'RecUpdError' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbRecUpdError :: RecUpdError -> Builder
+showbRecUpdError (RecUpdError err) = fromString err
+{-# INLINE showbRecUpdError #-}
+
+-- | Convert an 'ErrorCall' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbErrorCall :: ErrorCall -> Builder
+showbErrorCall (ErrorCall err) = fromString err
+{-# INLINE showbErrorCall #-}
+
+-- | Convert a 'MaskingState' to a 'Builder'.
+-- 
+-- /Since: 0.4/
+showbMaskingState :: MaskingState -> Builder
+showbMaskingState = showb
+{-# INLINE showbMaskingState #-}
+
+instance Show SomeException where
+    showbPrec = showbSomeExceptionPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show IOException where
+    showb = showbIOException
+    INLINE_INST_FUN(showb)
+
+instance Show ArithException where
+    showb = showbArithException
+    INLINE_INST_FUN(showb)
+
+instance Show ArrayException where
+    showb = showbArrayException
+    INLINE_INST_FUN(showb)
+
+instance Show AssertionFailed where
+    showb = showbAssertionFailed
+    INLINE_INST_FUN(showb)
+
+#if MIN_VERSION_base(4,7,0)
+instance Show SomeAsyncException where
+    showb = showbSomeAsyncException
+    {-# INLINE showb #-}
+#endif
+
+instance Show AsyncException where
+    showb = showbAsyncException
+    INLINE_INST_FUN(showb)
+
+instance Show NonTermination where
+    showb = showbNonTermination
+    INLINE_INST_FUN(showb)
+
+instance Show NestedAtomically where
+    showb = showbNestedAtomically
+    INLINE_INST_FUN(showb)
+
+instance Show BlockedIndefinitelyOnMVar where
+    showb = showbBlockedIndefinitelyOnMVar
+    INLINE_INST_FUN(showb)
+
+instance Show BlockedIndefinitelyOnSTM where
+    showb = showbBlockedIndefinitelyOnSTM
+    INLINE_INST_FUN(showb)
+
+#if MIN_VERSION_base(4,8,0)
+instance Show AllocationLimitExceeded where
+    showb = showbAllocationLimitExceeded
+    {-# INLINE showb #-}
+#endif
+
+instance Show Deadlock where
+    showb = showbDeadlock
+    INLINE_INST_FUN(showb)
+
+instance Show NoMethodError where
+    showb = showbNoMethodError
+    INLINE_INST_FUN(showb)
+
+instance Show PatternMatchFail where
+    showb = showbPatternMatchFail
+    INLINE_INST_FUN(showb)
+
+instance Show RecConError where
+    showb = showbRecConError
+    INLINE_INST_FUN(showb)
+
+instance Show RecSelError where
+    showb = showbRecSelError
+    INLINE_INST_FUN(showb)
+
+instance Show RecUpdError where
+    showb = showbRecUpdError
+    INLINE_INST_FUN(showb)
+
+instance Show ErrorCall where
+    showb = showbErrorCall
+    INLINE_INST_FUN(showb)
+
+$(deriveShowPragmas defaultInlineShowb ''MaskingState)
src/Text/Show/Text/Control/Monad/ST.hs view
@@ -1,38 +1,38 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Control.Monad.ST-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for strict 'ST' values.--/Since: 0.3/--}-module Text.Show.Text.Control.Monad.ST (showbST) where--import Control.Monad.ST (ST)-import Data.Text.Lazy.Builder (Builder)-import Prelude hiding (Show)-import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))--#include "inline.h"---- | Convert a strict 'ST' value to a 'Builder'.--- --- /Since: 0.3/-showbST :: ST s a -> Builder-showbST _ = "<<ST action>>"-{-# INLINE showbST #-}--instance Show (ST s a) where-    showb = showbST-    INLINE_INST_FUN(showb)--instance Show1 (ST s) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Control.Monad.ST
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for strict 'ST' values.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Control.Monad.ST (showbST) where
+
+import Control.Monad.ST (ST)
+import Data.Text.Lazy.Builder (Builder)
+import Prelude hiding (Show)
+import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))
+
+#include "inline.h"
+
+-- | Convert a strict 'ST' value to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbST :: ST s a -> Builder
+showbST _ = "<<ST action>>"
+{-# INLINE showbST #-}
+
+instance Show (ST s a) where
+    showb = showbST
+    INLINE_INST_FUN(showb)
+
+instance Show1 (ST s) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Data.hs view
@@ -1,43 +1,43 @@-{-# LANGUAGE CPP #-}-{-|-Module:      Text.Show.Text.Data-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Imports 'Show' instances for @Data@ modules.--}-module Text.Show.Text.Data () where--import Text.Show.Text.Data.Array            ()-import Text.Show.Text.Data.Bool             ()-import Text.Show.Text.Data.ByteString       ()-import Text.Show.Text.Data.Char             ()-import Text.Show.Text.Data.Complex          ()-import Text.Show.Text.Data.Data             ()-import Text.Show.Text.Data.Dynamic          ()-import Text.Show.Text.Data.Either           ()-import Text.Show.Text.Data.Fixed            ()-import Text.Show.Text.Data.Floating         ()-import Text.Show.Text.Data.Functor.Identity ()-import Text.Show.Text.Data.Integral         ()-import Text.Show.Text.Data.List             ()-import Text.Show.Text.Data.Maybe            ()-import Text.Show.Text.Data.Monoid           ()-#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-import Text.Show.Text.Data.OldTypeable      ()-#endif-import Text.Show.Text.Data.Ord              ()-import Text.Show.Text.Data.Proxy            ()-import Text.Show.Text.Data.Ratio            ()-import Text.Show.Text.Data.Text             ()-import Text.Show.Text.Data.Tuple            ()-#if MIN_VERSION_base(4,7,0)-import Text.Show.Text.Data.Type.Coercion    ()-import Text.Show.Text.Data.Type.Equality    ()-#endif-import Text.Show.Text.Data.Typeable         ()-import Text.Show.Text.Data.Version          ()-import Text.Show.Text.Data.Void             ()+{-# LANGUAGE CPP #-}
+{-|
+Module:      Text.Show.Text.Data
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Imports 'Show' instances for @Data@ modules.
+-}
+module Text.Show.Text.Data () where
+
+import Text.Show.Text.Data.Array            ()
+import Text.Show.Text.Data.Bool             ()
+import Text.Show.Text.Data.ByteString       ()
+import Text.Show.Text.Data.Char             ()
+import Text.Show.Text.Data.Complex          ()
+import Text.Show.Text.Data.Data             ()
+import Text.Show.Text.Data.Dynamic          ()
+import Text.Show.Text.Data.Either           ()
+import Text.Show.Text.Data.Fixed            ()
+import Text.Show.Text.Data.Floating         ()
+import Text.Show.Text.Data.Functor.Identity ()
+import Text.Show.Text.Data.Integral         ()
+import Text.Show.Text.Data.List             ()
+import Text.Show.Text.Data.Maybe            ()
+import Text.Show.Text.Data.Monoid           ()
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+import Text.Show.Text.Data.OldTypeable      ()
+#endif
+import Text.Show.Text.Data.Ord              ()
+import Text.Show.Text.Data.Proxy            ()
+import Text.Show.Text.Data.Ratio            ()
+import Text.Show.Text.Data.Text             ()
+import Text.Show.Text.Data.Tuple            ()
+#if MIN_VERSION_base(4,7,0)
+import Text.Show.Text.Data.Type.Coercion    ()
+import Text.Show.Text.Data.Type.Equality    ()
+#endif
+import Text.Show.Text.Data.Typeable         ()
+import Text.Show.Text.Data.Version          ()
+import Text.Show.Text.Data.Void             ()
src/Text/Show/Text/Data/Array.hs view
@@ -1,80 +1,80 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE FlexibleContexts  #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Array-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Array' values.--/Since: 0.3/--}-module Text.Show.Text.Data.Array (-      showbArrayPrec-    , showbUArrayPrec-    , showbIArrayPrec-    ) where--import qualified Data.Array as Array (assocs, bounds)-import           Data.Array (Array)-import qualified Data.Array.Base as IArray (assocs, bounds)-import           Data.Array.Base (IArray)-import           Data.Array.Unboxed (UArray)-import           Data.Ix (Ix)-import           Data.Text.Lazy.Builder (Builder)--import           GHC.Show (appPrec)--import           Prelude hiding (Show)--import           Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, showbSpace)-import           Text.Show.Text.Data.List ()-import           Text.Show.Text.Data.Tuple ()-import           Text.Show.Text.Utils ((<>))--#include "inline.h"---- | Convert an 'Array' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbArrayPrec :: (Show i, Show e, Ix i) => Int -> Array i e -> Builder-showbArrayPrec p a = showbParen (p > appPrec) $-       "array "-    <> showb (Array.bounds a)-    <> showbSpace-    <> showb (Array.assocs a)-{-# INLINE showbArrayPrec #-}---- | Convert a 'UArray' value to a 'Builder' with the given precedence.--- --- /Since: 0.7/-showbUArrayPrec :: (IArray UArray e, Ix i, Show i, Show e) => Int -> UArray i e -> Builder-showbUArrayPrec = showbIArrayPrec-{-# INLINE showbUArrayPrec #-}--{-# SPECIALIZE-    showbIArrayPrec :: (IArray UArray e, Ix i, Show i, Show e) =>-                        Int -> UArray i e -> Builder-  #-}--- | Convert an 'IArray' instance to a 'Builder' with the given precedence.--- --- /Since: 0.7/-showbIArrayPrec :: (IArray a e, Ix i, Show i, Show e) => Int -> a i e -> Builder-showbIArrayPrec p a = showbParen (p > 9) $-       "array "-    <> showb (IArray.bounds a)-    <> showbSpace-    <> showb (IArray.assocs a)--instance (Show i, Show e, Ix i) => Show (Array i e) where-    showbPrec = showbArrayPrec-    INLINE_INST_FUN(showbPrec)--instance (IArray UArray e, Ix i, Show i, Show e) => Show (UArray i e) where-    showbPrec = showbUArrayPrec-    INLINE_INST_FUN(showbPrec)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE FlexibleContexts  #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Array
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Array' values.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Array (
+      showbArrayPrec
+    , showbUArrayPrec
+    , showbIArrayPrec
+    ) where
+
+import qualified Data.Array as Array (assocs, bounds)
+import           Data.Array (Array)
+import qualified Data.Array.Base as IArray (assocs, bounds)
+import           Data.Array.Base (IArray)
+import           Data.Array.Unboxed (UArray)
+import           Data.Ix (Ix)
+import           Data.Text.Lazy.Builder (Builder)
+
+import           GHC.Show (appPrec)
+
+import           Prelude hiding (Show)
+
+import           Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, showbSpace)
+import           Text.Show.Text.Data.List ()
+import           Text.Show.Text.Data.Tuple ()
+import           Text.Show.Text.Utils ((<>))
+
+#include "inline.h"
+
+-- | Convert an 'Array' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbArrayPrec :: (Show i, Show e, Ix i) => Int -> Array i e -> Builder
+showbArrayPrec p a = showbParen (p > appPrec) $
+       "array "
+    <> showb (Array.bounds a)
+    <> showbSpace
+    <> showb (Array.assocs a)
+{-# INLINE showbArrayPrec #-}
+
+-- | Convert a 'UArray' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.7/
+showbUArrayPrec :: (IArray UArray e, Ix i, Show i, Show e) => Int -> UArray i e -> Builder
+showbUArrayPrec = showbIArrayPrec
+{-# INLINE showbUArrayPrec #-}
+
+{-# SPECIALIZE
+    showbIArrayPrec :: (IArray UArray e, Ix i, Show i, Show e) =>
+                        Int -> UArray i e -> Builder
+  #-}
+-- | Convert an 'IArray' instance to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.7/
+showbIArrayPrec :: (IArray a e, Ix i, Show i, Show e) => Int -> a i e -> Builder
+showbIArrayPrec p a = showbParen (p > 9) $
+       "array "
+    <> showb (IArray.bounds a)
+    <> showbSpace
+    <> showb (IArray.assocs a)
+
+instance (Show i, Show e, Ix i) => Show (Array i e) where
+    showbPrec = showbArrayPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance (IArray UArray e, Ix i, Show i, Show e) => Show (UArray i e) where
+    showbPrec = showbUArrayPrec
+    INLINE_INST_FUN(showbPrec)
src/Text/Show/Text/Data/Bool.hs view
@@ -1,29 +1,29 @@-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Bool-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Bool' values.--/Since: 0.3/--}-module Text.Show.Text.Data.Bool (showbBool) where--import Data.Text.Lazy.Builder (Builder)--import Text.Show.Text.Classes (showb)-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb)---- | Convert a 'Bool' to a 'Builder'.--- --- /Since: 0.3/-showbBool :: Bool -> Builder-showbBool = showb-{-# INLINE showbBool #-}-+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Bool
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Bool' values.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Bool (showbBool) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Text.Show.Text.Classes (showb)
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb)
+
+-- | Convert a 'Bool' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbBool :: Bool -> Builder
+showbBool = showb
+{-# INLINE showbBool #-}
+
 $(deriveShowPragmas defaultInlineShowb ''Bool)
src/Text/Show/Text/Data/ByteString.hs view
@@ -1,92 +1,92 @@-{-# LANGUAGE CPP             #-}-#if !(MIN_VERSION_bytestring(0,10,0))-{-# LANGUAGE TemplateHaskell #-}-#endif-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.ByteString-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for data types in the @bytestring@ library.--/Since: 0.3/--}-module Text.Show.Text.Data.ByteString (-      showbByteStringStrict-    , showbByteStringLazy-    , showbByteStringLazyPrec-    , showbShortByteString-    ) where--import qualified Data.ByteString      as BS-import qualified Data.ByteString.Lazy as BL-import           Data.ByteString.Short (ShortByteString)-import           Data.Text.Lazy.Builder (Builder)--import           Prelude hiding (Show(show))--import           Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))--#if !(MIN_VERSION_bytestring(0,10,0))-import           Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)-#endif--#include "inline.h"---- | Convert a strict 'BS.ByteString' to a 'Builder'.--- --- /Since: 0.3/-showbByteStringStrict :: BS.ByteString -> Builder-showbByteStringStrict = showb . FromStringShow-{-# INLINE showbByteStringStrict #-}---- | Convert a lazy 'BL.ByteString' to a 'Builder'.--- --- /Since: 0.3/-showbByteStringLazy :: BL.ByteString -> Builder-showbByteStringLazy = showbByteStringLazyPrec 0-{-# INLINE showbByteStringLazy #-}---- | Convert a lazy 'BL.ByteString' to a 'Builder' with the given precedence.--- --- With @bytestring-0.10.0.0@ or later, this function ignores the precedence--- argument, since lazy 'BL.ByteString's are printed out identically to 'String's.--- On earlier versions of @bytestring@, however, lazy 'BL.ByteString's can be printed--- with parentheses (e.g., @Chunk "example" Empty@ vs. @(Chunk "example" Empty)@)--- depending on the precedence.--- --- /Since: 0.3/-showbByteStringLazyPrec :: Int -> BL.ByteString -> Builder-#if MIN_VERSION_bytestring(0,10,0)-showbByteStringLazyPrec _ = showb . FromStringShow-#else-showbByteStringLazyPrec = showbPrec-#endif-{-# INLINE showbByteStringLazyPrec #-}---- | Convert a 'ShortByteString' to a 'Builder'.--- --- /Since: 0.7/-showbShortByteString :: ShortByteString -> Builder-showbShortByteString = showb . FromStringShow-{-# INLINE showbShortByteString #-}--instance Show BS.ByteString where-    showb = showbByteStringStrict-    INLINE_INST_FUN(showb)--#if MIN_VERSION_bytestring(0,10,0)-instance Show BL.ByteString where-    showbPrec = showbByteStringLazyPrec-    INLINE_INST_FUN(showbPrec)-#else-$(deriveShowPragmas defaultInlineShowbPrec ''BL.ByteString)-#endif--instance Show ShortByteString where-    showb = showbShortByteString-    INLINE_INST_FUN(showb)+{-# LANGUAGE CPP             #-}
+#if !(MIN_VERSION_bytestring(0,10,0))
+{-# LANGUAGE TemplateHaskell #-}
+#endif
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.ByteString
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the @bytestring@ library.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.ByteString (
+      showbByteStringStrict
+    , showbByteStringLazy
+    , showbByteStringLazyPrec
+    , showbShortByteString
+    ) where
+
+import qualified Data.ByteString      as BS
+import qualified Data.ByteString.Lazy as BL
+import           Data.ByteString.Short (ShortByteString)
+import           Data.Text.Lazy.Builder (Builder)
+
+import           Prelude hiding (Show(show))
+
+import           Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))
+
+#if !(MIN_VERSION_bytestring(0,10,0))
+import           Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)
+#endif
+
+#include "inline.h"
+
+-- | Convert a strict 'BS.ByteString' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbByteStringStrict :: BS.ByteString -> Builder
+showbByteStringStrict = showb . FromStringShow
+{-# INLINE showbByteStringStrict #-}
+
+-- | Convert a lazy 'BL.ByteString' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbByteStringLazy :: BL.ByteString -> Builder
+showbByteStringLazy = showbByteStringLazyPrec 0
+{-# INLINE showbByteStringLazy #-}
+
+-- | Convert a lazy 'BL.ByteString' to a 'Builder' with the given precedence.
+-- 
+-- With @bytestring-0.10.0.0@ or later, this function ignores the precedence
+-- argument, since lazy 'BL.ByteString's are printed out identically to 'String's.
+-- On earlier versions of @bytestring@, however, lazy 'BL.ByteString's can be printed
+-- with parentheses (e.g., @Chunk "example" Empty@ vs. @(Chunk "example" Empty)@)
+-- depending on the precedence.
+-- 
+-- /Since: 0.3/
+showbByteStringLazyPrec :: Int -> BL.ByteString -> Builder
+#if MIN_VERSION_bytestring(0,10,0)
+showbByteStringLazyPrec _ = showb . FromStringShow
+#else
+showbByteStringLazyPrec = showbPrec
+#endif
+{-# INLINE showbByteStringLazyPrec #-}
+
+-- | Convert a 'ShortByteString' to a 'Builder'.
+-- 
+-- /Since: 0.7/
+showbShortByteString :: ShortByteString -> Builder
+showbShortByteString = showb . FromStringShow
+{-# INLINE showbShortByteString #-}
+
+instance Show BS.ByteString where
+    showb = showbByteStringStrict
+    INLINE_INST_FUN(showb)
+
+#if MIN_VERSION_bytestring(0,10,0)
+instance Show BL.ByteString where
+    showbPrec = showbByteStringLazyPrec
+    INLINE_INST_FUN(showbPrec)
+#else
+$(deriveShowPragmas defaultInlineShowbPrec ''BL.ByteString)
+#endif
+
+instance Show ShortByteString where
+    showb = showbShortByteString
+    INLINE_INST_FUN(showb)
src/Text/Show/Text/Data/Char.hs view
@@ -1,110 +1,110 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell   #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Char-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for 'Char' and 'String'.--/Since: 0.3/--}-module Text.Show.Text.Data.Char (-      showbChar-    , showbLitChar-    , showbString-    , showbLitString-    , showbGeneralCategory-    , asciiTabB-    ) where--import           Data.Array (Array, (!), listArray)-import           Data.Char (GeneralCategory, isDigit, ord)-#if !(MIN_VERSION_base(4,8,0))-import           Data.Monoid (mempty)-#endif-import           Data.Text.Lazy.Builder (Builder)--import           Prelude hiding (Show)--import           Text.Show.Text.Classes (Show(..))-import           Text.Show.Text.Data.Integral (showbIntPrec)-import           Text.Show.Text.TH.Internal (deriveShow)-import           Text.Show.Text.Utils ((<>), s)--#include "inline.h"---- | A table of ASCII control characters that needs to be escaped with a backslash.--- --- /Since: 0.5/-asciiTabB :: Array Int Builder-asciiTabB = listArray (0, 32) ["NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",-                               "BS" , "HT" , "LF" , "VT" , "FF" , "CR" , "SO" , "SI" ,-                               "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",-                               "CAN", "EM" , "SUB", "ESC", "FS" , "GS" , "RS" , "US" ,-                               "SP"]---- | Convert a 'Char' to a 'Builder' (surrounded by single quotes).--- --- /Since: 0.3/-showbChar :: Char -> Builder-showbChar '\'' = "'\\''"-showbChar c    = s '\'' <> showbLitChar c <> s '\''-{-# INLINE showbChar #-}---- | Convert a 'Char' to a 'Builder' (without single quotes).--- --- /Since: 0.3/-showbLitChar :: Char -> Builder-showbLitChar c | c > '\DEL' = s '\\' <> showbIntPrec 0 (ord c)-showbLitChar '\DEL'         = "\\DEL"-showbLitChar '\\'           = "\\\\"-showbLitChar c | c >= ' '   = s c-showbLitChar '\a'           = "\\a"-showbLitChar '\b'           = "\\b"-showbLitChar '\f'           = "\\f"-showbLitChar '\n'           = "\\n"-showbLitChar '\r'           = "\\r"-showbLitChar '\t'           = "\\t"-showbLitChar '\v'           = "\\v"-showbLitChar '\SO'          = "\\SO"-showbLitChar c              = s '\\' <> (asciiTabB ! ord c)---- | Convert a 'String' to a 'Builder' (surrounded by double quotes).--- --- /Since: 0.3/-showbString :: String -> Builder-showbString cs = s '"' <> showbLitString cs <> s '"'-{-# INLINE showbString #-}---- | Convert a 'String' to a 'Builder' (without double quotes).--- --- /Since: 0.3/-showbLitString :: String -> Builder-showbLitString []             = mempty-showbLitString ('\SO':'H':cs) = "\\SO\\&H" <> showbLitString cs-showbLitString ('"':cs)       = "\\\"" <> showbLitString cs-showbLitString (c:d:cs)-    | c > '\DEL' && isDigit d = s '\\' <> showbIntPrec 0 (ord c) <> "\\&" <> s d <> showbLitString cs-showbLitString (c:cs)         = showbLitChar c <> showbLitString cs---- | Convert a 'GeneralCategory' to a 'Builder'.--- --- /Since: 0.3/-showbGeneralCategory :: GeneralCategory -> Builder-showbGeneralCategory = showb-{-# INLINE showbGeneralCategory #-}--instance Show Char where-    showb = showbChar-    INLINE_INST_FUN(showb)-    -    showbList = showbString-    INLINE_INST_FUN(showbList)--$(deriveShow ''GeneralCategory)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell   #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Char
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for 'Char' and 'String'.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Char (
+      showbChar
+    , showbLitChar
+    , showbString
+    , showbLitString
+    , showbGeneralCategory
+    , asciiTabB
+    ) where
+
+import           Data.Array (Array, (!), listArray)
+import           Data.Char (GeneralCategory, isDigit, ord)
+#if !(MIN_VERSION_base(4,8,0))
+import           Data.Monoid (mempty)
+#endif
+import           Data.Text.Lazy.Builder (Builder)
+
+import           Prelude hiding (Show)
+
+import           Text.Show.Text.Classes (Show(..))
+import           Text.Show.Text.Data.Integral (showbIntPrec)
+import           Text.Show.Text.TH.Internal (deriveShow)
+import           Text.Show.Text.Utils ((<>), s)
+
+#include "inline.h"
+
+-- | A table of ASCII control characters that needs to be escaped with a backslash.
+-- 
+-- /Since: 0.5/
+asciiTabB :: Array Int Builder
+asciiTabB = listArray (0, 32) ["NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
+                               "BS" , "HT" , "LF" , "VT" , "FF" , "CR" , "SO" , "SI" ,
+                               "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
+                               "CAN", "EM" , "SUB", "ESC", "FS" , "GS" , "RS" , "US" ,
+                               "SP"]
+
+-- | Convert a 'Char' to a 'Builder' (surrounded by single quotes).
+-- 
+-- /Since: 0.3/
+showbChar :: Char -> Builder
+showbChar '\'' = "'\\''"
+showbChar c    = s '\'' <> showbLitChar c <> s '\''
+{-# INLINE showbChar #-}
+
+-- | Convert a 'Char' to a 'Builder' (without single quotes).
+-- 
+-- /Since: 0.3/
+showbLitChar :: Char -> Builder
+showbLitChar c | c > '\DEL' = s '\\' <> showbIntPrec 0 (ord c)
+showbLitChar '\DEL'         = "\\DEL"
+showbLitChar '\\'           = "\\\\"
+showbLitChar c | c >= ' '   = s c
+showbLitChar '\a'           = "\\a"
+showbLitChar '\b'           = "\\b"
+showbLitChar '\f'           = "\\f"
+showbLitChar '\n'           = "\\n"
+showbLitChar '\r'           = "\\r"
+showbLitChar '\t'           = "\\t"
+showbLitChar '\v'           = "\\v"
+showbLitChar '\SO'          = "\\SO"
+showbLitChar c              = s '\\' <> (asciiTabB ! ord c)
+
+-- | Convert a 'String' to a 'Builder' (surrounded by double quotes).
+-- 
+-- /Since: 0.3/
+showbString :: String -> Builder
+showbString cs = s '"' <> showbLitString cs <> s '"'
+{-# INLINE showbString #-}
+
+-- | Convert a 'String' to a 'Builder' (without double quotes).
+-- 
+-- /Since: 0.3/
+showbLitString :: String -> Builder
+showbLitString []             = mempty
+showbLitString ('\SO':'H':cs) = "\\SO\\&H" <> showbLitString cs
+showbLitString ('"':cs)       = "\\\"" <> showbLitString cs
+showbLitString (c:d:cs)
+    | c > '\DEL' && isDigit d = s '\\' <> showbIntPrec 0 (ord c) <> "\\&" <> s d <> showbLitString cs
+showbLitString (c:cs)         = showbLitChar c <> showbLitString cs
+
+-- | Convert a 'GeneralCategory' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbGeneralCategory :: GeneralCategory -> Builder
+showbGeneralCategory = showb
+{-# INLINE showbGeneralCategory #-}
+
+instance Show Char where
+    showb = showbChar
+    INLINE_INST_FUN(showb)
+    
+    showbList = showbString
+    INLINE_INST_FUN(showbList)
+
+$(deriveShow ''GeneralCategory)
src/Text/Show/Text/Data/Complex.hs view
@@ -1,66 +1,66 @@-{-# LANGUAGE CPP             #-}-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Ratio-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Ratio' values.--/Since: 0.5/--}-module Text.Show.Text.Data.Complex (showbComplexPrec) where--import Data.Complex (Complex)-import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec))-import Text.Show.Text.Data.Floating ()-#if MIN_VERSION_base(4,4,0)-import Text.Show.Text.Classes (Show1(showbPrec1))-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec,-                                   specializeTypes)-#else-import Text.Show.Text.TH.Internal (mkShowbPrec)-#endif--#include "inline.h"---- | Convert a 'Complex' value to a 'Builder' with the given precedence.--- --- /Since: 0.5/-#if MIN_VERSION_base(4,4,0)-showbComplexPrec :: Show a-#else-showbComplexPrec :: (RealFloat a, Show a)-#endif-                 => Int-                 -> Complex a-                 -> Builder-showbComplexPrec = showbPrec-{-# INLINE showbComplexPrec #-}--#if MIN_VERSION_base(4,4,0)-$(deriveShowPragmas defaultInlineShowbPrec {-                        specializeTypes = [ [t| Complex Float  |]-                                          , [t| Complex Double |]-                                          ]-                    }-                    ''Complex)--instance Show1 Complex where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)-#else-instance (RealFloat a, Show a) => Show (Complex a) where-    {-# SPECIALIZE instance Show (Complex Float)  #-}-    {-# SPECIALIZE instance Show (Complex Double) #-}-    showbPrec = $(mkShowbPrec ''Complex)-    INLINE_INST_FUN(showbPrec)-#endif+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Ratio
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Ratio' values.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Data.Complex (showbComplexPrec) where
+
+import Data.Complex (Complex)
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec))
+import Text.Show.Text.Data.Floating ()
+#if MIN_VERSION_base(4,4,0)
+import Text.Show.Text.Classes (Show1(showbPrec1))
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec,
+                                   specializeTypes)
+#else
+import Text.Show.Text.TH.Internal (mkShowbPrec)
+#endif
+
+#include "inline.h"
+
+-- | Convert a 'Complex' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.5/
+#if MIN_VERSION_base(4,4,0)
+showbComplexPrec :: Show a
+#else
+showbComplexPrec :: (RealFloat a, Show a)
+#endif
+                 => Int
+                 -> Complex a
+                 -> Builder
+showbComplexPrec = showbPrec
+{-# INLINE showbComplexPrec #-}
+
+#if MIN_VERSION_base(4,4,0)
+$(deriveShowPragmas defaultInlineShowbPrec {
+                        specializeTypes = [ [t| Complex Float  |]
+                                          , [t| Complex Double |]
+                                          ]
+                    }
+                    ''Complex)
+
+instance Show1 Complex where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+#else
+instance (RealFloat a, Show a) => Show (Complex a) where
+    {-# SPECIALIZE instance Show (Complex Float)  #-}
+    {-# SPECIALIZE instance Show (Complex Double) #-}
+    showbPrec = $(mkShowbPrec ''Complex)
+    INLINE_INST_FUN(showbPrec)
+#endif
src/Text/Show/Text/Data/Data.hs view
@@ -1,79 +1,79 @@-{-# LANGUAGE CPP             #-}-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Data-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for data types in the @Data.Data@ module.--/Since: 0.3/--}-module Text.Show.Text.Data.Data (-      showbConstr-    , showbConstrRepPrec-    , showbDataRepPrec-    , showbDataTypePrec-    , showbFixity-    ) where--import Data.Data (Constr, ConstrRep, DataRep, DataType, Fixity, showConstr)-import Data.Text.Lazy.Builder (Builder, fromString)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec))-import Text.Show.Text.Data.List ()-import Text.Show.Text.Data.Ratio ()-import Text.Show.Text.TH.Internal (deriveShow, deriveShowPragmas,-                                   defaultInlineShowbPrec, defaultInlineShowb)--#include "inline.h"---- | Convert a 'DataType' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbDataTypePrec :: Int -> DataType -> Builder-showbDataTypePrec = showbPrec-{-# INLINE showbDataTypePrec #-}---- | Convert a 'DataRep' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbDataRepPrec :: Int -> DataRep -> Builder-showbDataRepPrec = showbPrec-{-# INLINE showbDataRepPrec #-}---- | Convert a 'Constr' to a 'Builder'.--- --- /Since: 0.3/-showbConstr :: Constr -> Builder-showbConstr = fromString . showConstr-{-# INLINE showbConstr #-}---- | Convert a 'Fixity' value to a 'Builder'.--- --- /Since: 0.3/-showbFixity :: Fixity -> Builder-showbFixity = showb-{-# INLINE showbFixity #-}---- | Convert a 'ConstrRep' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbConstrRepPrec :: Int -> ConstrRep -> Builder-showbConstrRepPrec = showbPrec-{-# INLINE showbConstrRepPrec #-}--$(deriveShowPragmas defaultInlineShowbPrec ''DataType)-$(deriveShow                               ''DataRep)-$(deriveShow                               ''ConstrRep)-$(deriveShowPragmas defaultInlineShowb     ''Fixity)--instance Show Constr where-    showb = showbConstr-    INLINE_INST_FUN(showb)+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Data
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the @Data.Data@ module.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Data (
+      showbConstr
+    , showbConstrRepPrec
+    , showbDataRepPrec
+    , showbDataTypePrec
+    , showbFixity
+    ) where
+
+import Data.Data (Constr, ConstrRep, DataRep, DataType, Fixity, showConstr)
+import Data.Text.Lazy.Builder (Builder, fromString)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec))
+import Text.Show.Text.Data.List ()
+import Text.Show.Text.Data.Ratio ()
+import Text.Show.Text.TH.Internal (deriveShow, deriveShowPragmas,
+                                   defaultInlineShowbPrec, defaultInlineShowb)
+
+#include "inline.h"
+
+-- | Convert a 'DataType' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbDataTypePrec :: Int -> DataType -> Builder
+showbDataTypePrec = showbPrec
+{-# INLINE showbDataTypePrec #-}
+
+-- | Convert a 'DataRep' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbDataRepPrec :: Int -> DataRep -> Builder
+showbDataRepPrec = showbPrec
+{-# INLINE showbDataRepPrec #-}
+
+-- | Convert a 'Constr' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbConstr :: Constr -> Builder
+showbConstr = fromString . showConstr
+{-# INLINE showbConstr #-}
+
+-- | Convert a 'Fixity' value to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbFixity :: Fixity -> Builder
+showbFixity = showb
+{-# INLINE showbFixity #-}
+
+-- | Convert a 'ConstrRep' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbConstrRepPrec :: Int -> ConstrRep -> Builder
+showbConstrRepPrec = showbPrec
+{-# INLINE showbConstrRepPrec #-}
+
+$(deriveShowPragmas defaultInlineShowbPrec ''DataType)
+$(deriveShow                               ''DataRep)
+$(deriveShow                               ''ConstrRep)
+$(deriveShowPragmas defaultInlineShowb     ''Fixity)
+
+instance Show Constr where
+    showb = showbConstr
+    INLINE_INST_FUN(showb)
src/Text/Show/Text/Data/Dynamic.hs view
@@ -1,38 +1,38 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Dynamic-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Dynamic'.--/Since: 0.3/--}-module Text.Show.Text.Data.Dynamic (showbDynamic) where--import Data.Dynamic (Dynamic, dynTypeRep)-import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb))-import Text.Show.Text.Data.Typeable (showbTypeRepPrec)-import Text.Show.Text.Utils ((<>))--#include "inline.h"---- | Convert a 'Dynamic' value to a 'Builder'.--- --- /Since: 0.3/-showbDynamic :: Dynamic -> Builder-showbDynamic dyn = "<<" <> showbTypeRepPrec 0 (dynTypeRep dyn) <> ">>"-{-# INLINE showbDynamic #-}--instance Show Dynamic where-    showb = showbDynamic-    INLINE_INST_FUN(showb)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Dynamic
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Dynamic'.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Dynamic (showbDynamic) where
+
+import Data.Dynamic (Dynamic, dynTypeRep)
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb))
+import Text.Show.Text.Data.Typeable (showbTypeRepPrec)
+import Text.Show.Text.Utils ((<>))
+
+#include "inline.h"
+
+-- | Convert a 'Dynamic' value to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbDynamic :: Dynamic -> Builder
+showbDynamic dyn = "<<" <> showbTypeRepPrec 0 (dynTypeRep dyn) <> ">>"
+{-# INLINE showbDynamic #-}
+
+instance Show Dynamic where
+    showb = showbDynamic
+    INLINE_INST_FUN(showb)
src/Text/Show/Text/Data/Either.hs view
@@ -1,38 +1,38 @@-{-# LANGUAGE CPP             #-}-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Either-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Either' values.--/Since: 0.3/--}-module Text.Show.Text.Data.Either (showbEitherPrec) where--import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1))-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)--#include "inline.h"---- | Convert a 'Either' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbEitherPrec :: (Show a, Show b) => Int -> Either a b -> Builder-showbEitherPrec = showbPrec-{-# INLINE showbEitherPrec #-}--$(deriveShowPragmas defaultInlineShowbPrec ''Either)--instance Show a => Show1 (Either a) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Either
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Either' values.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Either (showbEitherPrec) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1))
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)
+
+#include "inline.h"
+
+-- | Convert a 'Either' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbEitherPrec :: (Show a, Show b) => Int -> Either a b -> Builder
+showbEitherPrec = showbPrec
+{-# INLINE showbEitherPrec #-}
+
+$(deriveShowPragmas defaultInlineShowbPrec ''Either)
+
+instance Show a => Show1 (Either a) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Data/Fixed.hs view
@@ -1,93 +1,93 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Fixed-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Fixed' values.--/Since: 0.3/--}-module Text.Show.Text.Data.Fixed (showbFixed) where--import Data.Fixed (HasResolution(..))-import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb))--#if MIN_VERSION_base(4,7,0)-import Data.Fixed (Fixed(..))-import Data.Int (Int64)-import Data.Semigroup (timesN)-# if !(MIN_VERSION_base(4,8,0))-import Data.Monoid (mempty)-# endif--import Text.Show.Text.Data.Integral ()-import Text.Show.Text.Utils ((<>), lengthB, s)-#else-import Data.Fixed (Fixed, showFixed)-import Data.Text.Lazy.Builder (fromString)-#endif--#include "inline.h"---- | Convert a 'Fixed' value to a 'Builder', where the first argument indicates--- whether to chop off trailing zeroes.--- --- /Since: 0.3/-showbFixed :: HasResolution a => Bool -> Fixed a -> Builder-#if MIN_VERSION_base(4,7,0)-showbFixed chopTrailingZeroes fa@(MkFixed a) | a < 0-    = s '-' <> showbFixed chopTrailingZeroes (asTypeOf (MkFixed (negate a)) fa)-showbFixed chopTrailingZeroes fa@(MkFixed a)-    = showb i <> withDotB (showbIntegerZeroes chopTrailingZeroes digits fracNum)-  where-    res     = fromInteger $ resolution fa-    (i, d)  = divMod (fromInteger a) res-    digits  = ceiling (logBase 10 (fromInteger $ resolution fa) :: Double)-    maxnum  = 10 ^ digits-# if MIN_VERSION_base(4,8,0)-    fracNum = divCeil (d * maxnum) res-    divCeil x y = (x + y - 1) `div` y-# else-    fracNum = div (d * maxnum) res-# endif-#else-showbFixed chopTrailingZeroes = fromString . showFixed chopTrailingZeroes-{-# INLINE showbFixed #-}-#endif--#if MIN_VERSION_base(4,7,0)--- | Only works for positive 'Integer's.-showbIntegerZeroes :: Bool -> Int64 -> Integer -> Builder-showbIntegerZeroes True _ 0 = mempty-showbIntegerZeroes chopTrailingZeroes digits a-    = timesN (fromIntegral . max 0 $ digits - lengthB sh) (s '0') <> sh'-  where-    sh, sh' :: Builder-    sh  = showb a-    sh' = if chopTrailingZeroes then chopZeroesB a else sh---- | Chops off the trailing zeroes of an 'Integer'.-chopZeroesB :: Integer -> Builder-chopZeroesB 0 = mempty-chopZeroesB a | mod a 10 == 0 = chopZeroesB (div a 10)-chopZeroesB a = showb a---- | Prepends a dot to a non-empty 'Builder'.-withDotB :: Builder -> Builder-withDotB b | b == mempty = mempty-           | otherwise   = s '.' <> b-{-# INLINE withDotB #-}-#endif--instance HasResolution a => Show (Fixed a) where-    showb = showbFixed False-    INLINE_INST_FUN(showb)+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Fixed
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Fixed' values.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Fixed (showbFixed) where
+
+import Data.Fixed (HasResolution(..))
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb))
+
+#if MIN_VERSION_base(4,7,0)
+import Data.Fixed (Fixed(..))
+import Data.Int (Int64)
+import Data.Semigroup (timesN)
+# if !(MIN_VERSION_base(4,8,0))
+import Data.Monoid (mempty)
+# endif
+
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.Utils ((<>), lengthB, s)
+#else
+import Data.Fixed (Fixed, showFixed)
+import Data.Text.Lazy.Builder (fromString)
+#endif
+
+#include "inline.h"
+
+-- | Convert a 'Fixed' value to a 'Builder', where the first argument indicates
+-- whether to chop off trailing zeroes.
+-- 
+-- /Since: 0.3/
+showbFixed :: HasResolution a => Bool -> Fixed a -> Builder
+#if MIN_VERSION_base(4,7,0)
+showbFixed chopTrailingZeroes fa@(MkFixed a) | a < 0
+    = s '-' <> showbFixed chopTrailingZeroes (asTypeOf (MkFixed (negate a)) fa)
+showbFixed chopTrailingZeroes fa@(MkFixed a)
+    = showb i <> withDotB (showbIntegerZeroes chopTrailingZeroes digits fracNum)
+  where
+    res     = fromInteger $ resolution fa
+    (i, d)  = divMod (fromInteger a) res
+    digits  = ceiling (logBase 10 (fromInteger $ resolution fa) :: Double)
+    maxnum  = 10 ^ digits
+# if MIN_VERSION_base(4,8,0)
+    fracNum = divCeil (d * maxnum) res
+    divCeil x y = (x + y - 1) `div` y
+# else
+    fracNum = div (d * maxnum) res
+# endif
+#else
+showbFixed chopTrailingZeroes = fromString . showFixed chopTrailingZeroes
+{-# INLINE showbFixed #-}
+#endif
+
+#if MIN_VERSION_base(4,7,0)
+-- | Only works for positive 'Integer's.
+showbIntegerZeroes :: Bool -> Int64 -> Integer -> Builder
+showbIntegerZeroes True _ 0 = mempty
+showbIntegerZeroes chopTrailingZeroes digits a
+    = timesN (fromIntegral . max 0 $ digits - lengthB sh) (s '0') <> sh'
+  where
+    sh, sh' :: Builder
+    sh  = showb a
+    sh' = if chopTrailingZeroes then chopZeroesB a else sh
+
+-- | Chops off the trailing zeroes of an 'Integer'.
+chopZeroesB :: Integer -> Builder
+chopZeroesB 0 = mempty
+chopZeroesB a | mod a 10 == 0 = chopZeroesB (div a 10)
+chopZeroesB a = showb a
+
+-- | Prepends a dot to a non-empty 'Builder'.
+withDotB :: Builder -> Builder
+withDotB b | b == mempty = mempty
+           | otherwise   = s '.' <> b
+{-# INLINE withDotB #-}
+#endif
+
+instance HasResolution a => Show (Fixed a) where
+    showb = showbFixed False
+    INLINE_INST_FUN(showb)
src/Text/Show/Text/Data/Floating.hs view
@@ -1,392 +1,392 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Floating-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for floating-point types.--/Since: 0.3/--}-module Text.Show.Text.Data.Floating (-      showbRealFloatPrec-    , showbFloatPrec-    , showbDoublePrec-    , showbEFloat-    , showbFFloat-    , showbGFloat-    , showbFFloatAlt-    , showbGFloatAlt-    ) where--import           Data.Array.Base (unsafeAt)-import           Data.Array.IArray (Array, array)-import qualified Data.Text as T (replicate)-import           Data.Text.Lazy.Builder (Builder, fromString, fromText)-import           Data.Text.Lazy.Builder.Int (decimal)-import           Data.Text.Lazy.Builder.RealFloat (FPFormat(..))--import           Prelude hiding (Show)--import           Text.Show.Text.Classes (Show(showbPrec), showbParen)-import           Text.Show.Text.Utils ((<>), i2d, s)--#include "inline.h"---- | Convert a 'RealFloat' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbRealFloatPrec :: RealFloat a => Int -> a -> Builder-showbRealFloatPrec p x-    | x < 0 || isNegativeZero x = showbParen (p > 6) $ s '-' <> showbGFloat Nothing (-x)-    | otherwise                 = showbGFloat Nothing x-{-# INLINE showbRealFloatPrec #-}---- | Convert a 'Float' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbFloatPrec :: Int -> Float -> Builder-showbFloatPrec = showbRealFloatPrec-{-# INLINE showbFloatPrec #-}---- | Convert a 'Double' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbDoublePrec :: Int -> Double -> Builder-showbDoublePrec = showbRealFloatPrec-{-# INLINE showbDoublePrec #-}---- | Show a signed 'RealFloat' value--- using scientific (exponential) notation (e.g. @2.45e2@, @1.5e-3@).--- --- In the call @'showbEFloat' digs val@, if @digs@ is 'Nothing',--- the value is shown to full precision; if @digs@ is @'Just' d@,--- then at most @d@ digits after the decimal point are shown.--- --- /Since: 0.3/-showbEFloat :: RealFloat a => Maybe Int -> a -> Builder-showbEFloat = formatRealFloat Exponent-{-# INLINE showbEFloat #-}---- | Show a signed 'RealFloat' value--- using standard decimal notation (e.g. @245000@, @0.0015@).--- --- In the call @'showbFFloat' digs val@, if @digs@ is 'Nothing',--- the value is shown to full precision; if @digs@ is @'Just' d@,--- then at most @d@ digits after the decimal point are shown.--- --- /Since: 0.3/-showbFFloat :: RealFloat a => Maybe Int -> a -> Builder-showbFFloat = formatRealFloat Fixed-{-# INLINE showbFFloat #-}---- | Show a signed 'RealFloat' value--- using standard decimal notation for arguments whose absolute value lies--- between @0.1@ and @9,999,999@, and scientific notation otherwise.--- --- In the call @'showbGFloat' digs val@, if @digs@ is 'Nothing',--- the value is shown to full precision; if @digs@ is @'Just' d@,--- then at most @d@ digits after the decimal point are shown.--- --- /Since: 0.3/-showbGFloat :: RealFloat a => Maybe Int -> a -> Builder-showbGFloat = formatRealFloat Generic-{-# INLINE showbGFloat #-}---- | Show a signed 'RealFloat' value--- using standard decimal notation (e.g. @245000@, @0.0015@).--- --- This behaves as 'showFFloat', except that a decimal point--- is always guaranteed, even if not needed.--- --- /Since: 0.3/-showbFFloatAlt :: RealFloat a => Maybe Int -> a -> Builder-showbFFloatAlt d x = formatRealFloatAlt Fixed d True x-{-# INLINE showbFFloatAlt #-}---- | Show a signed 'RealFloat' value--- using standard decimal notation for arguments whose absolute value lies--- between @0.1@ and @9,999,999@, and scientific notation otherwise.--- --- This behaves as 'showFFloat', except that a decimal point--- is always guaranteed, even if not needed.--- --- /Since: 0.3/-showbGFloatAlt :: RealFloat a => Maybe Int -> a -> Builder-showbGFloatAlt d x = formatRealFloatAlt Generic d True x-{-# INLINE showbGFloatAlt #-}--instance Show Float where-    showbPrec = showbFloatPrec-    INLINE_INST_FUN(showbPrec)--instance Show Double where-    showbPrec = showbDoublePrec-    INLINE_INST_FUN(showbPrec)------------------------------------------------------------------------------------ GHC.Float internal functions, adapted for Builders------------------------------------------------------------------------------------ | Like 'formatRealFloatAlt', except that the decimal is only shown for arguments--- whose absolute value is between @0.1@ and @9,999,999@.-formatRealFloat :: RealFloat a-                => FPFormat  -- ^ What notation to use.-                -> Maybe Int -- ^ Number of decimal places to render.-                -> a-                -> Builder-formatRealFloat fmt decs = formatRealFloatAlt fmt decs False-{-# INLINE formatRealFloat #-}---- | Converts a 'RealFloat' value to a Builder. Super-configurable.-formatRealFloatAlt :: RealFloat a-                   => FPFormat  -- ^ What notation to use.-                   -> Maybe Int -- ^ Number of decimal places to render.-                   -> Bool      -- ^ Should a decimal point always be shown?-                   -> a-                   -> Builder-{-# SPECIALIZE formatRealFloatAlt :: FPFormat -> Maybe Int -> Bool -> Float -> Builder #-}-{-# SPECIALIZE formatRealFloatAlt :: FPFormat -> Maybe Int -> Bool -> Double -> Builder #-}-formatRealFloatAlt fmt decs alt x-   | isNaN x                   = "NaN"-   | isInfinite x              = if x < 0 then "-Infinity" else "Infinity"-   | x < 0 || isNegativeZero x = s '-' <> doFmt fmt (floatToDigits (-x))-   | otherwise                 = doFmt fmt (floatToDigits x)- where-  doFmt format (is, e) =-    let ds = map i2d is in-    case format of-     Generic ->-      doFmt (if e < 0 || e > 7 then Exponent else Fixed)-            (is,e)-     Exponent ->-      case decs of-       Nothing ->-        let show_e' = decimal (e-1) in-        case ds of-          "0"     -> "0.0e0"-          [d]     -> s d <> ".0e" <> show_e'-          (d:ds') -> s d <> s '.' <> fromString ds' <> s 'e' <> show_e'-          []      -> error "formatRealFloat/doFmt/Exponent: []"-       Just dec ->-        let dec' = max dec 1 in-        case is of-         [0] -> "0." <> fromText (T.replicate dec' "0") <> "e0"-         _ ->-          let-           (ei,is') = roundTo (dec'+1) is-           (d:ds') = map i2d (if ei > 0 then init is' else is')-          in-          s d <> s '.' <> fromString ds' <> s 'e' <> decimal (e-1+ei)-     Fixed ->-      let-       mk0 ls = case ls of { "" -> "0" ; _ -> fromString ls}-      in-      case decs of-       Nothing-          | e <= 0    -> "0." <> fromText (T.replicate (-e) "0") <> fromString ds-          | otherwise ->-             let-                f 0 str    rs  = mk0 (reverse str) <> s '.' <> mk0 rs-                f n str    ""  = f (n-1) ('0':str) ""-                f n str (r:rs) = f (n-1) (r:str) rs-             in-                f e "" ds-       Just dec ->-        let dec' = max dec 0 in-        if e >= 0 then-         let-          (ei,is') = roundTo (dec' + e) is-          (ls,rs)  = splitAt (e+ei) (map i2d is')-         in-         mk0 ls <> (if null rs && not alt then "" else s '.' <> fromString rs)-        else-         let-          (ei,is') = roundTo dec' (replicate (-e) 0 ++ is)-          d:ds' = map i2d (if ei > 0 then is' else 0:is')-         in-         s d <> (if null ds' && not alt then "" else s '.' <> fromString ds')---- Based on "Printing Floating-Point Numbers Quickly and Accurately"--- by R.G. Burger and R.K. Dybvig in PLDI 96.--- This version uses a much slower logarithm estimator. It should be improved.---- | 'floatToDigits' takes a base and a non-negative 'RealFloat' number,--- and returns a list of digits and an exponent.--- In particular, if @x>=0@, and------ > floatToDigits base x = ([d1,d2,...,dn], e)------ then------      (1) @n >= 1@------      (2) @x = 0.d1d2...dn * (base**e)@------      (3) @0 <= di <= base-1@-floatToDigits :: (RealFloat a) => a -> ([Int], Int)-{-# SPECIALIZE floatToDigits :: Float -> ([Int], Int) #-}-{-# SPECIALIZE floatToDigits :: Double -> ([Int], Int) #-}-floatToDigits 0 = ([0], 0)-floatToDigits x =- let-  (f0, e0) = decodeFloat x-  (minExp0, _) = floatRange x-  p = floatDigits x-  b = floatRadix x-  minExp = minExp0 - p -- the real minimum exponent-  -- Haskell requires that f be adjusted so denormalized numbers-  -- will have an impossibly low exponent.  Adjust for this.-  (f, e) =-   let n = minExp - e0 in-   if n > 0 then (f0 `quot` (expt b n), e0+n) else (f0, e0)-  (r, s', mUp, mDn) =-   if e >= 0 then-    let be = expt b e in-    if f == expt b (p-1) then-      (f*be*b*2, 2*b, be*b, be)     -- according to Burger and Dybvig-    else-      (f*be*2, 2, be, be)-   else-    if e > minExp && f == expt b (p-1) then-      (f*b*2, expt b (-e+1)*2, b, 1)-    else-      (f*2, expt b (-e)*2, 1, 1)-  k :: Int-  k =-   let-    k0 :: Int-    k0 =-     if b == 2 then-        -- logBase 10 2 is very slightly larger than 8651/28738-        -- (about 5.3558e-10), so if log x >= 0, the approximation-        -- k1 is too small, hence we add one and need one fixup step less.-        -- If log x < 0, the approximation errs rather on the high side.-        -- That is usually more than compensated for by ignoring the-        -- fractional part of logBase 2 x, but when x is a power of 1/2-        -- or slightly larger and the exponent is a multiple of the-        -- denominator of the rational approximation to logBase 10 2,-        -- k1 is larger than logBase 10 x. If k1 > 1 + logBase 10 x,-        -- we get a leading zero-digit we don't want.-        -- With the approximation 3/10, this happened for-        -- 0.5^1030, 0.5^1040, ..., 0.5^1070 and values close above.-        -- The approximation 8651/28738 guarantees k1 < 1 + logBase 10 x-        -- for IEEE-ish floating point types with exponent fields-        -- <= 17 bits and mantissae of several thousand bits, earlier-        -- convergents to logBase 10 2 would fail for long double.-        -- Using quot instead of div is a little faster and requires-        -- fewer fixup steps for negative lx.-        let lx = p - 1 + e0-            k1 = (lx * 8651) `quot` 28738-        in if lx >= 0 then k1 + 1 else k1-     else-        -- f :: Integer, log :: Float -> Float,-        --               ceiling :: Float -> Int-        ceiling ((log (fromInteger (f+1) :: Float) +-                 fromIntegral e * log (fromInteger b)) /-                   log 10)---WAS:            fromInt e * log (fromInteger b))--    fixup n =-      if n >= 0 then-        if r + mUp <= expt 10 n * s' then n else fixup (n+1)-      else-        if expt 10 (-n) * (r + mUp) <= s' then n else fixup (n+1)-   in-   fixup k0--  gen ds rn sN mUpN mDnN =-   let-    (dn, rn') = (rn * 10) `quotRem` sN-    mUpN' = mUpN * 10-    mDnN' = mDnN * 10-   in-   case (rn' < mDnN', rn' + mUpN' > sN) of-    (True,  False) -> dn : ds-    (False, True)  -> dn+1 : ds-    (True,  True)  -> if rn' * 2 < sN then dn : ds else dn+1 : ds-    (False, False) -> gen (dn:ds) rn' sN mUpN' mDnN'--  rds =-   if k >= 0 then-      gen [] r (s' * expt 10 k) mUp mDn-   else-     let bk = expt 10 (-k) in-     gen [] (r * bk) s' (mUp * bk) (mDn * bk)- in- (map fromIntegral (reverse rds), k)--roundTo :: Int -> [Int] -> (Int,[Int])-#if MIN_VERSION_base(4,6,0)-roundTo d is =-  case f d True is of-    x@(0,_) -> x-    (1,xs)  -> (1, 1:xs)-    _       -> error "roundTo: bad Value"- where-  b2 = base `quot` 2--  f n _ []     = (0, replicate n 0)-  f 0 e (x:xs) | x == b2 && e && all (== 0) xs = (0, [])   -- Round to even when at exactly half the base-               | otherwise = (if x >= b2 then 1 else 0, [])-  f n _ (i:xs)-     | i' == base = (1,0:ds)-     | otherwise  = (0,i':ds)-      where-       (c,ds) = f (n-1) (even i) xs-       i'     = c + i-  base = 10-#else-roundTo d is =-  case f d is of-    x@(0,_) -> x-    (1,xs)  -> (1, 1:xs)-    _       -> error "roundTo: bad Value"- where-  f n []     = (0, replicate n 0)-  f 0 (x:_)  = (if x >= 5 then 1 else 0, [])-  f n (i:xs)-     | i' == 10  = (1,0:ds)-     | otherwise = (0,i':ds)-      where-       (c,ds) = f (n-1) xs-       i'     = c + i-#endif----- Exponentiation with a cache for the most common numbers.---- | The minimum exponent in the cache.-minExpt :: Int-minExpt = 0-{-# INLINE minExpt #-}---- | The maximum exponent (of 2) in the cache.-maxExpt :: Int-maxExpt = 1100-{-# INLINE maxExpt #-}---- | Exponentiate an 'Integer', using a cache if possible.-expt :: Integer -> Int -> Integer-expt base n-    | base == 2 && n >= minExpt && n <= maxExpt = expts `unsafeAt` n-    | base == 10 && n <= maxExpt10              = expts10 `unsafeAt` n-    | otherwise                                 = base^n---- | Cached powers of two.-expts :: Array Int Integer-expts = array (minExpt,maxExpt) [(n,2^n) | n <- [minExpt .. maxExpt]]---- | The maximum exponent (of 10) in the cache.-maxExpt10 :: Int-maxExpt10 = 324-{-# INLINE maxExpt10 #-}---- | Cached powers of 10.-expts10 :: Array Int Integer-expts10 = array (minExpt,maxExpt10) [(n,10^n) | n <- [minExpt .. maxExpt10]]+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Floating
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for floating-point types.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Floating (
+      showbRealFloatPrec
+    , showbFloatPrec
+    , showbDoublePrec
+    , showbEFloat
+    , showbFFloat
+    , showbGFloat
+    , showbFFloatAlt
+    , showbGFloatAlt
+    ) where
+
+import           Data.Array.Base (unsafeAt)
+import           Data.Array.IArray (Array, array)
+import qualified Data.Text as T (replicate)
+import           Data.Text.Lazy.Builder (Builder, fromString, fromText)
+import           Data.Text.Lazy.Builder.Int (decimal)
+import           Data.Text.Lazy.Builder.RealFloat (FPFormat(..))
+
+import           Prelude hiding (Show)
+
+import           Text.Show.Text.Classes (Show(showbPrec), showbParen)
+import           Text.Show.Text.Utils ((<>), i2d, s)
+
+#include "inline.h"
+
+-- | Convert a 'RealFloat' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbRealFloatPrec :: RealFloat a => Int -> a -> Builder
+showbRealFloatPrec p x
+    | x < 0 || isNegativeZero x = showbParen (p > 6) $ s '-' <> showbGFloat Nothing (-x)
+    | otherwise                 = showbGFloat Nothing x
+{-# INLINE showbRealFloatPrec #-}
+
+-- | Convert a 'Float' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbFloatPrec :: Int -> Float -> Builder
+showbFloatPrec = showbRealFloatPrec
+{-# INLINE showbFloatPrec #-}
+
+-- | Convert a 'Double' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbDoublePrec :: Int -> Double -> Builder
+showbDoublePrec = showbRealFloatPrec
+{-# INLINE showbDoublePrec #-}
+
+-- | Show a signed 'RealFloat' value
+-- using scientific (exponential) notation (e.g. @2.45e2@, @1.5e-3@).
+-- 
+-- In the call @'showbEFloat' digs val@, if @digs@ is 'Nothing',
+-- the value is shown to full precision; if @digs@ is @'Just' d@,
+-- then at most @d@ digits after the decimal point are shown.
+-- 
+-- /Since: 0.3/
+showbEFloat :: RealFloat a => Maybe Int -> a -> Builder
+showbEFloat = formatRealFloat Exponent
+{-# INLINE showbEFloat #-}
+
+-- | Show a signed 'RealFloat' value
+-- using standard decimal notation (e.g. @245000@, @0.0015@).
+-- 
+-- In the call @'showbFFloat' digs val@, if @digs@ is 'Nothing',
+-- the value is shown to full precision; if @digs@ is @'Just' d@,
+-- then at most @d@ digits after the decimal point are shown.
+-- 
+-- /Since: 0.3/
+showbFFloat :: RealFloat a => Maybe Int -> a -> Builder
+showbFFloat = formatRealFloat Fixed
+{-# INLINE showbFFloat #-}
+
+-- | Show a signed 'RealFloat' value
+-- using standard decimal notation for arguments whose absolute value lies
+-- between @0.1@ and @9,999,999@, and scientific notation otherwise.
+-- 
+-- In the call @'showbGFloat' digs val@, if @digs@ is 'Nothing',
+-- the value is shown to full precision; if @digs@ is @'Just' d@,
+-- then at most @d@ digits after the decimal point are shown.
+-- 
+-- /Since: 0.3/
+showbGFloat :: RealFloat a => Maybe Int -> a -> Builder
+showbGFloat = formatRealFloat Generic
+{-# INLINE showbGFloat #-}
+
+-- | Show a signed 'RealFloat' value
+-- using standard decimal notation (e.g. @245000@, @0.0015@).
+-- 
+-- This behaves as 'showFFloat', except that a decimal point
+-- is always guaranteed, even if not needed.
+-- 
+-- /Since: 0.3/
+showbFFloatAlt :: RealFloat a => Maybe Int -> a -> Builder
+showbFFloatAlt d x = formatRealFloatAlt Fixed d True x
+{-# INLINE showbFFloatAlt #-}
+
+-- | Show a signed 'RealFloat' value
+-- using standard decimal notation for arguments whose absolute value lies
+-- between @0.1@ and @9,999,999@, and scientific notation otherwise.
+-- 
+-- This behaves as 'showFFloat', except that a decimal point
+-- is always guaranteed, even if not needed.
+-- 
+-- /Since: 0.3/
+showbGFloatAlt :: RealFloat a => Maybe Int -> a -> Builder
+showbGFloatAlt d x = formatRealFloatAlt Generic d True x
+{-# INLINE showbGFloatAlt #-}
+
+instance Show Float where
+    showbPrec = showbFloatPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show Double where
+    showbPrec = showbDoublePrec
+    INLINE_INST_FUN(showbPrec)
+
+-------------------------------------------------------------------------------
+-- GHC.Float internal functions, adapted for Builders
+-------------------------------------------------------------------------------
+
+-- | Like 'formatRealFloatAlt', except that the decimal is only shown for arguments
+-- whose absolute value is between @0.1@ and @9,999,999@.
+formatRealFloat :: RealFloat a
+                => FPFormat  -- ^ What notation to use.
+                -> Maybe Int -- ^ Number of decimal places to render.
+                -> a
+                -> Builder
+formatRealFloat fmt decs = formatRealFloatAlt fmt decs False
+{-# INLINE formatRealFloat #-}
+
+-- | Converts a 'RealFloat' value to a Builder. Super-configurable.
+formatRealFloatAlt :: RealFloat a
+                   => FPFormat  -- ^ What notation to use.
+                   -> Maybe Int -- ^ Number of decimal places to render.
+                   -> Bool      -- ^ Should a decimal point always be shown?
+                   -> a
+                   -> Builder
+{-# SPECIALIZE formatRealFloatAlt :: FPFormat -> Maybe Int -> Bool -> Float -> Builder #-}
+{-# SPECIALIZE formatRealFloatAlt :: FPFormat -> Maybe Int -> Bool -> Double -> Builder #-}
+formatRealFloatAlt fmt decs alt x
+   | isNaN x                   = "NaN"
+   | isInfinite x              = if x < 0 then "-Infinity" else "Infinity"
+   | x < 0 || isNegativeZero x = s '-' <> doFmt fmt (floatToDigits (-x))
+   | otherwise                 = doFmt fmt (floatToDigits x)
+ where
+  doFmt format (is, e) =
+    let ds = map i2d is in
+    case format of
+     Generic ->
+      doFmt (if e < 0 || e > 7 then Exponent else Fixed)
+            (is,e)
+     Exponent ->
+      case decs of
+       Nothing ->
+        let show_e' = decimal (e-1) in
+        case ds of
+          "0"     -> "0.0e0"
+          [d]     -> s d <> ".0e" <> show_e'
+          (d:ds') -> s d <> s '.' <> fromString ds' <> s 'e' <> show_e'
+          []      -> error "formatRealFloat/doFmt/Exponent: []"
+       Just dec ->
+        let dec' = max dec 1 in
+        case is of
+         [0] -> "0." <> fromText (T.replicate dec' "0") <> "e0"
+         _ ->
+          let
+           (ei,is') = roundTo (dec'+1) is
+           (d:ds') = map i2d (if ei > 0 then init is' else is')
+          in
+          s d <> s '.' <> fromString ds' <> s 'e' <> decimal (e-1+ei)
+     Fixed ->
+      let
+       mk0 ls = case ls of { "" -> "0" ; _ -> fromString ls}
+      in
+      case decs of
+       Nothing
+          | e <= 0    -> "0." <> fromText (T.replicate (-e) "0") <> fromString ds
+          | otherwise ->
+             let
+                f 0 str    rs  = mk0 (reverse str) <> s '.' <> mk0 rs
+                f n str    ""  = f (n-1) ('0':str) ""
+                f n str (r:rs) = f (n-1) (r:str) rs
+             in
+                f e "" ds
+       Just dec ->
+        let dec' = max dec 0 in
+        if e >= 0 then
+         let
+          (ei,is') = roundTo (dec' + e) is
+          (ls,rs)  = splitAt (e+ei) (map i2d is')
+         in
+         mk0 ls <> (if null rs && not alt then "" else s '.' <> fromString rs)
+        else
+         let
+          (ei,is') = roundTo dec' (replicate (-e) 0 ++ is)
+          d:ds' = map i2d (if ei > 0 then is' else 0:is')
+         in
+         s d <> (if null ds' && not alt then "" else s '.' <> fromString ds')
+
+-- Based on "Printing Floating-Point Numbers Quickly and Accurately"
+-- by R.G. Burger and R.K. Dybvig in PLDI 96.
+-- This version uses a much slower logarithm estimator. It should be improved.
+
+-- | 'floatToDigits' takes a base and a non-negative 'RealFloat' number,
+-- and returns a list of digits and an exponent.
+-- In particular, if @x>=0@, and
+--
+-- > floatToDigits base x = ([d1,d2,...,dn], e)
+--
+-- then
+--
+--      (1) @n >= 1@
+--
+--      (2) @x = 0.d1d2...dn * (base**e)@
+--
+--      (3) @0 <= di <= base-1@
+floatToDigits :: (RealFloat a) => a -> ([Int], Int)
+{-# SPECIALIZE floatToDigits :: Float -> ([Int], Int) #-}
+{-# SPECIALIZE floatToDigits :: Double -> ([Int], Int) #-}
+floatToDigits 0 = ([0], 0)
+floatToDigits x =
+ let
+  (f0, e0) = decodeFloat x
+  (minExp0, _) = floatRange x
+  p = floatDigits x
+  b = floatRadix x
+  minExp = minExp0 - p -- the real minimum exponent
+  -- Haskell requires that f be adjusted so denormalized numbers
+  -- will have an impossibly low exponent.  Adjust for this.
+  (f, e) =
+   let n = minExp - e0 in
+   if n > 0 then (f0 `quot` (expt b n), e0+n) else (f0, e0)
+  (r, s', mUp, mDn) =
+   if e >= 0 then
+    let be = expt b e in
+    if f == expt b (p-1) then
+      (f*be*b*2, 2*b, be*b, be)     -- according to Burger and Dybvig
+    else
+      (f*be*2, 2, be, be)
+   else
+    if e > minExp && f == expt b (p-1) then
+      (f*b*2, expt b (-e+1)*2, b, 1)
+    else
+      (f*2, expt b (-e)*2, 1, 1)
+  k :: Int
+  k =
+   let
+    k0 :: Int
+    k0 =
+     if b == 2 then
+        -- logBase 10 2 is very slightly larger than 8651/28738
+        -- (about 5.3558e-10), so if log x >= 0, the approximation
+        -- k1 is too small, hence we add one and need one fixup step less.
+        -- If log x < 0, the approximation errs rather on the high side.
+        -- That is usually more than compensated for by ignoring the
+        -- fractional part of logBase 2 x, but when x is a power of 1/2
+        -- or slightly larger and the exponent is a multiple of the
+        -- denominator of the rational approximation to logBase 10 2,
+        -- k1 is larger than logBase 10 x. If k1 > 1 + logBase 10 x,
+        -- we get a leading zero-digit we don't want.
+        -- With the approximation 3/10, this happened for
+        -- 0.5^1030, 0.5^1040, ..., 0.5^1070 and values close above.
+        -- The approximation 8651/28738 guarantees k1 < 1 + logBase 10 x
+        -- for IEEE-ish floating point types with exponent fields
+        -- <= 17 bits and mantissae of several thousand bits, earlier
+        -- convergents to logBase 10 2 would fail for long double.
+        -- Using quot instead of div is a little faster and requires
+        -- fewer fixup steps for negative lx.
+        let lx = p - 1 + e0
+            k1 = (lx * 8651) `quot` 28738
+        in if lx >= 0 then k1 + 1 else k1
+     else
+        -- f :: Integer, log :: Float -> Float,
+        --               ceiling :: Float -> Int
+        ceiling ((log (fromInteger (f+1) :: Float) +
+                 fromIntegral e * log (fromInteger b)) /
+                   log 10)
+--WAS:            fromInt e * log (fromInteger b))
+
+    fixup n =
+      if n >= 0 then
+        if r + mUp <= expt 10 n * s' then n else fixup (n+1)
+      else
+        if expt 10 (-n) * (r + mUp) <= s' then n else fixup (n+1)
+   in
+   fixup k0
+
+  gen ds rn sN mUpN mDnN =
+   let
+    (dn, rn') = (rn * 10) `quotRem` sN
+    mUpN' = mUpN * 10
+    mDnN' = mDnN * 10
+   in
+   case (rn' < mDnN', rn' + mUpN' > sN) of
+    (True,  False) -> dn : ds
+    (False, True)  -> dn+1 : ds
+    (True,  True)  -> if rn' * 2 < sN then dn : ds else dn+1 : ds
+    (False, False) -> gen (dn:ds) rn' sN mUpN' mDnN'
+
+  rds =
+   if k >= 0 then
+      gen [] r (s' * expt 10 k) mUp mDn
+   else
+     let bk = expt 10 (-k) in
+     gen [] (r * bk) s' (mUp * bk) (mDn * bk)
+ in
+ (map fromIntegral (reverse rds), k)
+
+roundTo :: Int -> [Int] -> (Int,[Int])
+#if MIN_VERSION_base(4,6,0)
+roundTo d is =
+  case f d True is of
+    x@(0,_) -> x
+    (1,xs)  -> (1, 1:xs)
+    _       -> error "roundTo: bad Value"
+ where
+  b2 = base `quot` 2
+
+  f n _ []     = (0, replicate n 0)
+  f 0 e (x:xs) | x == b2 && e && all (== 0) xs = (0, [])   -- Round to even when at exactly half the base
+               | otherwise = (if x >= b2 then 1 else 0, [])
+  f n _ (i:xs)
+     | i' == base = (1,0:ds)
+     | otherwise  = (0,i':ds)
+      where
+       (c,ds) = f (n-1) (even i) xs
+       i'     = c + i
+  base = 10
+#else
+roundTo d is =
+  case f d is of
+    x@(0,_) -> x
+    (1,xs)  -> (1, 1:xs)
+    _       -> error "roundTo: bad Value"
+ where
+  f n []     = (0, replicate n 0)
+  f 0 (x:_)  = (if x >= 5 then 1 else 0, [])
+  f n (i:xs)
+     | i' == 10  = (1,0:ds)
+     | otherwise = (0,i':ds)
+      where
+       (c,ds) = f (n-1) xs
+       i'     = c + i
+#endif
+
+
+-- Exponentiation with a cache for the most common numbers.
+
+-- | The minimum exponent in the cache.
+minExpt :: Int
+minExpt = 0
+{-# INLINE minExpt #-}
+
+-- | The maximum exponent (of 2) in the cache.
+maxExpt :: Int
+maxExpt = 1100
+{-# INLINE maxExpt #-}
+
+-- | Exponentiate an 'Integer', using a cache if possible.
+expt :: Integer -> Int -> Integer
+expt base n
+    | base == 2 && n >= minExpt && n <= maxExpt = expts `unsafeAt` n
+    | base == 10 && n <= maxExpt10              = expts10 `unsafeAt` n
+    | otherwise                                 = base^n
+
+-- | Cached powers of two.
+expts :: Array Int Integer
+expts = array (minExpt,maxExpt) [(n,2^n) | n <- [minExpt .. maxExpt]]
+
+-- | The maximum exponent (of 10) in the cache.
+maxExpt10 :: Int
+maxExpt10 = 324
+{-# INLINE maxExpt10 #-}
+
+-- | Cached powers of 10.
+expts10 :: Array Int Integer
+expts10 = array (minExpt,maxExpt10) [(n,10^n) | n <- [minExpt .. maxExpt10]]
src/Text/Show/Text/Data/Functor/Identity.hs view
@@ -1,42 +1,42 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Functor.Identity-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Identity' values.--/Since: 0.5/--}-module Text.Show.Text.Data.Functor.Identity (showbIdentityPrec) where--import Data.Functor.Identity (Identity(..))-import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1), showbUnary)--#include "inline.h"---- | Convert an 'Identity' value to a 'Builder' with the given precedence.--- --- /Since: 0.5/-showbIdentityPrec :: Show a => Int -> Identity a -> Builder--- This would be equivalent to the derived instance of 'Identity' if the--- 'runIdentity' field were removed.-showbIdentityPrec p (Identity x) = showbUnary "Identity" p x-{-# INLINE showbIdentityPrec #-}--instance Show a => Show (Identity a) where-    showbPrec = showbIdentityPrec-    {-# INLINE showbPrec #-}--instance Show1 Identity where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Functor.Identity
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Identity' values.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Data.Functor.Identity (showbIdentityPrec) where
+
+import Data.Functor.Identity (Identity(..))
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1), showbUnary)
+
+#include "inline.h"
+
+-- | Convert an 'Identity' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.5/
+showbIdentityPrec :: Show a => Int -> Identity a -> Builder
+-- This would be equivalent to the derived instance of 'Identity' if the
+-- 'runIdentity' field were removed.
+showbIdentityPrec p (Identity x) = showbUnary "Identity" p x
+{-# INLINE showbIdentityPrec #-}
+
+instance Show a => Show (Identity a) where
+    showbPrec = showbIdentityPrec
+    {-# INLINE showbPrec #-}
+
+instance Show1 Identity where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Data/Integral.hs view
@@ -1,249 +1,249 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE MagicHash         #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Integral-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for integral types.--/Since: 0.3/--}-module Text.Show.Text.Data.Integral (-      showbIntPrec-    , showbInt8Prec-    , showbInt16Prec-    , showbInt32Prec-    , showbInt64Prec-    , showbIntegerPrec-    , showbIntegralPrec-    , showbIntAtBase-    , showbBin-    , showbHex-    , showbOct-    , showbWord-    , showbWord8-    , showbWord16-    , showbWord32-    , showbWord64-    ) where--import           Data.Char (intToDigit)-import           Data.Int (Int8, Int16, Int32, Int64)-#if !(MIN_VERSION_base(4,8,0))-import           Data.Monoid (mempty)-#endif-import           Data.Text.Lazy.Builder (Builder)-import           Data.Text.Lazy.Builder.Int (decimal)-import           Data.Word ( Word8-                           , Word16-                           , Word32-                           , Word64-#if !(MIN_VERSION_base(4,8,0))-                           , Word-#endif-                           )--import           GHC.Exts (Int(I#))-#if __GLASGOW_HASKELL__ >= 708-import           GHC.Exts (isTrue#)-import           GHC.Prim (Int#)-#endif-import           GHC.Prim ((<#), (>#))--import           Prelude hiding (Show)--import           Text.Show.Text.Classes (Show(showb, showbPrec))-import           Text.Show.Text.Utils ((<>), s, toString)--#include "inline.h"---- | Convert an 'Int' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbIntPrec :: Int -> Int -> Builder-showbIntPrec (I# p) n'@(I# n)-    | isTrue (n <# 0#) && isTrue (p ># 6#) = s '(' <> decimal n' <> s ')'-    | otherwise = decimal n'-  where-#if __GLASGOW_HASKELL__ >= 708-      isTrue :: Int# -> Bool-      isTrue b = isTrue# b-#else-      isTrue :: Bool -> Bool-      isTrue = id-#endif---- | Convert an 'Int8' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbInt8Prec :: Int -> Int8 -> Builder-showbInt8Prec p = showbIntPrec p . fromIntegral-{-# INLINE showbInt8Prec #-}---- | Convert an 'Int16' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbInt16Prec :: Int -> Int16 -> Builder-showbInt16Prec p = showbIntPrec p . fromIntegral-{-# INLINE showbInt16Prec #-}---- | Convert an 'Int32' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbInt32Prec :: Int -> Int32 -> Builder-showbInt32Prec p = showbIntPrec p . fromIntegral-{-# INLINE showbInt32Prec #-}---- | Convert an 'Int64' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbInt64Prec :: Int -> Int64 -> Builder-#if WORD_SIZE_IN_BITS < 64-showbInt64Prec p = showbIntegerPrec p . toInteger-#else-showbInt64Prec p = showbIntPrec p . fromIntegral-#endif-{-# INLINE showbInt64Prec #-}---- | Convert an 'Integer' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbIntegerPrec :: Int -> Integer -> Builder-showbIntegerPrec p n-    | p > 6 && n < 0 = s '(' <> decimal n <> s ')'-    | otherwise      = decimal n-{-# INLINE showbIntegerPrec #-}---- | Convert an 'Integral' type to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbIntegralPrec :: Integral a => Int -> a -> Builder-showbIntegralPrec p = showbIntegerPrec p . toInteger-{-# INLINE showbIntegralPrec #-}---- | Shows a /non-negative/ 'Integral' number using the base specified by the--- first argument, and the character representation specified by the second.--- --- /Since: 0.3/-showbIntAtBase :: (Integral a, Show a) => a -> (Int -> Char) -> a -> Builder-showbIntAtBase base toChr n0-    | base <= 1 = error . toString $ "Text.Show.Text.Int.showbIntAtBase: applied to unsupported base" <> showb base-    | n0 < 0    = error . toString $ "Text.Show.Text.Int.showbIntAtBase: applied to negative number " <> showb n0-    | otherwise = showbIt (quotRem n0 base) mempty-  where-    showbIt (n, d) b = seq c $ -- stricter than necessary-        case n of-             0 -> b'-             _ -> showbIt (quotRem n base) b'-      where-        c :: Char-        c = toChr $ fromIntegral d-        -        b' :: Builder-        b' = s c <> b---- | Show /non-negative/ 'Integral' numbers in base 2.--- --- /Since: 0.3/-showbBin :: (Integral a, Show a) => a -> Builder-showbBin = showbIntAtBase 2 intToDigit-{-# INLINE showbBin #-}---- | Show /non-negative/ 'Integral' numbers in base 16.--- --- /Since: 0.3/-showbHex :: (Integral a, Show a) => a -> Builder-showbHex = showbIntAtBase 16 intToDigit-{-# INLINE showbHex #-}---- | Show /non-negative/ 'Integral' numbers in base 8.--- --- /Since: 0.3/-showbOct :: (Integral a, Show a) => a -> Builder-showbOct = showbIntAtBase 8 intToDigit-{-# INLINE showbOct #-}---- | Convert a 'Word' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbWord :: Word -> Builder-showbWord = decimal-{-# INLINE showbWord #-}---- | Convert a 'Word8' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbWord8 :: Word8 -> Builder-showbWord8 = decimal-{-# INLINE showbWord8 #-}---- | Convert a 'Word16' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbWord16 :: Word16 -> Builder-showbWord16 = decimal-{-# INLINE showbWord16 #-}---- | Convert a 'Word32' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbWord32 :: Word32 -> Builder-showbWord32 = decimal-{-# INLINE showbWord32 #-}---- | Convert a 'Word64' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbWord64 :: Word64 -> Builder-showbWord64 = decimal-{-# INLINE showbWord64 #-}--instance Show Int where-    showbPrec = showbIntPrec-    INLINE_INST_FUN(showbPrec)--instance Show Int8 where-    showbPrec = showbInt8Prec-    INLINE_INST_FUN(showbPrec)--instance Show Int16 where-    showbPrec = showbInt16Prec-    INLINE_INST_FUN(showbPrec)--instance Show Int32 where-    showbPrec = showbInt32Prec-    INLINE_INST_FUN(showbPrec)--instance Show Int64 where-    showbPrec = showbInt64Prec-    INLINE_INST_FUN(showbPrec)--instance Show Integer where-    showbPrec = showbIntegerPrec-    INLINE_INST_FUN(showbPrec)--instance Show Word where-    showb = showbWord-    INLINE_INST_FUN(showb)--instance Show Word8 where-    showb = showbWord8-    INLINE_INST_FUN(showb)--instance Show Word16 where-    showb = showbWord16-    INLINE_INST_FUN(showb)--instance Show Word32 where-    showb = showbWord32-    INLINE_INST_FUN(showb)--instance Show Word64 where-    showb = showbWord64-    INLINE_INST_FUN(showb)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE MagicHash         #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Integral
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for integral types.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Integral (
+      showbIntPrec
+    , showbInt8Prec
+    , showbInt16Prec
+    , showbInt32Prec
+    , showbInt64Prec
+    , showbIntegerPrec
+    , showbIntegralPrec
+    , showbIntAtBase
+    , showbBin
+    , showbHex
+    , showbOct
+    , showbWord
+    , showbWord8
+    , showbWord16
+    , showbWord32
+    , showbWord64
+    ) where
+
+import           Data.Char (intToDigit)
+import           Data.Int (Int8, Int16, Int32, Int64)
+#if !(MIN_VERSION_base(4,8,0))
+import           Data.Monoid (mempty)
+#endif
+import           Data.Text.Lazy.Builder (Builder)
+import           Data.Text.Lazy.Builder.Int (decimal)
+import           Data.Word ( Word8
+                           , Word16
+                           , Word32
+                           , Word64
+#if !(MIN_VERSION_base(4,8,0))
+                           , Word
+#endif
+                           )
+
+import           GHC.Exts (Int(I#))
+#if __GLASGOW_HASKELL__ >= 708
+import           GHC.Exts (isTrue#)
+import           GHC.Prim (Int#)
+#endif
+import           GHC.Prim ((<#), (>#))
+
+import           Prelude hiding (Show)
+
+import           Text.Show.Text.Classes (Show(showb, showbPrec))
+import           Text.Show.Text.Utils ((<>), s, toString)
+
+#include "inline.h"
+
+-- | Convert an 'Int' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbIntPrec :: Int -> Int -> Builder
+showbIntPrec (I# p) n'@(I# n)
+    | isTrue (n <# 0#) && isTrue (p ># 6#) = s '(' <> decimal n' <> s ')'
+    | otherwise = decimal n'
+  where
+#if __GLASGOW_HASKELL__ >= 708
+      isTrue :: Int# -> Bool
+      isTrue b = isTrue# b
+#else
+      isTrue :: Bool -> Bool
+      isTrue = id
+#endif
+
+-- | Convert an 'Int8' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbInt8Prec :: Int -> Int8 -> Builder
+showbInt8Prec p = showbIntPrec p . fromIntegral
+{-# INLINE showbInt8Prec #-}
+
+-- | Convert an 'Int16' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbInt16Prec :: Int -> Int16 -> Builder
+showbInt16Prec p = showbIntPrec p . fromIntegral
+{-# INLINE showbInt16Prec #-}
+
+-- | Convert an 'Int32' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbInt32Prec :: Int -> Int32 -> Builder
+showbInt32Prec p = showbIntPrec p . fromIntegral
+{-# INLINE showbInt32Prec #-}
+
+-- | Convert an 'Int64' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbInt64Prec :: Int -> Int64 -> Builder
+#if WORD_SIZE_IN_BITS < 64
+showbInt64Prec p = showbIntegerPrec p . toInteger
+#else
+showbInt64Prec p = showbIntPrec p . fromIntegral
+#endif
+{-# INLINE showbInt64Prec #-}
+
+-- | Convert an 'Integer' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbIntegerPrec :: Int -> Integer -> Builder
+showbIntegerPrec p n
+    | p > 6 && n < 0 = s '(' <> decimal n <> s ')'
+    | otherwise      = decimal n
+{-# INLINE showbIntegerPrec #-}
+
+-- | Convert an 'Integral' type to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbIntegralPrec :: Integral a => Int -> a -> Builder
+showbIntegralPrec p = showbIntegerPrec p . toInteger
+{-# INLINE showbIntegralPrec #-}
+
+-- | Shows a /non-negative/ 'Integral' number using the base specified by the
+-- first argument, and the character representation specified by the second.
+-- 
+-- /Since: 0.3/
+showbIntAtBase :: (Integral a, Show a) => a -> (Int -> Char) -> a -> Builder
+showbIntAtBase base toChr n0
+    | base <= 1 = error . toString $ "Text.Show.Text.Int.showbIntAtBase: applied to unsupported base" <> showb base
+    | n0 < 0    = error . toString $ "Text.Show.Text.Int.showbIntAtBase: applied to negative number " <> showb n0
+    | otherwise = showbIt (quotRem n0 base) mempty
+  where
+    showbIt (n, d) b = seq c $ -- stricter than necessary
+        case n of
+             0 -> b'
+             _ -> showbIt (quotRem n base) b'
+      where
+        c :: Char
+        c = toChr $ fromIntegral d
+        
+        b' :: Builder
+        b' = s c <> b
+
+-- | Show /non-negative/ 'Integral' numbers in base 2.
+-- 
+-- /Since: 0.3/
+showbBin :: (Integral a, Show a) => a -> Builder
+showbBin = showbIntAtBase 2 intToDigit
+{-# INLINE showbBin #-}
+
+-- | Show /non-negative/ 'Integral' numbers in base 16.
+-- 
+-- /Since: 0.3/
+showbHex :: (Integral a, Show a) => a -> Builder
+showbHex = showbIntAtBase 16 intToDigit
+{-# INLINE showbHex #-}
+
+-- | Show /non-negative/ 'Integral' numbers in base 8.
+-- 
+-- /Since: 0.3/
+showbOct :: (Integral a, Show a) => a -> Builder
+showbOct = showbIntAtBase 8 intToDigit
+{-# INLINE showbOct #-}
+
+-- | Convert a 'Word' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbWord :: Word -> Builder
+showbWord = decimal
+{-# INLINE showbWord #-}
+
+-- | Convert a 'Word8' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbWord8 :: Word8 -> Builder
+showbWord8 = decimal
+{-# INLINE showbWord8 #-}
+
+-- | Convert a 'Word16' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbWord16 :: Word16 -> Builder
+showbWord16 = decimal
+{-# INLINE showbWord16 #-}
+
+-- | Convert a 'Word32' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbWord32 :: Word32 -> Builder
+showbWord32 = decimal
+{-# INLINE showbWord32 #-}
+
+-- | Convert a 'Word64' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbWord64 :: Word64 -> Builder
+showbWord64 = decimal
+{-# INLINE showbWord64 #-}
+
+instance Show Int where
+    showbPrec = showbIntPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show Int8 where
+    showbPrec = showbInt8Prec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show Int16 where
+    showbPrec = showbInt16Prec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show Int32 where
+    showbPrec = showbInt32Prec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show Int64 where
+    showbPrec = showbInt64Prec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show Integer where
+    showbPrec = showbIntegerPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show Word where
+    showb = showbWord
+    INLINE_INST_FUN(showb)
+
+instance Show Word8 where
+    showb = showbWord8
+    INLINE_INST_FUN(showb)
+
+instance Show Word16 where
+    showb = showbWord16
+    INLINE_INST_FUN(showb)
+
+instance Show Word32 where
+    showb = showbWord32
+    INLINE_INST_FUN(showb)
+
+instance Show Word64 where
+    showb = showbWord64
+    INLINE_INST_FUN(showb)
src/Text/Show/Text/Data/List.hs view
@@ -1,33 +1,33 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.List-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Exports 'showbListWith'.--}-module Text.Show.Text.Data.List (showbListWith) where--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec, showbList),-                               Show1(showbPrec1), showbListWith)-import Text.Show.Text.Data.Char ()-import Text.Show.Text.Data.Integral ()--#include "inline.h"--instance Show a => Show [a] where-    {-# SPECIALIZE instance Show [String] #-}-    {-# SPECIALIZE instance Show [Char]   #-}-    {-# SPECIALIZE instance Show [Int]    #-}-    showb = showbList-    INLINE_INST_FUN(showb)--instance Show1 [] where-    showbPrec1 = showbPrec+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.List
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Exports 'showbListWith'.
+-}
+module Text.Show.Text.Data.List (showbListWith) where
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec, showbList),
+                               Show1(showbPrec1), showbListWith)
+import Text.Show.Text.Data.Char ()
+import Text.Show.Text.Data.Integral ()
+
+#include "inline.h"
+
+instance Show a => Show [a] where
+    {-# SPECIALIZE instance Show [String] #-}
+    {-# SPECIALIZE instance Show [Char]   #-}
+    {-# SPECIALIZE instance Show [Int]    #-}
+    showb = showbList
+    INLINE_INST_FUN(showb)
+
+instance Show1 [] where
+    showbPrec1 = showbPrec
     INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Data/Maybe.hs view
@@ -1,38 +1,38 @@-{-# LANGUAGE CPP             #-}-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Maybe-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Maybe' values.--/Since: 0.3/--}-module Text.Show.Text.Data.Maybe (showbMaybePrec) where--import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1))-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)--#include "inline.h"---- | Convert a 'Maybe' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbMaybePrec :: Show a => Int -> Maybe a -> Builder-showbMaybePrec = showbPrec-{-# INLINE showbMaybePrec #-}--$(deriveShowPragmas defaultInlineShowbPrec ''Maybe)--instance Show1 Maybe where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Maybe
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Maybe' values.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Maybe (showbMaybePrec) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1))
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)
+
+#include "inline.h"
+
+-- | Convert a 'Maybe' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbMaybePrec :: Show a => Int -> Maybe a -> Builder
+showbMaybePrec = showbPrec
+{-# INLINE showbMaybePrec #-}
+
+$(deriveShowPragmas defaultInlineShowbPrec ''Maybe)
+
+instance Show1 Maybe where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Data/Monoid.hs view
@@ -1,140 +1,140 @@-{-# LANGUAGE CPP              #-}-{-# LANGUAGE TemplateHaskell  #-}-#if MIN_VERSION_base(4,8,0)-{-# LANGUAGE FlexibleContexts #-}-#endif-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Monoid-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for 'Monoid'-related newtypes.--/Since: 0.3/--}-module Text.Show.Text.Data.Monoid (-      showbAllPrec-    , showbAnyPrec-    , showbDualPrec-    , showbFirstPrec-    , showbLastPrec-    , showbProductPrec-    , showbSumPrec-#if MIN_VERSION_base(4,8,0)-    , showbAltPrec-#endif-    ) where--import Data.Monoid (All, Any, Dual, First, Last, Product, Sum)-import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1))-import Text.Show.Text.Data.Bool ()-import Text.Show.Text.Data.Maybe ()-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)--#if MIN_VERSION_base(4,8,0)-import Data.Monoid (Alt)--import Text.Show.Text.TH.Internal (mkShowbPrec)-#endif--#include "inline.h"---- | Convert an 'All' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbAllPrec :: Int -> All -> Builder-showbAllPrec = showbPrec-{-# INLINE showbAllPrec #-}---- | Convert an 'Any' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbAnyPrec :: Int -> Any -> Builder-showbAnyPrec = showbPrec-{-# INLINE showbAnyPrec #-}---- | Convert a 'Dual' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbDualPrec :: Show a => Int -> Dual a -> Builder-showbDualPrec = showbPrec-{-# INLINE showbDualPrec #-}---- | Convert a 'First' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbFirstPrec :: Show a => Int -> First a -> Builder-showbFirstPrec = showbPrec-{-# INLINE showbFirstPrec #-}---- | Convert a 'Last' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbLastPrec :: Show a => Int -> Last a -> Builder-showbLastPrec = showbPrec-{-# INLINE showbLastPrec #-}---- | Convert a 'Product' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbProductPrec :: Show a => Int -> Product a -> Builder-showbProductPrec = showbPrec-{-# INLINE showbProductPrec #-}---- | Convert a 'Sum' value to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbSumPrec :: Show a => Int -> Sum a -> Builder-showbSumPrec = showbPrec-{-# INLINE showbSumPrec #-}--#if MIN_VERSION_base(4,8,0)--- | Convert an 'Alt' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbAltPrec :: Show (f a) => Int -> Alt f a -> Builder-showbAltPrec = showbPrec-{-# INLINE showbAltPrec #-}-#endif--$(deriveShowPragmas defaultInlineShowbPrec ''All)-$(deriveShowPragmas defaultInlineShowbPrec ''Any)-$(deriveShowPragmas defaultInlineShowbPrec ''Dual)-$(deriveShowPragmas defaultInlineShowbPrec ''First)-$(deriveShowPragmas defaultInlineShowbPrec ''Last)-$(deriveShowPragmas defaultInlineShowbPrec ''Product)-$(deriveShowPragmas defaultInlineShowbPrec ''Sum)-#if MIN_VERSION_base(4,8,0)-instance Show (f a) => Show (Alt f a) where-    showbPrec = $(mkShowbPrec ''Alt)-    {-# INLINE showbPrec #-}-#endif--instance Show1 Dual where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance Show1 First where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance Show1 Last where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance Show1 Product where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance Show1 Sum where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP              #-}
+{-# LANGUAGE TemplateHaskell  #-}
+#if MIN_VERSION_base(4,8,0)
+{-# LANGUAGE FlexibleContexts #-}
+#endif
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Monoid
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for 'Monoid'-related newtypes.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Monoid (
+      showbAllPrec
+    , showbAnyPrec
+    , showbDualPrec
+    , showbFirstPrec
+    , showbLastPrec
+    , showbProductPrec
+    , showbSumPrec
+#if MIN_VERSION_base(4,8,0)
+    , showbAltPrec
+#endif
+    ) where
+
+import Data.Monoid (All, Any, Dual, First, Last, Product, Sum)
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1))
+import Text.Show.Text.Data.Bool ()
+import Text.Show.Text.Data.Maybe ()
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)
+
+#if MIN_VERSION_base(4,8,0)
+import Data.Monoid (Alt)
+
+import Text.Show.Text.TH.Internal (mkShowbPrec)
+#endif
+
+#include "inline.h"
+
+-- | Convert an 'All' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbAllPrec :: Int -> All -> Builder
+showbAllPrec = showbPrec
+{-# INLINE showbAllPrec #-}
+
+-- | Convert an 'Any' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbAnyPrec :: Int -> Any -> Builder
+showbAnyPrec = showbPrec
+{-# INLINE showbAnyPrec #-}
+
+-- | Convert a 'Dual' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbDualPrec :: Show a => Int -> Dual a -> Builder
+showbDualPrec = showbPrec
+{-# INLINE showbDualPrec #-}
+
+-- | Convert a 'First' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbFirstPrec :: Show a => Int -> First a -> Builder
+showbFirstPrec = showbPrec
+{-# INLINE showbFirstPrec #-}
+
+-- | Convert a 'Last' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbLastPrec :: Show a => Int -> Last a -> Builder
+showbLastPrec = showbPrec
+{-# INLINE showbLastPrec #-}
+
+-- | Convert a 'Product' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbProductPrec :: Show a => Int -> Product a -> Builder
+showbProductPrec = showbPrec
+{-# INLINE showbProductPrec #-}
+
+-- | Convert a 'Sum' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbSumPrec :: Show a => Int -> Sum a -> Builder
+showbSumPrec = showbPrec
+{-# INLINE showbSumPrec #-}
+
+#if MIN_VERSION_base(4,8,0)
+-- | Convert an 'Alt' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbAltPrec :: Show (f a) => Int -> Alt f a -> Builder
+showbAltPrec = showbPrec
+{-# INLINE showbAltPrec #-}
+#endif
+
+$(deriveShowPragmas defaultInlineShowbPrec ''All)
+$(deriveShowPragmas defaultInlineShowbPrec ''Any)
+$(deriveShowPragmas defaultInlineShowbPrec ''Dual)
+$(deriveShowPragmas defaultInlineShowbPrec ''First)
+$(deriveShowPragmas defaultInlineShowbPrec ''Last)
+$(deriveShowPragmas defaultInlineShowbPrec ''Product)
+$(deriveShowPragmas defaultInlineShowbPrec ''Sum)
+#if MIN_VERSION_base(4,8,0)
+instance Show (f a) => Show (Alt f a) where
+    showbPrec = $(mkShowbPrec ''Alt)
+    {-# INLINE showbPrec #-}
+#endif
+
+instance Show1 Dual where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance Show1 First where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance Show1 Last where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance Show1 Product where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance Show1 Sum where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Data/OldTypeable.hs view
@@ -1,66 +1,66 @@-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-}-{-|-Module:      Text.Show.Text.Data.OldTypeable-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for data types in the @OldTypeable@ module.-This module is only available with @base-4.7@.--/Since: 0.5/--}-module Text.Show.Text.Data.OldTypeable (showbTyCon, showbTypeRepPrec) where--import Data.OldTypeable.Internal (TyCon(TyCon, tyConName), TypeRep(..),-                                  funTc, listTc)-import Data.Text.Lazy.Builder (Builder, fromString)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, showbSpace)-import Text.Show.Text.Data.Typeable.Utils (showbArgs, showbTuple)-import Text.Show.Text.Utils ((<>), isTupleString, s)---- | Convert a 'TyCon' to a 'Builder'.--- This function is only available with @base-4.7@.--- --- /Since: 0.5/-showbTyCon :: TyCon -> Builder-showbTyCon = fromString . tyConName-{-# INLINE showbTyCon #-}---- | Convert a 'TypeRep' to a 'Builder' with the given precedence.--- This function is only available with @base-4.7@.--- --- /Since: 0.5/-showbTypeRepPrec :: Int -> TypeRep -> Builder-showbTypeRepPrec p (TypeRep _ tycon tys) =-    case tys of-      [] -> showbTyCon tycon-      [x]   | tycon == listTc -> s '[' <> showb x <> s ']'-      [a,r] | tycon == funTc  -> showbParen (p > 8) $-                                    showbPrec 9 a-                                 <> " -> "-                                 <> showbPrec 8 r-      xs | isTupleTyCon tycon -> showbTuple xs-         | otherwise          -> showbParen (p > 9) $-                                    showbPrec p tycon-                                 <> showbSpace-                                 <> showbArgs showbSpace tys---- | Does the 'TyCon' represent a tuple type constructor?-isTupleTyCon :: TyCon -> Bool-isTupleTyCon (TyCon _ _ _ str) = isTupleString str-{-# INLINE isTupleTyCon #-}--instance Show TyCon where-    showb = showbTyCon-    {-# INLINE showb #-}--instance Show TypeRep where-    showbPrec = showbTypeRepPrec-    {-# INLINE showbPrec #-}+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-}
+{-|
+Module:      Text.Show.Text.Data.OldTypeable
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the @OldTypeable@ module.
+This module is only available with @base-4.7@.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Data.OldTypeable (showbTyCon, showbTypeRepPrec) where
+
+import Data.OldTypeable.Internal (TyCon(TyCon, tyConName), TypeRep(..),
+                                  funTc, listTc)
+import Data.Text.Lazy.Builder (Builder, fromString)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, showbSpace)
+import Text.Show.Text.Data.Typeable.Utils (showbArgs, showbTuple)
+import Text.Show.Text.Utils ((<>), isTupleString, s)
+
+-- | Convert a 'TyCon' to a 'Builder'.
+-- This function is only available with @base-4.7@.
+-- 
+-- /Since: 0.5/
+showbTyCon :: TyCon -> Builder
+showbTyCon = fromString . tyConName
+{-# INLINE showbTyCon #-}
+
+-- | Convert a 'TypeRep' to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.7@.
+-- 
+-- /Since: 0.5/
+showbTypeRepPrec :: Int -> TypeRep -> Builder
+showbTypeRepPrec p (TypeRep _ tycon tys) =
+    case tys of
+      [] -> showbTyCon tycon
+      [x]   | tycon == listTc -> s '[' <> showb x <> s ']'
+      [a,r] | tycon == funTc  -> showbParen (p > 8) $
+                                    showbPrec 9 a
+                                 <> " -> "
+                                 <> showbPrec 8 r
+      xs | isTupleTyCon tycon -> showbTuple xs
+         | otherwise          -> showbParen (p > 9) $
+                                    showbPrec p tycon
+                                 <> showbSpace
+                                 <> showbArgs showbSpace tys
+
+-- | Does the 'TyCon' represent a tuple type constructor?
+isTupleTyCon :: TyCon -> Bool
+isTupleTyCon (TyCon _ _ _ str) = isTupleString str
+{-# INLINE isTupleTyCon #-}
+
+instance Show TyCon where
+    showb = showbTyCon
+    {-# INLINE showb #-}
+
+instance Show TypeRep where
+    showbPrec = showbTypeRepPrec
+    {-# INLINE showbPrec #-}
src/Text/Show/Text/Data/Ord.hs view
@@ -1,62 +1,62 @@-{-# LANGUAGE CPP             #-}-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Ord-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for 'Ordering' and 'Down'.--/Since: 0.3/--}-module Text.Show.Text.Data.Ord (-      showbOrdering-#if MIN_VERSION_base(4,6,0)-    , showbDownPrec-#endif-    ) where--import Data.Text.Lazy.Builder (Builder)--import Text.Show.Text.Classes (showb)-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb)--#if MIN_VERSION_base(4,6,0)-import Data.Ord (Down)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1))-import Text.Show.Text.TH.Internal (defaultInlineShowbPrec)-#endif--#include "inline.h"---- | Convert a 'Ordering' to a 'Builder'.--- --- /Since: 0.3/-showbOrdering :: Ordering -> Builder-showbOrdering = showb-{-# INLINE showbOrdering #-}--$(deriveShowPragmas defaultInlineShowb ''Ordering)--#if MIN_VERSION_base(4,6,0)--- | Convert a 'Down' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.6.0.0@ or later.--- --- /Since: 0.3/-showbDownPrec :: Show a => Int -> Down a -> Builder-showbDownPrec = showbPrec-{-# INLINE showbDownPrec #-}--$(deriveShowPragmas defaultInlineShowbPrec ''Down)--instance Show1 Down where-    showbPrec1 = showbPrec-    {-# INLINE showbPrec1 #-}-#endif+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Ord
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for 'Ordering' and 'Down'.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Ord (
+      showbOrdering
+#if MIN_VERSION_base(4,6,0)
+    , showbDownPrec
+#endif
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Text.Show.Text.Classes (showb)
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb)
+
+#if MIN_VERSION_base(4,6,0)
+import Data.Ord (Down)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec), Show1(showbPrec1))
+import Text.Show.Text.TH.Internal (defaultInlineShowbPrec)
+#endif
+
+#include "inline.h"
+
+-- | Convert a 'Ordering' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbOrdering :: Ordering -> Builder
+showbOrdering = showb
+{-# INLINE showbOrdering #-}
+
+$(deriveShowPragmas defaultInlineShowb ''Ordering)
+
+#if MIN_VERSION_base(4,6,0)
+-- | Convert a 'Down' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.6.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbDownPrec :: Show a => Int -> Down a -> Builder
+showbDownPrec = showbPrec
+{-# INLINE showbDownPrec #-}
+
+$(deriveShowPragmas defaultInlineShowbPrec ''Down)
+
+instance Show1 Down where
+    showbPrec1 = showbPrec
+    {-# INLINE showbPrec1 #-}
+#endif
src/Text/Show/Text/Data/Proxy.hs view
@@ -1,43 +1,43 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell   #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Proxy-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Proxy' values.--/Since: 0.4/--}-module Text.Show.Text.Data.Proxy (showbProxy) where--import Data.Proxy (Proxy(..))-import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))-import Text.Show.Text.TH.Internal (mkShowbPrec)--#include "inline.h"---- | Convert a 'Proxy' type to a 'Builder'.--- --- /Since: 0.4/-showbProxy :: Proxy s -> Builder-showbProxy = showb-{-# INLINE showbProxy #-}---- TODO: Derive with TH once it can detect phantom types properly-instance Show (Proxy s) where-    showbPrec = $(mkShowbPrec ''Proxy)-    INLINE_INST_FUN(showb)--instance Show1 Proxy where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell   #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Proxy
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Proxy' values.
+
+/Since: 0.4/
+-}
+module Text.Show.Text.Data.Proxy (showbProxy) where
+
+import Data.Proxy (Proxy(..))
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))
+import Text.Show.Text.TH.Internal (mkShowbPrec)
+
+#include "inline.h"
+
+-- | Convert a 'Proxy' type to a 'Builder'.
+-- 
+-- /Since: 0.4/
+showbProxy :: Proxy s -> Builder
+showbProxy = showb
+{-# INLINE showbProxy #-}
+
+-- TODO: Derive with TH once it can detect phantom types properly
+instance Show (Proxy s) where
+    showbPrec = $(mkShowbPrec ''Proxy)
+    INLINE_INST_FUN(showb)
+
+instance Show1 Proxy where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Data/Ratio.hs view
@@ -1,44 +1,44 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Ratio-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Ratio' values.--/Since: 0.5/--}-module Text.Show.Text.Data.Ratio (showbRatioPrec) where--import Data.Text.Lazy.Builder (Builder)-import Data.Ratio (Ratio, numerator, denominator)--import GHC.Real (ratioPrec, ratioPrec1)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec), showbParen)-import Text.Show.Text.Data.Integral ()-import Text.Show.Text.Utils ((<>))--#include "inline.h"---- | Convert a 'Ratio' to a 'Builder' with the given precedence.--- --- /Since: 0.5/-showbRatioPrec :: (Show a, Integral a) => Int -> Ratio a -> Builder-showbRatioPrec p q = showbParen (p > ratioPrec) $-       showbPrec ratioPrec1 (numerator q)-    <> " % "-    <> showbPrec ratioPrec1 (denominator q)-{-# INLINE showbRatioPrec #-}--instance (Show a, Integral a) => Show (Ratio a) where-    {-# SPECIALIZE instance Show Rational #-}-    showbPrec = showbRatioPrec-    INLINE_INST_FUN(showbPrec)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Ratio
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Ratio' values.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Data.Ratio (showbRatioPrec) where
+
+import Data.Text.Lazy.Builder (Builder)
+import Data.Ratio (Ratio, numerator, denominator)
+
+import GHC.Real (ratioPrec, ratioPrec1)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec), showbParen)
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.Utils ((<>))
+
+#include "inline.h"
+
+-- | Convert a 'Ratio' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.5/
+showbRatioPrec :: (Show a, Integral a) => Int -> Ratio a -> Builder
+showbRatioPrec p q = showbParen (p > ratioPrec) $
+       showbPrec ratioPrec1 (numerator q)
+    <> " % "
+    <> showbPrec ratioPrec1 (denominator q)
+{-# INLINE showbRatioPrec #-}
+
+instance (Show a, Integral a) => Show (Ratio a) where
+    {-# SPECIALIZE instance Show Rational #-}
+    showbPrec = showbRatioPrec
+    INLINE_INST_FUN(showbPrec)
src/Text/Show/Text/Data/Text.hs view
@@ -1,68 +1,68 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Text-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for 'Text' types.--/Since: 0.3/--}-module Text.Show.Text.Data.Text (-      showbText-    , showbTextLazy-    , showbBuilder-    ) where--import Data.Text      as TS-import Data.Text.Lazy as TL-import Data.Text.Lazy.Builder (Builder, toLazyText)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb))-import Text.Show.Text.Data.Char (showbString)--#include "inline.h"---- | Convert a strict 'TS.Text' into a 'Builder'.--- 'showbText' should not be confused with @fromText@, as 'showbText' escapes--- certain characters (such as double quotes).--- --- /Since: 0.5/-showbText :: TS.Text -> Builder-showbText = showbString . TS.unpack-{-# INLINE showbText #-}---- | Convert a lazy 'TL.Text' into a 'Builder'.--- 'showbTextLazy' should not be confused with @fromTextLazy@, as 'showbTextLazy'--- escapes certain characters (such as double quotes).--- --- /Since: 0.3/-showbTextLazy :: TL.Text -> Builder-showbTextLazy = showbString . TL.unpack-{-# INLINE showbTextLazy #-}---- | Show a 'Builder' as if it were a 'String' (i.e., escape certain characters,--- such as double quotes).--- --- /Since: 0.5/-showbBuilder :: Builder -> Builder-showbBuilder = showbTextLazy . toLazyText-{-# INLINE showbBuilder #-}--instance Show TS.Text where-    showb = showbText-    INLINE_INST_FUN(showb)--instance Show TL.Text where-    showb = showbTextLazy-    INLINE_INST_FUN(showb)--instance Show Builder where-    showb = showbBuilder+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Text
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for 'Text' types.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Text (
+      showbText
+    , showbTextLazy
+    , showbBuilder
+    ) where
+
+import Data.Text      as TS
+import Data.Text.Lazy as TL
+import Data.Text.Lazy.Builder (Builder, toLazyText)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb))
+import Text.Show.Text.Data.Char (showbString)
+
+#include "inline.h"
+
+-- | Convert a strict 'TS.Text' into a 'Builder'.
+-- 'showbText' should not be confused with @fromText@, as 'showbText' escapes
+-- certain characters (such as double quotes).
+-- 
+-- /Since: 0.5/
+showbText :: TS.Text -> Builder
+showbText = showbString . TS.unpack
+{-# INLINE showbText #-}
+
+-- | Convert a lazy 'TL.Text' into a 'Builder'.
+-- 'showbTextLazy' should not be confused with @fromTextLazy@, as 'showbTextLazy'
+-- escapes certain characters (such as double quotes).
+-- 
+-- /Since: 0.3/
+showbTextLazy :: TL.Text -> Builder
+showbTextLazy = showbString . TL.unpack
+{-# INLINE showbTextLazy #-}
+
+-- | Show a 'Builder' as if it were a 'String' (i.e., escape certain characters,
+-- such as double quotes).
+-- 
+-- /Since: 0.5/
+showbBuilder :: Builder -> Builder
+showbBuilder = showbTextLazy . toLazyText
+{-# INLINE showbBuilder #-}
+
+instance Show TS.Text where
+    showb = showbText
+    INLINE_INST_FUN(showb)
+
+instance Show TL.Text where
+    showb = showbTextLazy
+    INLINE_INST_FUN(showb)
+
+instance Show Builder where
+    showb = showbBuilder
     INLINE_INST_FUN(showb)
src/Text/Show/Text/Data/Tuple.hs view
@@ -1,240 +1,240 @@-{-# LANGUAGE CPP             #-}-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Tuple-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for tuple types.--/Since: 0.3/--}-module Text.Show.Text.Data.Tuple (-      showbUnit-    , showb2Tuple-    , showb3Tuple-    , showb4Tuple-    , showb5Tuple-    , showb6Tuple-    , showb7Tuple-    , showb8Tuple-    , showb9Tuple-    , showb10Tuple-    , showb11Tuple-    , showb12Tuple-    , showb13Tuple-    , showb14Tuple-    , showb15Tuple-    ) where--import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))-import Text.Show.Text.TH.Internal (deriveShow)--#include "inline.h"---- | Converts @()@ into a 'Builder'.--- --- /Since: 0.3/-showbUnit :: () -> Builder--- showbUnit () = "()"-showbUnit = showb-{-# INLINE showbUnit #-}---- | Converts a 2-tuple into a 'Builder'.--- --- /Since: 0.3/-showb2Tuple :: (Show a, Show b) => (a, b) -> Builder-showb2Tuple = showb-{-# INLINE showb2Tuple #-}---- | Converts a 3-tuple into a 'Builder'.--- --- /Since: 0.3/-showb3Tuple :: (Show a, Show b, Show c) => (a, b, c) -> Builder-showb3Tuple = showb-{-# INLINE showb3Tuple #-}---- | Converts a 4-tuple into a 'Builder'.--- --- /Since: 0.3/-showb4Tuple :: (Show a, Show b, Show c, Show d) => (a, b, c, d) -> Builder-showb4Tuple = showb-{-# INLINE showb4Tuple #-}---- | Converts a 5-tuple into a 'Builder'.--- --- /Since: 0.3/-showb5Tuple :: (Show a, Show b, Show c, Show d, Show e) => (a, b, c, d, e) -> Builder-showb5Tuple = showb-{-# INLINE showb5Tuple #-}---- | Converts a 6-tuple into a 'Builder'.--- --- /Since: 0.3/-showb6Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f) => (a, b, c, d, e, f) -> Builder-showb6Tuple = showb-{-# INLINE showb6Tuple #-}---- | Converts a 7-tuple into a 'Builder'.--- --- /Since: 0.3/-showb7Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g)-            => (a, b, c, d, e, f, g) -> Builder-showb7Tuple = showb-{-# INLINE showb7Tuple #-}---- | Converts an 8-tuple into a 'Builder'.--- --- /Since: 0.3/-showb8Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h)-            => (a, b, c, d, e, f, g, h) -> Builder-showb8Tuple = showb-{-# INLINE showb8Tuple #-}---- | Converts a 9-tuple into a 'Builder'.--- --- /Since: 0.3/-showb9Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i)-            => (a, b, c, d, e, f, g, h, i) -> Builder-showb9Tuple = showb-{-# INLINE showb9Tuple #-}---- | Converts a 10-tuple into a 'Builder'.--- --- /Since: 0.3/-showb10Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j)-             => (a, b, c, d, e, f, g, h, i, j) -> Builder-showb10Tuple = showb-{-# INLINE showb10Tuple #-}---- | Converts an 11-tuple into a 'Builder'.--- --- /Since: 0.3/-showb11Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f,-                 Show g, Show h, Show i, Show j, Show k)-             => (a, b, c, d, e, f, g, h, i, j, k) -> Builder-showb11Tuple = showb-{-# INLINE showb11Tuple #-}---- | Converts a 12-tuple into a 'Builder'.--- --- /Since: 0.3/-showb12Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f,-                 Show g, Show h, Show i, Show j, Show k, Show l)-             => (a, b, c, d, e, f, g, h, i, j, k, l) -> Builder-showb12Tuple = showb-{-# INLINE showb12Tuple #-}---- | Converts a 13-tuple into a 'Builder'.--- --- /Since: 0.3/-showb13Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g,-                 Show h, Show i, Show j, Show k, Show l, Show m)-             => (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Builder-showb13Tuple = showb-{-# INLINE showb13Tuple #-}---- | Converts a 14-tuple into a 'Builder'.--- --- /Since: 0.3/-showb14Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g,-                 Show h, Show i, Show j, Show k, Show l, Show m, Show n)-             => (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Builder-showb14Tuple = showb-{-# INLINE showb14Tuple #-}---- | Converts a 15-tuple into a 'Builder'.--- --- /Since: 0.3/-showb15Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h,-                 Show i, Show j, Show k, Show l, Show m, Show n, Show o)-             => (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Builder-showb15Tuple = showb-{-# INLINE showb15Tuple #-}--$(deriveShow ''())-$(deriveShow ''(,))-$(deriveShow ''(,,))-$(deriveShow ''(,,,))-$(deriveShow ''(,,,,))-$(deriveShow ''(,,,,,))-$(deriveShow ''(,,,,,,))-$(deriveShow ''(,,,,,,,))-$(deriveShow ''(,,,,,,,,))-$(deriveShow ''(,,,,,,,,,))-$(deriveShow ''(,,,,,,,,,,))-$(deriveShow ''(,,,,,,,,,,,))-$(deriveShow ''(,,,,,,,,,,,,))-$(deriveShow ''(,,,,,,,,,,,,,))-$(deriveShow ''(,,,,,,,,,,,,,,))--instance Show a => Show1 ((,) a) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b) => Show1 ((,,) a b) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c) => Show1 ((,,,) a b c) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d) => Show1 ((,,,,) a b c d) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d, Show e) => Show1 ((,,,,,) a b c d e) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d, Show e, Show f) => Show1 ((,,,,,,) a b c d e f) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show1 ((,,,,,,,) a b c d e f g) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) =>-  Show1 ((,,,,,,,,) a b c d e f g h) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) =>-  Show1 ((,,,,,,,,,) a b c d e f g h i) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) =>-  Show1 ((,,,,,,,,,,) a b c d e f g h i j) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) =>-  Show1 ((,,,,,,,,,,,) a b c d e f g h i j k) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) =>-  Show1 ((,,,,,,,,,,,,) a b c d e f g h i j k l) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) =>-  Show1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) =>-  Show1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Tuple
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for tuple types.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Tuple (
+      showbUnit
+    , showb2Tuple
+    , showb3Tuple
+    , showb4Tuple
+    , showb5Tuple
+    , showb6Tuple
+    , showb7Tuple
+    , showb8Tuple
+    , showb9Tuple
+    , showb10Tuple
+    , showb11Tuple
+    , showb12Tuple
+    , showb13Tuple
+    , showb14Tuple
+    , showb15Tuple
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))
+import Text.Show.Text.TH.Internal (deriveShow)
+
+#include "inline.h"
+
+-- | Converts @()@ into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbUnit :: () -> Builder
+-- showbUnit () = "()"
+showbUnit = showb
+{-# INLINE showbUnit #-}
+
+-- | Converts a 2-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb2Tuple :: (Show a, Show b) => (a, b) -> Builder
+showb2Tuple = showb
+{-# INLINE showb2Tuple #-}
+
+-- | Converts a 3-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb3Tuple :: (Show a, Show b, Show c) => (a, b, c) -> Builder
+showb3Tuple = showb
+{-# INLINE showb3Tuple #-}
+
+-- | Converts a 4-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb4Tuple :: (Show a, Show b, Show c, Show d) => (a, b, c, d) -> Builder
+showb4Tuple = showb
+{-# INLINE showb4Tuple #-}
+
+-- | Converts a 5-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb5Tuple :: (Show a, Show b, Show c, Show d, Show e) => (a, b, c, d, e) -> Builder
+showb5Tuple = showb
+{-# INLINE showb5Tuple #-}
+
+-- | Converts a 6-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb6Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f) => (a, b, c, d, e, f) -> Builder
+showb6Tuple = showb
+{-# INLINE showb6Tuple #-}
+
+-- | Converts a 7-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb7Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g)
+            => (a, b, c, d, e, f, g) -> Builder
+showb7Tuple = showb
+{-# INLINE showb7Tuple #-}
+
+-- | Converts an 8-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb8Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h)
+            => (a, b, c, d, e, f, g, h) -> Builder
+showb8Tuple = showb
+{-# INLINE showb8Tuple #-}
+
+-- | Converts a 9-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb9Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i)
+            => (a, b, c, d, e, f, g, h, i) -> Builder
+showb9Tuple = showb
+{-# INLINE showb9Tuple #-}
+
+-- | Converts a 10-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb10Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j)
+             => (a, b, c, d, e, f, g, h, i, j) -> Builder
+showb10Tuple = showb
+{-# INLINE showb10Tuple #-}
+
+-- | Converts an 11-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb11Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f,
+                 Show g, Show h, Show i, Show j, Show k)
+             => (a, b, c, d, e, f, g, h, i, j, k) -> Builder
+showb11Tuple = showb
+{-# INLINE showb11Tuple #-}
+
+-- | Converts a 12-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb12Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f,
+                 Show g, Show h, Show i, Show j, Show k, Show l)
+             => (a, b, c, d, e, f, g, h, i, j, k, l) -> Builder
+showb12Tuple = showb
+{-# INLINE showb12Tuple #-}
+
+-- | Converts a 13-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb13Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g,
+                 Show h, Show i, Show j, Show k, Show l, Show m)
+             => (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Builder
+showb13Tuple = showb
+{-# INLINE showb13Tuple #-}
+
+-- | Converts a 14-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb14Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g,
+                 Show h, Show i, Show j, Show k, Show l, Show m, Show n)
+             => (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Builder
+showb14Tuple = showb
+{-# INLINE showb14Tuple #-}
+
+-- | Converts a 15-tuple into a 'Builder'.
+-- 
+-- /Since: 0.3/
+showb15Tuple :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h,
+                 Show i, Show j, Show k, Show l, Show m, Show n, Show o)
+             => (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Builder
+showb15Tuple = showb
+{-# INLINE showb15Tuple #-}
+
+$(deriveShow ''())
+$(deriveShow ''(,))
+$(deriveShow ''(,,))
+$(deriveShow ''(,,,))
+$(deriveShow ''(,,,,))
+$(deriveShow ''(,,,,,))
+$(deriveShow ''(,,,,,,))
+$(deriveShow ''(,,,,,,,))
+$(deriveShow ''(,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,,,,,,))
+
+instance Show a => Show1 ((,) a) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b) => Show1 ((,,) a b) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c) => Show1 ((,,,) a b c) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d) => Show1 ((,,,,) a b c d) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d, Show e) => Show1 ((,,,,,) a b c d e) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d, Show e, Show f) => Show1 ((,,,,,,) a b c d e f) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show1 ((,,,,,,,) a b c d e f g) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) =>
+  Show1 ((,,,,,,,,) a b c d e f g h) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) =>
+  Show1 ((,,,,,,,,,) a b c d e f g h i) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) =>
+  Show1 ((,,,,,,,,,,) a b c d e f g h i j) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) =>
+  Show1 ((,,,,,,,,,,,) a b c d e f g h i j k) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) =>
+  Show1 ((,,,,,,,,,,,,) a b c d e f g h i j k l) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) =>
+  Show1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) =>
+  Show1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Data/Type/Coercion.hs view
@@ -1,42 +1,42 @@-{-# LANGUAGE GADTs           #-}-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Type.Coercion-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for representational equality.-This module is only available with @base-4.7.0.0@ or later.--/Since: 0.3/--}-module Text.Show.Text.Data.Type.Coercion (showbCoercion) where--import Data.Text.Lazy.Builder (Builder)-import Data.Type.Coercion (Coercion(..))--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))-import Text.Show.Text.TH.Internal (mkShowbPrec)---- | Convert a representational equality value to a 'Builder'.--- This function is only available with @base-4.7.0.0@ or later.--- --- /Since: 0.3/-showbCoercion :: Coercion a b -> Builder-showbCoercion = showb-{-# INLINE showbCoercion #-}---- TODO: Derive with TH once it can detect phantom types properly-instance Show (Coercion a b) where-    showbPrec = $(mkShowbPrec ''Coercion)-    {-# INLINE showb #-}--instance Show1 (Coercion a) where-    showbPrec1 = showbPrec-    {-# INLINE showbPrec1 #-}+{-# LANGUAGE GADTs           #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Type.Coercion
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for representational equality.
+This module is only available with @base-4.7.0.0@ or later.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Type.Coercion (showbCoercion) where
+
+import Data.Text.Lazy.Builder (Builder)
+import Data.Type.Coercion (Coercion(..))
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))
+import Text.Show.Text.TH.Internal (mkShowbPrec)
+
+-- | Convert a representational equality value to a 'Builder'.
+-- This function is only available with @base-4.7.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbCoercion :: Coercion a b -> Builder
+showbCoercion = showb
+{-# INLINE showbCoercion #-}
+
+-- TODO: Derive with TH once it can detect phantom types properly
+instance Show (Coercion a b) where
+    showbPrec = $(mkShowbPrec ''Coercion)
+    {-# INLINE showb #-}
+
+instance Show1 (Coercion a) where
+    showbPrec1 = showbPrec
+    {-# INLINE showbPrec1 #-}
src/Text/Show/Text/Data/Type/Equality.hs view
@@ -1,43 +1,43 @@-{-# LANGUAGE GADTs           #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE TypeOperators   #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Type.Equality-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for propositional equality.-This module is only available with @base-4.7.0.0@ or later.--/Since: 0.3/--}-module Text.Show.Text.Data.Type.Equality (showbPropEquality) where--import Data.Text.Lazy.Builder (Builder)-import Data.Type.Equality ((:~:)(..))--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))-import Text.Show.Text.TH.Internal (mkShowbPrec)---- | Convert a propositional equality value to a 'Builder'.--- This function is only available with @base-4.7.0.0@ or later.--- --- /Since: 0.3/-showbPropEquality :: (a :~: b) -> Builder-showbPropEquality = showb-{-# INLINE showbPropEquality #-}---- TODO: Derive with TH once it can detect phantom types properly-instance Show (a :~: b) where-    showbPrec = $(mkShowbPrec ''(:~:))-    {-# INLINE showb #-}--instance Show1 ((:~:) a) where-    showbPrec1 = showbPrec-    {-# INLINE showbPrec1 #-}+{-# LANGUAGE GADTs           #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeOperators   #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Type.Equality
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for propositional equality.
+This module is only available with @base-4.7.0.0@ or later.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Type.Equality (showbPropEquality) where
+
+import Data.Text.Lazy.Builder (Builder)
+import Data.Type.Equality ((:~:)(..))
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))
+import Text.Show.Text.TH.Internal (mkShowbPrec)
+
+-- | Convert a propositional equality value to a 'Builder'.
+-- This function is only available with @base-4.7.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbPropEquality :: (a :~: b) -> Builder
+showbPropEquality = showb
+{-# INLINE showbPropEquality #-}
+
+-- TODO: Derive with TH once it can detect phantom types properly
+instance Show (a :~: b) where
+    showbPrec = $(mkShowbPrec ''(:~:))
+    {-# INLINE showb #-}
+
+instance Show1 ((:~:) a) where
+    showbPrec1 = showbPrec
+    {-# INLINE showbPrec1 #-}
src/Text/Show/Text/Data/Typeable.hs view
@@ -1,104 +1,104 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Typeable-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for data types in the @Typeable@ module.--/Since: 0.3/--}-module Text.Show.Text.Data.Typeable (showbTyCon, showbTypeRepPrec) where--import Data.Text.Lazy.Builder (Builder, fromString)-import Data.Typeable (TypeRep, typeRepArgs, typeRepTyCon)-#if MIN_VERSION_base(4,4,0)-import Data.Typeable.Internal (TyCon(..), funTc, listTc)-# if MIN_VERSION_base(4,8,0)-import Data.Typeable.Internal (typeRepKinds)-# endif-#else-import Data.Typeable (TyCon, mkTyCon, tyConString, typeOf)-#endif--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, showbSpace)-import Text.Show.Text.Data.List ()-import Text.Show.Text.Data.Typeable.Utils (showbArgs, showbTuple)-import Text.Show.Text.Utils ((<>), isTupleString, s)--#include "inline.h"---- | Convert a 'TypeRep' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbTypeRepPrec :: Int -> TypeRep -> Builder-showbTypeRepPrec p tyrep =-    case tys of-      [] -> showbTyCon tycon-      [x]   | tycon == listTc -> s '[' <> showb x <> s ']'-      [a,r] | tycon == funTc  -> showbParen (p > 8) $-                                    showbPrec 9 a-                                 <> " -> "-                                 <> showbPrec 8 r-      xs | isTupleTyCon tycon -> showbTuple xs-         | otherwise          -> showbParen (p > 9) $-                                    showbPrec p tycon-                                 <> showbSpace-                                 <> showbArgs showbSpace-#if MIN_VERSION_base(4,8,0)-                                                         (kinds ++ tys)-#else-                                                         tys-#endif-  where-    tycon = typeRepTyCon tyrep-    tys   = typeRepArgs tyrep-#if MIN_VERSION_base(4,8,0)-    kinds = typeRepKinds tyrep-#endif--#if !(MIN_VERSION_base(4,4,0))--- | The list 'TyCon'.-listTc :: TyCon-listTc = typeRepTyCon $ typeOf [()]-{-# INLINE listTc #-}---- | The function (@->@) 'TyCon'.-funTc :: TyCon-funTc = mkTyCon "->"-#endif---- | Does the 'TyCon' represent a tuple type constructor?-isTupleTyCon :: TyCon -> Bool-isTupleTyCon = isTupleString . tyConString-{-# INLINE isTupleTyCon #-}---- | Convert a 'TyCon' to a 'Builder'.--- --- /Since: 0.3/-showbTyCon :: TyCon -> Builder-showbTyCon = fromString . tyConString-{-# INLINE showbTyCon #-}--#if MIN_VERSION_base(4,4,0)--- | Identical to 'tyConName'. Defined to avoid using excessive amounts of pragmas--- with base-4.3 and earlier, which use 'tyConString'.-tyConString :: TyCon -> String-tyConString = tyConName-{-# INLINE tyConString #-}-#endif--instance Show TypeRep where-    showbPrec = showbTypeRepPrec-    INLINE_INST_FUN(showbPrec)--instance Show TyCon where-    showb = showbTyCon-    INLINE_INST_FUN(showb)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Typeable
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the @Typeable@ module.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Typeable (showbTyCon, showbTypeRepPrec) where
+
+import Data.Text.Lazy.Builder (Builder, fromString)
+import Data.Typeable (TypeRep, typeRepArgs, typeRepTyCon)
+#if MIN_VERSION_base(4,4,0)
+import Data.Typeable.Internal (TyCon(..), funTc, listTc)
+# if MIN_VERSION_base(4,8,0)
+import Data.Typeable.Internal (typeRepKinds)
+# endif
+#else
+import Data.Typeable (TyCon, mkTyCon, tyConString, typeOf)
+#endif
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, showbSpace)
+import Text.Show.Text.Data.List ()
+import Text.Show.Text.Data.Typeable.Utils (showbArgs, showbTuple)
+import Text.Show.Text.Utils ((<>), isTupleString, s)
+
+#include "inline.h"
+
+-- | Convert a 'TypeRep' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbTypeRepPrec :: Int -> TypeRep -> Builder
+showbTypeRepPrec p tyrep =
+    case tys of
+      [] -> showbTyCon tycon
+      [x]   | tycon == listTc -> s '[' <> showb x <> s ']'
+      [a,r] | tycon == funTc  -> showbParen (p > 8) $
+                                    showbPrec 9 a
+                                 <> " -> "
+                                 <> showbPrec 8 r
+      xs | isTupleTyCon tycon -> showbTuple xs
+         | otherwise          -> showbParen (p > 9) $
+                                    showbPrec p tycon
+                                 <> showbSpace
+                                 <> showbArgs showbSpace
+#if MIN_VERSION_base(4,8,0)
+                                                         (kinds ++ tys)
+#else
+                                                         tys
+#endif
+  where
+    tycon = typeRepTyCon tyrep
+    tys   = typeRepArgs tyrep
+#if MIN_VERSION_base(4,8,0)
+    kinds = typeRepKinds tyrep
+#endif
+
+#if !(MIN_VERSION_base(4,4,0))
+-- | The list 'TyCon'.
+listTc :: TyCon
+listTc = typeRepTyCon $ typeOf [()]
+{-# INLINE listTc #-}
+
+-- | The function (@->@) 'TyCon'.
+funTc :: TyCon
+funTc = mkTyCon "->"
+#endif
+
+-- | Does the 'TyCon' represent a tuple type constructor?
+isTupleTyCon :: TyCon -> Bool
+isTupleTyCon = isTupleString . tyConString
+{-# INLINE isTupleTyCon #-}
+
+-- | Convert a 'TyCon' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbTyCon :: TyCon -> Builder
+showbTyCon = fromString . tyConString
+{-# INLINE showbTyCon #-}
+
+#if MIN_VERSION_base(4,4,0)
+-- | Identical to 'tyConName'. Defined to avoid using excessive amounts of pragmas
+-- with base-4.3 and earlier, which use 'tyConString'.
+tyConString :: TyCon -> String
+tyConString = tyConName
+{-# INLINE tyConString #-}
+#endif
+
+instance Show TypeRep where
+    showbPrec = showbTypeRepPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show TyCon where
+    showb = showbTyCon
+    INLINE_INST_FUN(showb)
src/Text/Show/Text/Data/Typeable/Utils.hs view
@@ -1,34 +1,34 @@-{-# LANGUAGE CPP #-}-{-|-Module:      Text.Show.Text.Data.Typeable.Utils-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Utility functions for showing data types in the @Typeable@ (or @OldTypeable@) module.--}-module Text.Show.Text.Data.Typeable.Utils (showbArgs, showbTuple) where--#if !(MIN_VERSION_base(4,8,0))-import Data.Monoid (mempty)-#endif-import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec))-import Text.Show.Text.Utils ((<>), s)---- | Helper function for showing a list of arguments, each separated by the given--- 'Builder'.-showbArgs :: Show a => Builder -> [a] -> Builder-showbArgs _   []     = mempty-showbArgs _   [a]    = showbPrec 10 a-showbArgs sep (a:as) = showbPrec 10 a <> sep <> showbArgs sep as---- | Helper function for showing a list of 'Show' instances in a tuple.-showbTuple :: Show a => [a] -> Builder-showbTuple args = s '(' <> showbArgs (s ',') args <> s ')'-{-# INLINE showbTuple #-}+{-# LANGUAGE CPP #-}
+{-|
+Module:      Text.Show.Text.Data.Typeable.Utils
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Utility functions for showing data types in the @Typeable@ (or @OldTypeable@) module.
+-}
+module Text.Show.Text.Data.Typeable.Utils (showbArgs, showbTuple) where
+
+#if !(MIN_VERSION_base(4,8,0))
+import Data.Monoid (mempty)
+#endif
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec))
+import Text.Show.Text.Utils ((<>), s)
+
+-- | Helper function for showing a list of arguments, each separated by the given
+-- 'Builder'.
+showbArgs :: Show a => Builder -> [a] -> Builder
+showbArgs _   []     = mempty
+showbArgs _   [a]    = showbPrec 10 a
+showbArgs sep (a:as) = showbPrec 10 a <> sep <> showbArgs sep as
+
+-- | Helper function for showing a list of 'Show' instances in a tuple.
+showbTuple :: Show a => [a] -> Builder
+showbTuple args = s '(' <> showbArgs (s ',') args <> s ')'
+{-# INLINE showbTuple #-}
src/Text/Show/Text/Data/Version.hs view
@@ -1,53 +1,53 @@-{-# LANGUAGE CPP             #-}-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Version-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for 'Version'.--/Since: 0.3/--}-module Text.Show.Text.Data.Version (-      showbVersionPrec-    , showbVersionConcrete-    ) where--import Data.List (intersperse)-#if !(MIN_VERSION_base(4,8,0))-import Data.Monoid (mconcat)-#endif-import Data.Text.Lazy.Builder (Builder, fromString)-import Data.Version (Version(..))--import Text.Show.Text.Classes (showb, showbPrec)-import Text.Show.Text.Data.Char ()-import Text.Show.Text.Data.Integral ()-import Text.Show.Text.Data.List ()-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)-import Text.Show.Text.Utils ((<>), s)---- | Convert a 'Version' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbVersionPrec :: Int -> Version -> Builder-showbVersionPrec = showbPrec-{-# INLINE showbVersionPrec #-}---- | Provides one possible concrete representation for 'Version'.  For--- a version with 'versionBranch' @= [1,2,3]@ and 'versionTags' --- @= [\"tag1\",\"tag2\"]@, the output will be @1.2.3-tag1-tag2@.--- --- /Since: 0.3/-showbVersionConcrete :: Version -> Builder-showbVersionConcrete (Version branch tags)-    = mconcat (intersperse (s '.') $ map showb branch) <>-        mconcat (map ((s '-' <>) . fromString) tags)-{-# INLINE showbVersionConcrete #-}--$(deriveShowPragmas defaultInlineShowbPrec ''Version)+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Version
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for 'Version'.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Version (
+      showbVersionPrec
+    , showbVersionConcrete
+    ) where
+
+import Data.List (intersperse)
+#if !(MIN_VERSION_base(4,8,0))
+import Data.Monoid (mconcat)
+#endif
+import Data.Text.Lazy.Builder (Builder, fromString)
+import Data.Version (Version(..))
+
+import Text.Show.Text.Classes (showb, showbPrec)
+import Text.Show.Text.Data.Char ()
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.Data.List ()
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)
+import Text.Show.Text.Utils ((<>), s)
+
+-- | Convert a 'Version' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbVersionPrec :: Int -> Version -> Builder
+showbVersionPrec = showbPrec
+{-# INLINE showbVersionPrec #-}
+
+-- | Provides one possible concrete representation for 'Version'.  For
+-- a version with 'versionBranch' @= [1,2,3]@ and 'versionTags' 
+-- @= [\"tag1\",\"tag2\"]@, the output will be @1.2.3-tag1-tag2@.
+-- 
+-- /Since: 0.3/
+showbVersionConcrete :: Version -> Builder
+showbVersionConcrete (Version branch tags)
+    = mconcat (intersperse (s '.') $ map showb branch) <>
+        mconcat (map ((s '-' <>) . fromString) tags)
+{-# INLINE showbVersionConcrete #-}
+
+$(deriveShowPragmas defaultInlineShowbPrec ''Version)
src/Text/Show/Text/Data/Void.hs view
@@ -1,36 +1,36 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Data.Void-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Void' values.--/Since: 0.5/--}-module Text.Show.Text.Data.Void (showbVoid) where--import Data.Text.Lazy.Builder (Builder)-import Data.Void (Void, absurd)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb))--#include "inline.h"---- | Since 'Void' values logically don't exist, attempting to convert one to a--- 'Builder' will never terminate.--- --- /Since: 0.5/-showbVoid :: Void -> Builder-showbVoid = absurd-{-# INLINE showbVoid #-}--instance Show Void where-    showb = showbVoid-    INLINE_INST_FUN(showb)+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Data.Void
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Void' values.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Data.Void (showbVoid) where
+
+import Data.Text.Lazy.Builder (Builder)
+import Data.Void (Void, absurd)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb))
+
+#include "inline.h"
+
+-- | Since 'Void' values logically don't exist, attempting to convert one to a
+-- 'Builder' will never terminate.
+-- 
+-- /Since: 0.5/
+showbVoid :: Void -> Builder
+showbVoid = absurd
+{-# INLINE showbVoid #-}
+
+instance Show Void where
+    showb = showbVoid
+    INLINE_INST_FUN(showb)
src/Text/Show/Text/Debug/Trace.hs view
@@ -1,368 +1,368 @@-{-# LANGUAGE CPP                      #-}-{-# LANGUAGE ForeignFunctionInterface #-}-{-# LANGUAGE OverloadedStrings        #-}-{-|-Module:      Text.Show.Text.Debug.Trace-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Functions for tracing and monitoring execution.--These can be useful for investigating bugs or performance problems.-They should /not/ be used in production code.--If you do not wish to require 'Show' instances for your @trace@ functions,-the "Text.Show.Text.Debug.Trace.TH" and "Text.Show.Text.Debug.Trace.Generic" modules-exist to convert the input to a debug message using Template Haskell or generics,-respectively.--/Since: 0.5/--}-module Text.Show.Text.Debug.Trace (-      -- * Tracing-      -- $tracing-      trace-    , traceLazy-    , traceId-    , traceIdLazy-    , traceShow-    , traceShowId-#if MIN_VERSION_base(4,5,0)-    , traceStack-    , traceStackLazy-#endif-    , traceIO-    , traceIOLazy-    , traceM-    , traceMLazy-    , traceShowM-    -#if MIN_VERSION_base(4,5,0)-      -- * Eventlog tracing-      -- $eventlog_tracing-    , traceEvent-    , traceEventLazy-    , traceEventIO-    , traceEventIOLazy-#endif-#if MIN_VERSION_base(4,7,0)-      -- * Execution phase markers-      -- $markers-    , traceMarker-    , traceMarkerLazy-    , traceMarkerIO-    , traceMarkerIOLazy-#endif-    ) where--import           Control.Monad (when)--import qualified Data.ByteString as BS (null, partition)-import           Data.ByteString (ByteString, useAsCString)-import           Data.ByteString.Internal (c2w)-import qualified Data.Text as TS (Text)-import           Data.Text.Encoding (encodeUtf8)-import qualified Data.Text.Lazy as TL (Text)-import           Data.Text.Lazy (toStrict)--import           Foreign.C.String (CString)--#if MIN_VERSION_base(4,5,0)-import qualified Data.ByteString.Char8 as BS (pack)-import qualified Data.Text as TS (unpack)-import qualified Data.Text.Lazy as TL (unpack)--import qualified Debug.Trace as S--import           GHC.Stack (currentCallStack, renderStack)-#endif--import           Prelude hiding (Show(show))--import           System.IO.Unsafe (unsafePerformIO)--import           Text.Show.Text.Classes (Show, show)-import           Text.Show.Text.Instances ()---- $tracing--- --- The 'trace', 'traceShow' and 'traceIO' functions print messages to an output--- stream. They are intended for \"printf debugging\", that is: tracing the flow--- of execution and printing interesting values.--- --- All these functions evaluate the message completely before printing--- it; so if the message is not fully defined, none of it will be--- printed.--- --- The usual output stream is 'System.IO.stderr'. For Windows GUI applications--- (that have no stderr) the output is directed to the Windows debug console.--- Some implementations of these functions may decorate the @Text@ that\'s--- output to indicate that you\'re tracing.---- | The 'traceIO' function outputs the trace message from the IO monad.--- This sequences the output with respect to other IO actions.--- --- /Since: 0.5/-traceIO :: TS.Text -> IO ()-traceIO = traceIOByteString . encodeUtf8---- | Like 'traceIO' but accepts a lazy 'TL.Text' argument.--- --- /Since: 0.5/-traceIOLazy :: TL.Text -> IO ()-traceIOLazy = traceIO . toStrict--traceIOByteString :: ByteString -> IO ()-traceIOByteString msg = useAsCString "%s\n" $ \cfmt -> do-    -- NB: debugBelch can't deal with null bytes, so filter them-    -- out so we don't accidentally truncate the message.  See Trac #9395-    let (nulls, msg') = BS.partition (== c2w '\0') msg-    useAsCString msg' $ \cmsg ->-      debugBelch cfmt cmsg-    when (not (BS.null nulls)) $-      useAsCString "WARNING: previous trace message had null bytes" $ \cmsg ->-        debugBelch cfmt cmsg---- don't use debugBelch() directly, because we cannot call varargs functions--- using the FFI.-foreign import ccall unsafe "HsBase.h debugBelch2"-    debugBelch :: CString -> CString -> IO ()--{-|-The 'trace' function outputs the trace message given as its first argument,-before returning the second argument as its result.--For example, this returns the value of @f x@ but first outputs the message.--> trace ("calling f with x = " <> show x) (f x)--The 'trace' function should /only/ be used for debugging, or for monitoring-execution. The function is not referentially transparent: its type indicates-that it is a pure function but it has the side effect of outputting the-trace message.--/Since: 0.5/--}-trace :: TS.Text -> a -> a-trace = traceByteString . encodeUtf8---- | Like 'trace' but accepts a lazy 'TL.Text' argument.--- --- /Since: 0.5/-traceLazy :: TL.Text -> a -> a-traceLazy = trace . toStrict--{-# NOINLINE traceByteString #-}-traceByteString :: ByteString -> a -> a-traceByteString bs expr = unsafePerformIO $ do-    traceIOByteString bs-    return expr---- | Like 'trace' but returns the message instead of a third value.--- --- /Since: 0.5/-traceId :: TS.Text -> TS.Text-traceId a = trace a a---- | Like 'traceId' but accepts a lazy 'TL.Text' argument.--- --- /Since: 0.5/-traceIdLazy :: TL.Text -> TL.Text-traceIdLazy a = traceLazy a a--{-|-Like 'trace', but uses 'show' on the argument to convert it to a 'TS.Text'.--This makes it convenient for printing the values of interesting variables or-expressions inside a function. For example here we print the value of the-variables @x@ and @z@:--> f x y =->     traceShow (x, z) $ result->   where->     z = ...->     ...--/Since: 0.5/--}-traceShow :: Show a => a -> b -> b-traceShow = trace . show---- | Like 'traceShow' but returns the shown value instead of a third value.--- --- /Since: 0.5/-traceShowId :: Show a => a -> a-traceShowId a = trace (show a) a--{-|-Like 'trace' but returning unit in an arbitrary monad. Allows for convenient-use in do-notation. Note that the application of 'trace' is not an action in the-monad, as 'traceIO' is in the 'IO' monad.--> ... = do->   x <- ...->   traceM $ "x: " <> show x->   y <- ...->   traceM $ "y: " <> show y--/Since: 0.5/--}-traceM :: Monad m => TS.Text -> m ()-traceM text = trace text $ return ()---- | Like 'traceM' but accepts a lazy 'TL.Text' argument.-traceMLazy :: Monad m => TL.Text -> m ()-traceMLazy text = traceLazy text $ return ()--{-|-Like 'traceM', but uses 'show' on the argument to convert it to a 'TS.Text'.--> ... = do->   x <- ...->   traceMShow $ x->   y <- ...->   traceMShow $ x + y--/Since: 0.5/--}-traceShowM :: (Show a, Monad m) => a -> m ()-traceShowM = traceM . show--#if MIN_VERSION_base(4,5,0)--- | Like 'trace' but additionally prints a call stack if one is--- available.--- --- In the current GHC implementation, the call stack is only--- availble if the program was compiled with @-prof@; otherwise--- 'traceStack' behaves exactly like 'trace'.  Entries in the call--- stack correspond to @SCC@ annotations, so it is a good idea to use--- @-fprof-auto@ or @-fprof-auto-calls@ to add SCC annotations automatically.--- --- /Since: 0.5/-traceStack :: TS.Text -> a -> a-traceStack = traceStackByteString . encodeUtf8---- | Like 'traceStack' but accepts a lazy 'TL.Text' argument.--- --- /Since: 0.5/-traceStackLazy :: TL.Text -> a -> a-traceStackLazy = traceStack . toStrict--traceStackByteString :: ByteString -> a -> a-traceStackByteString bs expr = unsafePerformIO $ do-    traceIOByteString bs-    stack <- currentCallStack-    when (not (null stack)) . traceIOByteString . BS.pack $ renderStack stack-    return expr---- $eventlog_tracing--- --- Eventlog tracing is a performance profiling system. These functions emit--- extra events into the eventlog. In combination with eventlog profiling--- tools these functions can be used for monitoring execution and--- investigating performance problems.--- --- Currently only GHC provides eventlog profiling, see the GHC user guide for--- details on how to use it. These function exists for other Haskell--- implementations but no events are emitted. Note that the @Text@ message is--- always evaluated, whether or not profiling is available or enabled.---- | The 'traceEvent' function behaves like 'trace' with the difference that--- the message is emitted to the eventlog, if eventlog profiling is available--- and enabled at runtime.--- --- It is suitable for use in pure code. In an IO context use 'traceEventIO'--- instead.--- --- Note that when using GHC's SMP runtime, it is possible (but rare) to get--- duplicate events emitted if two CPUs simultaneously evaluate the same thunk--- that uses 'traceEvent'.--- --- /Since: 0.5/-traceEvent :: TS.Text -> a -> a-traceEvent = S.traceEvent . TS.unpack---- | Like 'traceEvent' but accepts a lazy 'TL.Text' argument.--- --- /Since: 0.5/-traceEventLazy :: TL.Text -> a -> a-traceEventLazy = S.traceEvent . TL.unpack---- | The 'traceEventIO' function emits a message to the eventlog, if eventlog--- profiling is available and enabled at runtime.--- --- Compared to 'traceEvent', 'traceEventIO' sequences the event with respect to--- other IO actions.--- --- /Since: 0.5/-traceEventIO :: TS.Text -> IO ()-traceEventIO = S.traceEventIO . TS.unpack---- | Like 'traceEventIO' but accepts a lazy 'TL.Text' argument.--- --- /Since: 0.5/-traceEventIOLazy :: TL.Text -> IO ()-traceEventIOLazy = S.traceEventIO . TL.unpack-#endif--#if MIN_VERSION_base(4,7,0)--- $markers--- --- When looking at a profile for the execution of a program we often want to--- be able to mark certain points or phases in the execution and see that--- visually in the profile.---- For example, a program might have several distinct phases with different--- performance or resource behaviour in each phase. To properly interpret the--- profile graph we really want to see when each phase starts and ends.--- --- Markers let us do this: we can annotate the program to emit a marker at--- an appropriate point during execution and then see that in a profile.--- --- Currently this feature is only supported in GHC by the eventlog tracing--- system, but in future it may also be supported by the heap profiling or--- other profiling tools. These function exists for other Haskell--- implementations but they have no effect. Note that the @Text@ message is--- always evaluated, whether or not profiling is available or enabled.---- | The 'traceMarker' function emits a marker to the eventlog, if eventlog--- profiling is available and enabled at runtime. The 'TS.Text' is the name of--- the marker. The name is just used in the profiling tools to help you keep--- clear which marker is which.--- --- This function is suitable for use in pure code. In an IO context use--- 'traceMarkerIO' instead.--- --- Note that when using GHC's SMP runtime, it is possible (but rare) to get--- duplicate events emitted if two CPUs simultaneously evaluate the same thunk--- that uses 'traceMarker'.--- --- /Since: 0.5/-traceMarker :: TS.Text -> a -> a-traceMarker msg = S.traceMarker $ TS.unpack msg---- | Like 'traceMarker' but accepts a lazy 'TL.Text' argument.--- --- /Since: 0.5/-traceMarkerLazy :: TL.Text -> a -> a-traceMarkerLazy msg = S.traceMarker $ TL.unpack msg---- | The 'traceMarkerIO' function emits a marker to the eventlog, if eventlog--- profiling is available and enabled at runtime.--- --- Compared to 'traceMarker', 'traceMarkerIO' sequences the event with respect to--- other IO actions.--- --- /Since: 0.5/-traceMarkerIO :: TS.Text -> IO ()-traceMarkerIO = S.traceMarkerIO . TS.unpack---- | Like 'traceMarkerIO' but accepts a lazy 'TL.Text' argument.--- --- /Since: 0.5/-traceMarkerIOLazy :: TL.Text -> IO ()-traceMarkerIOLazy = S.traceMarkerIO . TL.unpack-#endif+{-# LANGUAGE CPP                      #-}
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE OverloadedStrings        #-}
+{-|
+Module:      Text.Show.Text.Debug.Trace
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Functions for tracing and monitoring execution.
+
+These can be useful for investigating bugs or performance problems.
+They should /not/ be used in production code.
+
+If you do not wish to require 'Show' instances for your @trace@ functions,
+the "Text.Show.Text.Debug.Trace.TH" and "Text.Show.Text.Debug.Trace.Generic" modules
+exist to convert the input to a debug message using Template Haskell or generics,
+respectively.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Debug.Trace (
+      -- * Tracing
+      -- $tracing
+      trace
+    , traceLazy
+    , traceId
+    , traceIdLazy
+    , traceShow
+    , traceShowId
+#if MIN_VERSION_base(4,5,0)
+    , traceStack
+    , traceStackLazy
+#endif
+    , traceIO
+    , traceIOLazy
+    , traceM
+    , traceMLazy
+    , traceShowM
+    
+#if MIN_VERSION_base(4,5,0)
+      -- * Eventlog tracing
+      -- $eventlog_tracing
+    , traceEvent
+    , traceEventLazy
+    , traceEventIO
+    , traceEventIOLazy
+#endif
+#if MIN_VERSION_base(4,7,0)
+      -- * Execution phase markers
+      -- $markers
+    , traceMarker
+    , traceMarkerLazy
+    , traceMarkerIO
+    , traceMarkerIOLazy
+#endif
+    ) where
+
+import           Control.Monad (when)
+
+import qualified Data.ByteString as BS (null, partition)
+import           Data.ByteString (ByteString, useAsCString)
+import           Data.ByteString.Internal (c2w)
+import qualified Data.Text as TS (Text)
+import           Data.Text.Encoding (encodeUtf8)
+import qualified Data.Text.Lazy as TL (Text)
+import           Data.Text.Lazy (toStrict)
+
+import           Foreign.C.String (CString)
+
+#if MIN_VERSION_base(4,5,0)
+import qualified Data.ByteString.Char8 as BS (pack)
+import qualified Data.Text as TS (unpack)
+import qualified Data.Text.Lazy as TL (unpack)
+
+import qualified Debug.Trace as S
+
+import           GHC.Stack (currentCallStack, renderStack)
+#endif
+
+import           Prelude hiding (Show(show))
+
+import           System.IO.Unsafe (unsafePerformIO)
+
+import           Text.Show.Text.Classes (Show, show)
+import           Text.Show.Text.Instances ()
+
+-- $tracing
+-- 
+-- The 'trace', 'traceShow' and 'traceIO' functions print messages to an output
+-- stream. They are intended for \"printf debugging\", that is: tracing the flow
+-- of execution and printing interesting values.
+-- 
+-- All these functions evaluate the message completely before printing
+-- it; so if the message is not fully defined, none of it will be
+-- printed.
+-- 
+-- The usual output stream is 'System.IO.stderr'. For Windows GUI applications
+-- (that have no stderr) the output is directed to the Windows debug console.
+-- Some implementations of these functions may decorate the @Text@ that\'s
+-- output to indicate that you\'re tracing.
+
+-- | The 'traceIO' function outputs the trace message from the IO monad.
+-- This sequences the output with respect to other IO actions.
+-- 
+-- /Since: 0.5/
+traceIO :: TS.Text -> IO ()
+traceIO = traceIOByteString . encodeUtf8
+
+-- | Like 'traceIO' but accepts a lazy 'TL.Text' argument.
+-- 
+-- /Since: 0.5/
+traceIOLazy :: TL.Text -> IO ()
+traceIOLazy = traceIO . toStrict
+
+traceIOByteString :: ByteString -> IO ()
+traceIOByteString msg = useAsCString "%s\n" $ \cfmt -> do
+    -- NB: debugBelch can't deal with null bytes, so filter them
+    -- out so we don't accidentally truncate the message.  See Trac #9395
+    let (nulls, msg') = BS.partition (== c2w '\0') msg
+    useAsCString msg' $ \cmsg ->
+      debugBelch cfmt cmsg
+    when (not (BS.null nulls)) $
+      useAsCString "WARNING: previous trace message had null bytes" $ \cmsg ->
+        debugBelch cfmt cmsg
+
+-- don't use debugBelch() directly, because we cannot call varargs functions
+-- using the FFI.
+foreign import ccall unsafe "HsBase.h debugBelch2"
+    debugBelch :: CString -> CString -> IO ()
+
+{-|
+The 'trace' function outputs the trace message given as its first argument,
+before returning the second argument as its result.
+
+For example, this returns the value of @f x@ but first outputs the message.
+
+> trace ("calling f with x = " <> show x) (f x)
+
+The 'trace' function should /only/ be used for debugging, or for monitoring
+execution. The function is not referentially transparent: its type indicates
+that it is a pure function but it has the side effect of outputting the
+trace message.
+
+/Since: 0.5/
+-}
+trace :: TS.Text -> a -> a
+trace = traceByteString . encodeUtf8
+
+-- | Like 'trace' but accepts a lazy 'TL.Text' argument.
+-- 
+-- /Since: 0.5/
+traceLazy :: TL.Text -> a -> a
+traceLazy = trace . toStrict
+
+{-# NOINLINE traceByteString #-}
+traceByteString :: ByteString -> a -> a
+traceByteString bs expr = unsafePerformIO $ do
+    traceIOByteString bs
+    return expr
+
+-- | Like 'trace' but returns the message instead of a third value.
+-- 
+-- /Since: 0.5/
+traceId :: TS.Text -> TS.Text
+traceId a = trace a a
+
+-- | Like 'traceId' but accepts a lazy 'TL.Text' argument.
+-- 
+-- /Since: 0.5/
+traceIdLazy :: TL.Text -> TL.Text
+traceIdLazy a = traceLazy a a
+
+{-|
+Like 'trace', but uses 'show' on the argument to convert it to a 'TS.Text'.
+
+This makes it convenient for printing the values of interesting variables or
+expressions inside a function. For example here we print the value of the
+variables @x@ and @z@:
+
+> f x y =
+>     traceShow (x, z) $ result
+>   where
+>     z = ...
+>     ...
+
+/Since: 0.5/
+-}
+traceShow :: Show a => a -> b -> b
+traceShow = trace . show
+
+-- | Like 'traceShow' but returns the shown value instead of a third value.
+-- 
+-- /Since: 0.5/
+traceShowId :: Show a => a -> a
+traceShowId a = trace (show a) a
+
+{-|
+Like 'trace' but returning unit in an arbitrary monad. Allows for convenient
+use in do-notation. Note that the application of 'trace' is not an action in the
+monad, as 'traceIO' is in the 'IO' monad.
+
+> ... = do
+>   x <- ...
+>   traceM $ "x: " <> show x
+>   y <- ...
+>   traceM $ "y: " <> show y
+
+/Since: 0.5/
+-}
+traceM :: Monad m => TS.Text -> m ()
+traceM text = trace text $ return ()
+
+-- | Like 'traceM' but accepts a lazy 'TL.Text' argument.
+traceMLazy :: Monad m => TL.Text -> m ()
+traceMLazy text = traceLazy text $ return ()
+
+{-|
+Like 'traceM', but uses 'show' on the argument to convert it to a 'TS.Text'.
+
+> ... = do
+>   x <- ...
+>   traceMShow $ x
+>   y <- ...
+>   traceMShow $ x + y
+
+/Since: 0.5/
+-}
+traceShowM :: (Show a, Monad m) => a -> m ()
+traceShowM = traceM . show
+
+#if MIN_VERSION_base(4,5,0)
+-- | Like 'trace' but additionally prints a call stack if one is
+-- available.
+-- 
+-- In the current GHC implementation, the call stack is only
+-- availble if the program was compiled with @-prof@; otherwise
+-- 'traceStack' behaves exactly like 'trace'.  Entries in the call
+-- stack correspond to @SCC@ annotations, so it is a good idea to use
+-- @-fprof-auto@ or @-fprof-auto-calls@ to add SCC annotations automatically.
+-- 
+-- /Since: 0.5/
+traceStack :: TS.Text -> a -> a
+traceStack = traceStackByteString . encodeUtf8
+
+-- | Like 'traceStack' but accepts a lazy 'TL.Text' argument.
+-- 
+-- /Since: 0.5/
+traceStackLazy :: TL.Text -> a -> a
+traceStackLazy = traceStack . toStrict
+
+traceStackByteString :: ByteString -> a -> a
+traceStackByteString bs expr = unsafePerformIO $ do
+    traceIOByteString bs
+    stack <- currentCallStack
+    when (not (null stack)) . traceIOByteString . BS.pack $ renderStack stack
+    return expr
+
+-- $eventlog_tracing
+-- 
+-- Eventlog tracing is a performance profiling system. These functions emit
+-- extra events into the eventlog. In combination with eventlog profiling
+-- tools these functions can be used for monitoring execution and
+-- investigating performance problems.
+-- 
+-- Currently only GHC provides eventlog profiling, see the GHC user guide for
+-- details on how to use it. These function exists for other Haskell
+-- implementations but no events are emitted. Note that the @Text@ message is
+-- always evaluated, whether or not profiling is available or enabled.
+
+-- | The 'traceEvent' function behaves like 'trace' with the difference that
+-- the message is emitted to the eventlog, if eventlog profiling is available
+-- and enabled at runtime.
+-- 
+-- It is suitable for use in pure code. In an IO context use 'traceEventIO'
+-- instead.
+-- 
+-- Note that when using GHC's SMP runtime, it is possible (but rare) to get
+-- duplicate events emitted if two CPUs simultaneously evaluate the same thunk
+-- that uses 'traceEvent'.
+-- 
+-- /Since: 0.5/
+traceEvent :: TS.Text -> a -> a
+traceEvent = S.traceEvent . TS.unpack
+
+-- | Like 'traceEvent' but accepts a lazy 'TL.Text' argument.
+-- 
+-- /Since: 0.5/
+traceEventLazy :: TL.Text -> a -> a
+traceEventLazy = S.traceEvent . TL.unpack
+
+-- | The 'traceEventIO' function emits a message to the eventlog, if eventlog
+-- profiling is available and enabled at runtime.
+-- 
+-- Compared to 'traceEvent', 'traceEventIO' sequences the event with respect to
+-- other IO actions.
+-- 
+-- /Since: 0.5/
+traceEventIO :: TS.Text -> IO ()
+traceEventIO = S.traceEventIO . TS.unpack
+
+-- | Like 'traceEventIO' but accepts a lazy 'TL.Text' argument.
+-- 
+-- /Since: 0.5/
+traceEventIOLazy :: TL.Text -> IO ()
+traceEventIOLazy = S.traceEventIO . TL.unpack
+#endif
+
+#if MIN_VERSION_base(4,7,0)
+-- $markers
+-- 
+-- When looking at a profile for the execution of a program we often want to
+-- be able to mark certain points or phases in the execution and see that
+-- visually in the profile.
+
+-- For example, a program might have several distinct phases with different
+-- performance or resource behaviour in each phase. To properly interpret the
+-- profile graph we really want to see when each phase starts and ends.
+-- 
+-- Markers let us do this: we can annotate the program to emit a marker at
+-- an appropriate point during execution and then see that in a profile.
+-- 
+-- Currently this feature is only supported in GHC by the eventlog tracing
+-- system, but in future it may also be supported by the heap profiling or
+-- other profiling tools. These function exists for other Haskell
+-- implementations but they have no effect. Note that the @Text@ message is
+-- always evaluated, whether or not profiling is available or enabled.
+
+-- | The 'traceMarker' function emits a marker to the eventlog, if eventlog
+-- profiling is available and enabled at runtime. The 'TS.Text' is the name of
+-- the marker. The name is just used in the profiling tools to help you keep
+-- clear which marker is which.
+-- 
+-- This function is suitable for use in pure code. In an IO context use
+-- 'traceMarkerIO' instead.
+-- 
+-- Note that when using GHC's SMP runtime, it is possible (but rare) to get
+-- duplicate events emitted if two CPUs simultaneously evaluate the same thunk
+-- that uses 'traceMarker'.
+-- 
+-- /Since: 0.5/
+traceMarker :: TS.Text -> a -> a
+traceMarker msg = S.traceMarker $ TS.unpack msg
+
+-- | Like 'traceMarker' but accepts a lazy 'TL.Text' argument.
+-- 
+-- /Since: 0.5/
+traceMarkerLazy :: TL.Text -> a -> a
+traceMarkerLazy msg = S.traceMarker $ TL.unpack msg
+
+-- | The 'traceMarkerIO' function emits a marker to the eventlog, if eventlog
+-- profiling is available and enabled at runtime.
+-- 
+-- Compared to 'traceMarker', 'traceMarkerIO' sequences the event with respect to
+-- other IO actions.
+-- 
+-- /Since: 0.5/
+traceMarkerIO :: TS.Text -> IO ()
+traceMarkerIO = S.traceMarkerIO . TS.unpack
+
+-- | Like 'traceMarkerIO' but accepts a lazy 'TL.Text' argument.
+-- 
+-- /Since: 0.5/
+traceMarkerIOLazy :: TL.Text -> IO ()
+traceMarkerIOLazy = S.traceMarkerIO . TL.unpack
+#endif
src/Text/Show/Text/Debug/Trace/Generic.hs view
@@ -1,42 +1,42 @@-{-# LANGUAGE FlexibleContexts #-}-{-|-Module:      Text.Show.Text.Debug.Trace.Generic-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Functions that trace the values of 'Generic' instances (even if they are not-instances of @Show@).--/Since: 0.6/--}-module Text.Show.Text.Debug.Trace.Generic (-      genericTraceShow-    , genericTraceShowId-    , genericTraceShowM-    ) where--import GHC.Generics (Generic, Rep)--import Text.Show.Text.Debug.Trace-import Text.Show.Text.Generic (GShow, genericShow)---- | A 'Generic' implementation of 'traceShow'.--- --- /Since: 0.6/-genericTraceShow :: (Generic a, GShow (Rep a)) => a -> b -> b-genericTraceShow = trace . genericShow---- | A 'Generic' implementation of 'traceShowId'.--- --- /Since: 0.6/-genericTraceShowId :: (Generic a, GShow (Rep a)) => a -> a-genericTraceShowId a = trace (genericShow a) a---- | A 'Generic' implementation of 'traceShowM'.--- --- /Since: 0.6/-genericTraceShowM :: (Generic a, GShow (Rep a), Monad m) => a -> m ()+{-# LANGUAGE FlexibleContexts #-}
+{-|
+Module:      Text.Show.Text.Debug.Trace.Generic
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Functions that trace the values of 'Generic' instances (even if they are not
+instances of @Show@).
+
+/Since: 0.6/
+-}
+module Text.Show.Text.Debug.Trace.Generic (
+      genericTraceShow
+    , genericTraceShowId
+    , genericTraceShowM
+    ) where
+
+import GHC.Generics (Generic, Rep)
+
+import Text.Show.Text.Debug.Trace
+import Text.Show.Text.Generic (GShow, genericShow)
+
+-- | A 'Generic' implementation of 'traceShow'.
+-- 
+-- /Since: 0.6/
+genericTraceShow :: (Generic a, GShow (Rep a)) => a -> b -> b
+genericTraceShow = trace . genericShow
+
+-- | A 'Generic' implementation of 'traceShowId'.
+-- 
+-- /Since: 0.6/
+genericTraceShowId :: (Generic a, GShow (Rep a)) => a -> a
+genericTraceShowId a = trace (genericShow a) a
+
+-- | A 'Generic' implementation of 'traceShowM'.
+-- 
+-- /Since: 0.6/
+genericTraceShowM :: (Generic a, GShow (Rep a), Monad m) => a -> m ()
 genericTraceShowM = traceM . genericShow
src/Text/Show/Text/Debug/Trace/TH.hs view
@@ -1,46 +1,46 @@-{-# LANGUAGE TemplateHaskell #-}-{-|-Module:      Text.Show.Text.Debug.Trace.TH-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Functions that splice traces into source code which take arbitrary data types or-families as arguments (even if they are not instances of @Show@). You need to-enable the @TemplateHaskell@ language extension in order to use this module.--/Since: 0.5/--}-module Text.Show.Text.Debug.Trace.TH (-      mkTraceShow-    , mkTraceShowId-    , mkTraceShowM-    ) where--import Language.Haskell.TH.Syntax (Name, Q, Exp)--import Text.Show.Text.Debug.Trace-import Text.Show.Text.TH.Internal (mkShow)---- | Generates a lambda expression which behaves like 'traceShow' (without requiring a--- @Show@ instance).--- --- /Since: 0.5/-mkTraceShow :: Name -> Q Exp-mkTraceShow name = [| trace . $(mkShow name) |]---- | Generates a lambda expression which behaves like 'traceShowId' (without requiring a--- @Show@ instance).--- --- /Since: 0.5/-mkTraceShowId :: Name -> Q Exp-mkTraceShowId name = [| \a -> trace ($(mkShow name) a) a |]---- | Generates a lambda expression which behaves like 'traceShowM' (without requiring a--- @Show@ instance).--- --- /Since: 0.5/-mkTraceShowM :: Name -> Q Exp+{-# LANGUAGE TemplateHaskell #-}
+{-|
+Module:      Text.Show.Text.Debug.Trace.TH
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Functions that splice traces into source code which take arbitrary data types or
+families as arguments (even if they are not instances of @Show@). You need to
+enable the @TemplateHaskell@ language extension in order to use this module.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Debug.Trace.TH (
+      mkTraceShow
+    , mkTraceShowId
+    , mkTraceShowM
+    ) where
+
+import Language.Haskell.TH.Syntax (Name, Q, Exp)
+
+import Text.Show.Text.Debug.Trace
+import Text.Show.Text.TH.Internal (mkShow)
+
+-- | Generates a lambda expression which behaves like 'traceShow' (without requiring a
+-- @Show@ instance).
+-- 
+-- /Since: 0.5/
+mkTraceShow :: Name -> Q Exp
+mkTraceShow name = [| trace . $(mkShow name) |]
+
+-- | Generates a lambda expression which behaves like 'traceShowId' (without requiring a
+-- @Show@ instance).
+-- 
+-- /Since: 0.5/
+mkTraceShowId :: Name -> Q Exp
+mkTraceShowId name = [| \a -> trace ($(mkShow name) a) a |]
+
+-- | Generates a lambda expression which behaves like 'traceShowM' (without requiring a
+-- @Show@ instance).
+-- 
+-- /Since: 0.5/
+mkTraceShowM :: Name -> Q Exp
 mkTraceShowM name = [| traceM . $(mkShow name) |]
src/Text/Show/Text/Foreign.hs view
@@ -1,14 +1,14 @@-{-|-Module:      Text.Show.Text.Foreign-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Imports 'Show' instances for @Foreign@ modules.--}-module Text.Show.Text.Foreign () where--import Text.Show.Text.Foreign.C.Types ()+{-|
+Module:      Text.Show.Text.Foreign
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Imports 'Show' instances for @Foreign@ modules.
+-}
+module Text.Show.Text.Foreign () where
+
+import Text.Show.Text.Foreign.C.Types ()
 import Text.Show.Text.Foreign.Ptr     ()
src/Text/Show/Text/Foreign/C/Types.hs view
@@ -1,488 +1,488 @@-{-# LANGUAGE CPP                        #-}-#if MIN_VERSION_base(4,5,0)-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-#else-{-# LANGUAGE MagicHash                  #-}-#endif-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Foreign.C.Types-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for Haskell newtypes corresponding to C-types in the Foreign Function Interface (FFI).--/Since: 0.3/--}-module Text.Show.Text.Foreign.C.Types (-      showbCCharPrec-    , showbCSCharPrec-    , showbCUChar-    , showbCShortPrec-    , showbCUShort-    , showbCIntPrec-    , showbCUInt-    , showbCLongPrec-    , showbCULong-    , showbCPtrdiffPrec-    , showbCSize-    , showbCWcharPrec-    , showbCSigAtomicPrec-    , showbCLLongPrec-    , showbCULLong-    , showbCIntPtrPrec-    , showbCUIntPtr-    , showbCIntMaxPrec-    , showbCUIntMax-    , showbCClockPrec-    , showbCTimePrec-#if MIN_VERSION_base(4,4,0)-    , showbCUSeconds-    , showbCSUSecondsPrec-#endif-    , showbCFloatPrec-    , showbCDoublePrec-    ) where--import Data.Text.Lazy.Builder (Builder)--import Foreign.C.Types--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec))-import Text.Show.Text.Data.Floating ()-import Text.Show.Text.Data.Integral ()--#if !(MIN_VERSION_base(4,5,0))-import GHC.Prim (unsafeCoerce#)--import Text.Show.Text.Data.Floating (showbDoublePrec, showbFloatPrec)-import Text.Show.Text.Data.Integral ( showbInt8Prec-                                    , showbInt16Prec-                                    , showbInt32Prec-                                    , showbInt64Prec-                                    , showbWord8-                                    , showbWord16-                                    , showbWord32-                                    , showbWord64-                                    )--# include "inline.h"-#endif---- | Convert a 'CChar' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCCharPrec :: Int -> CChar -> Builder-#if MIN_VERSION_base(4,5,0)-showbCCharPrec = showbPrec-{-# INLINE showbCCharPrec #-}-#else-showbCCharPrec p c = showbInt8Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CSChar' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCSCharPrec :: Int -> CSChar -> Builder-#if MIN_VERSION_base(4,5,0)-showbCSCharPrec = showbPrec-{-# INLINE showbCSCharPrec #-}-#else-showbCSCharPrec p c = showbInt8Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CUChar' to a 'Builder'.--- --- /Since: 0.3/-showbCUChar :: CUChar -> Builder-#if MIN_VERSION_base(4,5,0)-showbCUChar = showb-{-# INLINE showbCUChar #-}-#else-showbCUChar c = showbWord8 $ unsafeCoerce# c-#endif---- | Convert a 'CShort' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCShortPrec :: Int -> CShort -> Builder-#if MIN_VERSION_base(4,5,0)-showbCShortPrec = showbPrec-{-# INLINE showbCShortPrec #-}-#else-showbCShortPrec p c = showbInt16Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CUShort' to a 'Builder'.--- --- /Since: 0.3/-showbCUShort :: CUShort -> Builder-#if MIN_VERSION_base(4,5,0)-showbCUShort = showb-{-# INLINE showbCUShort #-}-#else-showbCUShort c = showbWord16 $ unsafeCoerce# c-#endif---- | Convert a 'CInt' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCIntPrec :: Int -> CInt -> Builder-#if MIN_VERSION_base(4,5,0)-showbCIntPrec = showbPrec-{-# INLINE showbCIntPrec #-}-#else-showbCIntPrec p c = showbInt32Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CUInt' to a 'Builder'.--- --- /Since: 0.3/-showbCUInt :: CUInt -> Builder-#if MIN_VERSION_base(4,5,0)-showbCUInt = showb-{-# INLINE showbCUInt #-}-#else-showbCUInt c = showbWord32 $ unsafeCoerce# c-#endif---- | Convert a 'CLong' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCLongPrec :: Int -> CLong -> Builder-#if MIN_VERSION_base(4,5,0)-showbCLongPrec = showbPrec-{-# INLINE showbCLongPrec #-}-#else-showbCLongPrec p c = showbInt32Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CULong' to a 'Builder'.--- --- /Since: 0.3/-showbCULong :: CULong -> Builder-#if MIN_VERSION_base(4,5,0)-showbCULong = showb-{-# INLINE showbCULong #-}-#else-showbCULong c = showbWord32 $ unsafeCoerce# c-#endif---- | Convert a 'CPtrdiff' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCPtrdiffPrec :: Int -> CPtrdiff -> Builder-#if MIN_VERSION_base(4,5,0)-showbCPtrdiffPrec = showbPrec-{-# INLINE showbCPtrdiffPrec #-}-#else-showbCPtrdiffPrec p c = showbInt32Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CSize' to a 'Builder'.--- --- /Since: 0.3/-showbCSize :: CSize -> Builder-#if MIN_VERSION_base(4,5,0)-showbCSize = showb-{-# INLINE showbCSize #-}-#else-showbCSize c = showbWord32 $ unsafeCoerce# c-#endif---- | Convert a 'CWchar' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCWcharPrec :: Int -> CWchar -> Builder-#if MIN_VERSION_base(4,5,0)-showbCWcharPrec = showbPrec-{-# INLINE showbCWcharPrec #-}-#else-showbCWcharPrec p c = showbInt32Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CSigAtomic' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCSigAtomicPrec :: Int -> CSigAtomic -> Builder-#if MIN_VERSION_base(4,5,0)-showbCSigAtomicPrec = showbPrec-{-# INLINE showbCSigAtomicPrec #-}-#else-showbCSigAtomicPrec p c = showbInt32Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CLLong' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCLLongPrec :: Int -> CLLong -> Builder-#if MIN_VERSION_base(4,5,0)-showbCLLongPrec = showbPrec-{-# INLINE showbCLLongPrec #-}-#else-showbCLLongPrec p c = showbInt64Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CULLong' to a 'Builder'.--- --- /Since: 0.3/-showbCULLong :: CULLong -> Builder-#if MIN_VERSION_base(4,5,0)-showbCULLong = showb-{-# INLINE showbCULLong #-}-#else-showbCULLong c = showbWord64 $ unsafeCoerce# c-#endif---- | Convert a 'CIntPtr' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCIntPtrPrec :: Int -> CIntPtr -> Builder-#if MIN_VERSION_base(4,5,0)-showbCIntPtrPrec = showbPrec-{-# INLINE showbCIntPtrPrec #-}-#else-showbCIntPtrPrec p c = showbInt32Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CUIntPtr' to a 'Builder'.--- --- /Since: 0.3/-showbCUIntPtr :: CUIntPtr -> Builder-#if MIN_VERSION_base(4,5,0)-showbCUIntPtr = showb-{-# INLINE showbCUIntPtr #-}-#else-showbCUIntPtr c = showbWord32 $ unsafeCoerce# c-#endif---- | Convert a 'CIntMax' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCIntMaxPrec :: Int -> CIntMax -> Builder-#if MIN_VERSION_base(4,5,0)-showbCIntMaxPrec = showbPrec-{-# INLINE showbCIntMaxPrec #-}-#else-showbCIntMaxPrec p c = showbInt64Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CUIntMax' to a 'Builder'.--- --- /Since: 0.3/-showbCUIntMax :: CUIntMax -> Builder-#if MIN_VERSION_base(4,5,0)-showbCUIntMax = showb-{-# INLINE showbCUIntMax #-}-#else-showbCUIntMax c = showbWord64 $ unsafeCoerce# c-#endif---- | Convert a 'CClock' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCClockPrec :: Int -> CClock -> Builder-#if MIN_VERSION_base(4,5,0)-showbCClockPrec = showbPrec-{-# INLINE showbCClockPrec #-}-#else-showbCClockPrec p c = showbInt32Prec p $ unsafeCoerce# c-#endif---- | Convert a 'CTime' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCTimePrec :: Int -> CTime -> Builder-#if MIN_VERSION_base(4,5,0)-showbCTimePrec = showbPrec-{-# INLINE showbCTimePrec #-}-#else-showbCTimePrec p c = showbInt32Prec p $ unsafeCoerce# c-#endif--#if MIN_VERSION_base(4,4,0)--- | Convert a 'CUSeconds' value to a 'Builder'.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbCUSeconds :: CUSeconds -> Builder-# if MIN_VERSION_base(4,5,0)-showbCUSeconds = showb-{-# INLINE showbCUSeconds #-}-# else-showbCUSeconds c = showbWord32 $ unsafeCoerce# c-# endif---- | Convert a 'CSUSeconds' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbCSUSecondsPrec :: Int -> CSUSeconds -> Builder-# if MIN_VERSION_base(4,5,0)-showbCSUSecondsPrec = showbPrec-{-# INLINE showbCSUSecondsPrec #-}-# else-showbCSUSecondsPrec p c = showbInt32Prec p $ unsafeCoerce# c-# endif-#endif---- | Convert a 'CFloat' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCFloatPrec :: Int -> CFloat -> Builder-#if MIN_VERSION_base(4,5,0)-showbCFloatPrec = showbPrec-{-# INLINE showbCFloatPrec #-}-#else-showbCFloatPrec p c = showbFloatPrec p $ unsafeCoerce# c-#endif---- | Convert a 'CDouble' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCDoublePrec :: Int -> CDouble -> Builder-#if MIN_VERSION_base(4,5,0)-showbCDoublePrec = showbPrec-{-# INLINE showbCDoublePrec #-}-#else-showbCDoublePrec p c = showbDoublePrec p $ unsafeCoerce# c-#endif--#if MIN_VERSION_base(4,5,0)-deriving instance Show CChar-deriving instance Show CSChar-deriving instance Show CUChar-deriving instance Show CShort-deriving instance Show CUShort-deriving instance Show CInt-deriving instance Show CUInt-deriving instance Show CLong-deriving instance Show CULong-deriving instance Show CPtrdiff-deriving instance Show CSize-deriving instance Show CWchar-deriving instance Show CSigAtomic-deriving instance Show CLLong-deriving instance Show CULLong-deriving instance Show CIntPtr-deriving instance Show CUIntPtr-deriving instance Show CIntMax-deriving instance Show CUIntMax-deriving instance Show CClock-deriving instance Show CTime-# if MIN_VERSION_base(4,4,0)-deriving instance Show CUSeconds-deriving instance Show CSUSeconds-# endif-deriving instance Show CFloat-deriving instance Show CDouble-#else-instance Show CChar where-    showbPrec = showbCCharPrec-    INLINE_INST_FUN(showbPrec)--instance Show CSChar where-    showbPrec = showbCSCharPrec-    INLINE_INST_FUN(showbPrec)--instance Show CUChar where-    showb = showbCUChar-    INLINE_INST_FUN(showb)--instance Show CShort where-    showbPrec = showbCShortPrec-    INLINE_INST_FUN(showbPrec)--instance Show CUShort where-    showb = showbCUShort-    INLINE_INST_FUN(showb)--instance Show CInt where-    showbPrec = showbCIntPrec-    INLINE_INST_FUN(showbPrec)--instance Show CUInt where-    showb = showbCUInt-    INLINE_INST_FUN(showb)--instance Show CLong where-    showbPrec = showbCLongPrec-    INLINE_INST_FUN(showbPrec)--instance Show CULong where-    showb = showbCULong-    INLINE_INST_FUN(showb)--instance Show CPtrdiff where-    showbPrec = showbCPtrdiffPrec-    INLINE_INST_FUN(showbPrec)--instance Show CSize where-    showb = showbCSize-    INLINE_INST_FUN(showb)--instance Show CWchar where-    showbPrec = showbCWcharPrec-    INLINE_INST_FUN(showbPrec)--instance Show CSigAtomic where-    showbPrec = showbCSigAtomicPrec-    INLINE_INST_FUN(showbPrec)--instance Show CLLong where-    showbPrec = showbCLLongPrec-    INLINE_INST_FUN(showbPrec)--instance Show CULLong where-    showb = showbCULLong-    INLINE_INST_FUN(showb)--instance Show CIntPtr where-    showbPrec = showbCIntPtrPrec-    INLINE_INST_FUN(showbPrec)--instance Show CUIntPtr where-    showb = showbCUIntPtr-    INLINE_INST_FUN(showb)--instance Show CIntMax where-    showbPrec = showbCIntMaxPrec-    INLINE_INST_FUN(showbPrec)--instance Show CUIntMax where-    showb = showbCUIntMax-    INLINE_INST_FUN(showb)--instance Show CClock where-    showbPrec = showbCClockPrec-    INLINE_INST_FUN(showbPrec)--instance Show CTime where-    showbPrec = showbCTimePrec-    INLINE_INST_FUN(showbPrec)--# if MIN_VERSION_base(4,4,0)-instance Show CUSeconds where-    showb = showbCUSeconds-    INLINE_INST_FUN(showb)--instance Show CSUSeconds where-    showbPrec = showbCSUSecondsPrec-    INLINE_INST_FUN(showbPrec)-# endif--instance Show CFloat where-    showbPrec = showbCFloatPrec-    INLINE_INST_FUN(showbPrec)--instance Show CDouble where-    showbPrec = showbCDoublePrec-    INLINE_INST_FUN(showbPrec)-#endif+{-# LANGUAGE CPP                        #-}
+#if MIN_VERSION_base(4,5,0)
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+#else
+{-# LANGUAGE MagicHash                  #-}
+#endif
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Foreign.C.Types
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for Haskell newtypes corresponding to C
+types in the Foreign Function Interface (FFI).
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Foreign.C.Types (
+      showbCCharPrec
+    , showbCSCharPrec
+    , showbCUChar
+    , showbCShortPrec
+    , showbCUShort
+    , showbCIntPrec
+    , showbCUInt
+    , showbCLongPrec
+    , showbCULong
+    , showbCPtrdiffPrec
+    , showbCSize
+    , showbCWcharPrec
+    , showbCSigAtomicPrec
+    , showbCLLongPrec
+    , showbCULLong
+    , showbCIntPtrPrec
+    , showbCUIntPtr
+    , showbCIntMaxPrec
+    , showbCUIntMax
+    , showbCClockPrec
+    , showbCTimePrec
+#if MIN_VERSION_base(4,4,0)
+    , showbCUSeconds
+    , showbCSUSecondsPrec
+#endif
+    , showbCFloatPrec
+    , showbCDoublePrec
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Foreign.C.Types
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec))
+import Text.Show.Text.Data.Floating ()
+import Text.Show.Text.Data.Integral ()
+
+#if !(MIN_VERSION_base(4,5,0))
+import GHC.Prim (unsafeCoerce#)
+
+import Text.Show.Text.Data.Floating (showbDoublePrec, showbFloatPrec)
+import Text.Show.Text.Data.Integral ( showbInt8Prec
+                                    , showbInt16Prec
+                                    , showbInt32Prec
+                                    , showbInt64Prec
+                                    , showbWord8
+                                    , showbWord16
+                                    , showbWord32
+                                    , showbWord64
+                                    )
+
+# include "inline.h"
+#endif
+
+-- | Convert a 'CChar' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCCharPrec :: Int -> CChar -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCCharPrec = showbPrec
+{-# INLINE showbCCharPrec #-}
+#else
+showbCCharPrec p c = showbInt8Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CSChar' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCSCharPrec :: Int -> CSChar -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCSCharPrec = showbPrec
+{-# INLINE showbCSCharPrec #-}
+#else
+showbCSCharPrec p c = showbInt8Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CUChar' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCUChar :: CUChar -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCUChar = showb
+{-# INLINE showbCUChar #-}
+#else
+showbCUChar c = showbWord8 $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CShort' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCShortPrec :: Int -> CShort -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCShortPrec = showbPrec
+{-# INLINE showbCShortPrec #-}
+#else
+showbCShortPrec p c = showbInt16Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CUShort' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCUShort :: CUShort -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCUShort = showb
+{-# INLINE showbCUShort #-}
+#else
+showbCUShort c = showbWord16 $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CInt' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCIntPrec :: Int -> CInt -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCIntPrec = showbPrec
+{-# INLINE showbCIntPrec #-}
+#else
+showbCIntPrec p c = showbInt32Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CUInt' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCUInt :: CUInt -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCUInt = showb
+{-# INLINE showbCUInt #-}
+#else
+showbCUInt c = showbWord32 $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CLong' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCLongPrec :: Int -> CLong -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCLongPrec = showbPrec
+{-# INLINE showbCLongPrec #-}
+#else
+showbCLongPrec p c = showbInt32Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CULong' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCULong :: CULong -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCULong = showb
+{-# INLINE showbCULong #-}
+#else
+showbCULong c = showbWord32 $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CPtrdiff' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCPtrdiffPrec :: Int -> CPtrdiff -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCPtrdiffPrec = showbPrec
+{-# INLINE showbCPtrdiffPrec #-}
+#else
+showbCPtrdiffPrec p c = showbInt32Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CSize' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCSize :: CSize -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCSize = showb
+{-# INLINE showbCSize #-}
+#else
+showbCSize c = showbWord32 $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CWchar' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCWcharPrec :: Int -> CWchar -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCWcharPrec = showbPrec
+{-# INLINE showbCWcharPrec #-}
+#else
+showbCWcharPrec p c = showbInt32Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CSigAtomic' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCSigAtomicPrec :: Int -> CSigAtomic -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCSigAtomicPrec = showbPrec
+{-# INLINE showbCSigAtomicPrec #-}
+#else
+showbCSigAtomicPrec p c = showbInt32Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CLLong' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCLLongPrec :: Int -> CLLong -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCLLongPrec = showbPrec
+{-# INLINE showbCLLongPrec #-}
+#else
+showbCLLongPrec p c = showbInt64Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CULLong' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCULLong :: CULLong -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCULLong = showb
+{-# INLINE showbCULLong #-}
+#else
+showbCULLong c = showbWord64 $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CIntPtr' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCIntPtrPrec :: Int -> CIntPtr -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCIntPtrPrec = showbPrec
+{-# INLINE showbCIntPtrPrec #-}
+#else
+showbCIntPtrPrec p c = showbInt32Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CUIntPtr' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCUIntPtr :: CUIntPtr -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCUIntPtr = showb
+{-# INLINE showbCUIntPtr #-}
+#else
+showbCUIntPtr c = showbWord32 $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CIntMax' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCIntMaxPrec :: Int -> CIntMax -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCIntMaxPrec = showbPrec
+{-# INLINE showbCIntMaxPrec #-}
+#else
+showbCIntMaxPrec p c = showbInt64Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CUIntMax' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCUIntMax :: CUIntMax -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCUIntMax = showb
+{-# INLINE showbCUIntMax #-}
+#else
+showbCUIntMax c = showbWord64 $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CClock' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCClockPrec :: Int -> CClock -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCClockPrec = showbPrec
+{-# INLINE showbCClockPrec #-}
+#else
+showbCClockPrec p c = showbInt32Prec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CTime' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCTimePrec :: Int -> CTime -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCTimePrec = showbPrec
+{-# INLINE showbCTimePrec #-}
+#else
+showbCTimePrec p c = showbInt32Prec p $ unsafeCoerce# c
+#endif
+
+#if MIN_VERSION_base(4,4,0)
+-- | Convert a 'CUSeconds' value to a 'Builder'.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbCUSeconds :: CUSeconds -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCUSeconds = showb
+{-# INLINE showbCUSeconds #-}
+# else
+showbCUSeconds c = showbWord32 $ unsafeCoerce# c
+# endif
+
+-- | Convert a 'CSUSeconds' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbCSUSecondsPrec :: Int -> CSUSeconds -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCSUSecondsPrec = showbPrec
+{-# INLINE showbCSUSecondsPrec #-}
+# else
+showbCSUSecondsPrec p c = showbInt32Prec p $ unsafeCoerce# c
+# endif
+#endif
+
+-- | Convert a 'CFloat' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCFloatPrec :: Int -> CFloat -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCFloatPrec = showbPrec
+{-# INLINE showbCFloatPrec #-}
+#else
+showbCFloatPrec p c = showbFloatPrec p $ unsafeCoerce# c
+#endif
+
+-- | Convert a 'CDouble' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCDoublePrec :: Int -> CDouble -> Builder
+#if MIN_VERSION_base(4,5,0)
+showbCDoublePrec = showbPrec
+{-# INLINE showbCDoublePrec #-}
+#else
+showbCDoublePrec p c = showbDoublePrec p $ unsafeCoerce# c
+#endif
+
+#if MIN_VERSION_base(4,5,0)
+deriving instance Show CChar
+deriving instance Show CSChar
+deriving instance Show CUChar
+deriving instance Show CShort
+deriving instance Show CUShort
+deriving instance Show CInt
+deriving instance Show CUInt
+deriving instance Show CLong
+deriving instance Show CULong
+deriving instance Show CPtrdiff
+deriving instance Show CSize
+deriving instance Show CWchar
+deriving instance Show CSigAtomic
+deriving instance Show CLLong
+deriving instance Show CULLong
+deriving instance Show CIntPtr
+deriving instance Show CUIntPtr
+deriving instance Show CIntMax
+deriving instance Show CUIntMax
+deriving instance Show CClock
+deriving instance Show CTime
+# if MIN_VERSION_base(4,4,0)
+deriving instance Show CUSeconds
+deriving instance Show CSUSeconds
+# endif
+deriving instance Show CFloat
+deriving instance Show CDouble
+#else
+instance Show CChar where
+    showbPrec = showbCCharPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CSChar where
+    showbPrec = showbCSCharPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CUChar where
+    showb = showbCUChar
+    INLINE_INST_FUN(showb)
+
+instance Show CShort where
+    showbPrec = showbCShortPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CUShort where
+    showb = showbCUShort
+    INLINE_INST_FUN(showb)
+
+instance Show CInt where
+    showbPrec = showbCIntPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CUInt where
+    showb = showbCUInt
+    INLINE_INST_FUN(showb)
+
+instance Show CLong where
+    showbPrec = showbCLongPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CULong where
+    showb = showbCULong
+    INLINE_INST_FUN(showb)
+
+instance Show CPtrdiff where
+    showbPrec = showbCPtrdiffPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CSize where
+    showb = showbCSize
+    INLINE_INST_FUN(showb)
+
+instance Show CWchar where
+    showbPrec = showbCWcharPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CSigAtomic where
+    showbPrec = showbCSigAtomicPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CLLong where
+    showbPrec = showbCLLongPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CULLong where
+    showb = showbCULLong
+    INLINE_INST_FUN(showb)
+
+instance Show CIntPtr where
+    showbPrec = showbCIntPtrPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CUIntPtr where
+    showb = showbCUIntPtr
+    INLINE_INST_FUN(showb)
+
+instance Show CIntMax where
+    showbPrec = showbCIntMaxPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CUIntMax where
+    showb = showbCUIntMax
+    INLINE_INST_FUN(showb)
+
+instance Show CClock where
+    showbPrec = showbCClockPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CTime where
+    showbPrec = showbCTimePrec
+    INLINE_INST_FUN(showbPrec)
+
+# if MIN_VERSION_base(4,4,0)
+instance Show CUSeconds where
+    showb = showbCUSeconds
+    INLINE_INST_FUN(showb)
+
+instance Show CSUSeconds where
+    showbPrec = showbCSUSecondsPrec
+    INLINE_INST_FUN(showbPrec)
+# endif
+
+instance Show CFloat where
+    showbPrec = showbCFloatPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show CDouble where
+    showbPrec = showbCDoublePrec
+    INLINE_INST_FUN(showbPrec)
+#endif
src/Text/Show/Text/Foreign/Ptr.hs view
@@ -1,116 +1,116 @@-{-# LANGUAGE CPP       #-}-{-# LANGUAGE MagicHash #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Foreign.Ptr-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for pointer types used in the Haskell-Foreign Function Interface (FFI).--/Since: 0.3/--}-module Text.Show.Text.Foreign.Ptr (-      showbPtr-    , showbFunPtr-    , showbIntPtrPrec-    , showbWordPtr-    , showbForeignPtr-    ) where--import Data.Semigroup (timesN)-import Data.Text.Lazy.Builder (Builder)--import Foreign.ForeignPtr (ForeignPtr)-import Foreign.Ptr (FunPtr, IntPtr, WordPtr, castFunPtrToPtr)--import GHC.ForeignPtr (unsafeForeignPtrToPtr)-import GHC.Num (wordToInteger)-import GHC.Ptr (Ptr(..))-import GHC.Prim (addr2Int#, int2Word#, unsafeCoerce#)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))-import Text.Show.Text.Data.Integral (showbHex, showbIntPrec, showbWord)-import Text.Show.Text.Utils ((<>), lengthB, s)--#include "MachDeps.h"-#include "inline.h"---- | Convert a 'Ptr' to a 'Builder'. Note that this does not require the parameterized--- type to be an instance of 'Show' itself.--- --- /Since: 0.3/-showbPtr :: Ptr a -> Builder-showbPtr (Ptr a) = padOut . showbHex $ wordToInteger (int2Word# (addr2Int# a))-  where-    padOut :: Builder -> Builder-    padOut ls =-         s '0' <> s 'x'-      <> timesN (fromIntegral . max 0 $ 2*SIZEOF_HSPTR - lengthB ls) (s '0')-      <> ls---- | Convert a 'FunPtr' to a 'Builder'. Note that this does not require the--- parameterized type to be an instance of 'Show' itself.--- --- /Since: 0.3/-showbFunPtr :: FunPtr a -> Builder-showbFunPtr = showb . castFunPtrToPtr-{-# INLINE showbFunPtr #-}---- | Convert an 'IntPtr' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbIntPtrPrec :: Int -> IntPtr -> Builder-showbIntPtrPrec p ip = showbIntPrec p $ unsafeCoerce# ip---- | Convert a 'WordPtr' to a 'Builder'.--- --- /Since: 0.3/-showbWordPtr :: WordPtr -> Builder-showbWordPtr wp = showbWord $ unsafeCoerce# wp---- | Convert a 'ForeignPtr' to a 'Builder'. Note that this does not require the--- parameterized type to be an instance of 'Show' itself.--- --- /Since: 0.3/-showbForeignPtr :: ForeignPtr a -> Builder-showbForeignPtr = showb . unsafeForeignPtrToPtr-{-# INLINE showbForeignPtr #-}--instance Show (Ptr a) where-    showb = showbPtr-    INLINE_INST_FUN(showb)--instance Show1 Ptr where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance Show (FunPtr a) where-    showb = showbFunPtr-    INLINE_INST_FUN(showb)--instance Show1 FunPtr where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--instance Show IntPtr where-    showbPrec = showbIntPtrPrec-    INLINE_INST_FUN(showbPrec)--instance Show WordPtr where-    showb = showbWordPtr-    INLINE_INST_FUN(showb)--instance Show (ForeignPtr a) where-    showb = showbForeignPtr-    INLINE_INST_FUN(showb)--instance Show1 ForeignPtr where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP       #-}
+{-# LANGUAGE MagicHash #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Foreign.Ptr
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for pointer types used in the Haskell
+Foreign Function Interface (FFI).
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Foreign.Ptr (
+      showbPtr
+    , showbFunPtr
+    , showbIntPtrPrec
+    , showbWordPtr
+    , showbForeignPtr
+    ) where
+
+import Data.Semigroup (timesN)
+import Data.Text.Lazy.Builder (Builder)
+
+import Foreign.ForeignPtr (ForeignPtr)
+import Foreign.Ptr (FunPtr, IntPtr, WordPtr, castFunPtrToPtr)
+
+import GHC.ForeignPtr (unsafeForeignPtrToPtr)
+import GHC.Num (wordToInteger)
+import GHC.Ptr (Ptr(..))
+import GHC.Prim (addr2Int#, int2Word#, unsafeCoerce#)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))
+import Text.Show.Text.Data.Integral (showbHex, showbIntPrec, showbWord)
+import Text.Show.Text.Utils ((<>), lengthB, s)
+
+#include "MachDeps.h"
+#include "inline.h"
+
+-- | Convert a 'Ptr' to a 'Builder'. Note that this does not require the parameterized
+-- type to be an instance of 'Show' itself.
+-- 
+-- /Since: 0.3/
+showbPtr :: Ptr a -> Builder
+showbPtr (Ptr a) = padOut . showbHex $ wordToInteger (int2Word# (addr2Int# a))
+  where
+    padOut :: Builder -> Builder
+    padOut ls =
+         s '0' <> s 'x'
+      <> timesN (fromIntegral . max 0 $ 2*SIZEOF_HSPTR - lengthB ls) (s '0')
+      <> ls
+
+-- | Convert a 'FunPtr' to a 'Builder'. Note that this does not require the
+-- parameterized type to be an instance of 'Show' itself.
+-- 
+-- /Since: 0.3/
+showbFunPtr :: FunPtr a -> Builder
+showbFunPtr = showb . castFunPtrToPtr
+{-# INLINE showbFunPtr #-}
+
+-- | Convert an 'IntPtr' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbIntPtrPrec :: Int -> IntPtr -> Builder
+showbIntPtrPrec p ip = showbIntPrec p $ unsafeCoerce# ip
+
+-- | Convert a 'WordPtr' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbWordPtr :: WordPtr -> Builder
+showbWordPtr wp = showbWord $ unsafeCoerce# wp
+
+-- | Convert a 'ForeignPtr' to a 'Builder'. Note that this does not require the
+-- parameterized type to be an instance of 'Show' itself.
+-- 
+-- /Since: 0.3/
+showbForeignPtr :: ForeignPtr a -> Builder
+showbForeignPtr = showb . unsafeForeignPtrToPtr
+{-# INLINE showbForeignPtr #-}
+
+instance Show (Ptr a) where
+    showb = showbPtr
+    INLINE_INST_FUN(showb)
+
+instance Show1 Ptr where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance Show (FunPtr a) where
+    showb = showbFunPtr
+    INLINE_INST_FUN(showb)
+
+instance Show1 FunPtr where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
+
+instance Show IntPtr where
+    showbPrec = showbIntPtrPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show WordPtr where
+    showb = showbWordPtr
+    INLINE_INST_FUN(showb)
+
+instance Show (ForeignPtr a) where
+    showb = showbForeignPtr
+    INLINE_INST_FUN(showb)
+
+instance Show1 ForeignPtr where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/Functions.hs view
@@ -1,37 +1,37 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Functions-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Optional 'Show' and 'Show1' instances for functions.--/Since: 0.3/--}-module Text.Show.Text.Functions (showbFunction) where--import Data.Text.Lazy.Builder (Builder)-import Prelude hiding (Show)-import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))--#include "inline.h"---- | Convert a function to a 'Builder'.--- --- /Since: 0.3/-showbFunction :: (a -> b) -> Builder-showbFunction _ = "<function>"-{-# INLINE showbFunction #-}--instance Show (a -> b) where-    showb = showbFunction-    INLINE_INST_FUN(showb)--instance Show1 ((->) a) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Functions
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Optional 'Show' and 'Show1' instances for functions.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Functions (showbFunction) where
+
+import Data.Text.Lazy.Builder (Builder)
+import Prelude hiding (Show)
+import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))
+
+#include "inline.h"
+
+-- | Convert a function to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbFunction :: (a -> b) -> Builder
+showbFunction _ = "<function>"
+{-# INLINE showbFunction #-}
+
+instance Show (a -> b) where
+    showb = showbFunction
+    INLINE_INST_FUN(showb)
+
+instance Show1 ((->) a) where
+    showbPrec1 = showbPrec
+    INLINE_INST_FUN(showbPrec1)
src/Text/Show/Text/GHC.hs view
@@ -1,33 +1,33 @@-{-# LANGUAGE CPP #-}-{-|-Module:      Text.Show.Text.GHC-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Imports 'Show' instances for @GHC@ modules.--}-module Text.Show.Text.GHC () where --#if defined(mingw32_HOST_OS)-import Text.Show.Text.GHC.Conc.Windows ()-#endif-#if MIN_VERSION_base(4,4,0)-# if !defined(mingw32_HOST_OS)-import Text.Show.Text.GHC.Event        ()-# endif-import Text.Show.Text.GHC.Fingerprint  ()-import Text.Show.Text.GHC.Generics     ()-#endif-#if MIN_VERSION_base(4,8,0)-import Text.Show.Text.GHC.RTS.Flags    ()-import Text.Show.Text.GHC.StaticPtr    ()-#endif-#if MIN_VERSION_base(4,5,0)-import Text.Show.Text.GHC.Stats        ()-#endif-#if MIN_VERSION_base(4,6,0)-import Text.Show.Text.GHC.TypeLits     ()-#endif+{-# LANGUAGE CPP #-}
+{-|
+Module:      Text.Show.Text.GHC
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Imports 'Show' instances for @GHC@ modules.
+-}
+module Text.Show.Text.GHC () where 
+
+#if defined(mingw32_HOST_OS)
+import Text.Show.Text.GHC.Conc.Windows ()
+#endif
+#if MIN_VERSION_base(4,4,0)
+# if !defined(mingw32_HOST_OS)
+import Text.Show.Text.GHC.Event        ()
+# endif
+import Text.Show.Text.GHC.Fingerprint  ()
+import Text.Show.Text.GHC.Generics     ()
+#endif
+#if MIN_VERSION_base(4,8,0)
+import Text.Show.Text.GHC.RTS.Flags    ()
+import Text.Show.Text.GHC.StaticPtr    ()
+#endif
+#if MIN_VERSION_base(4,5,0)
+import Text.Show.Text.GHC.Stats        ()
+#endif
+#if MIN_VERSION_base(4,6,0)
+import Text.Show.Text.GHC.TypeLits     ()
+#endif
src/Text/Show/Text/GHC/Conc/Windows.hs view
@@ -1,43 +1,43 @@-{-# LANGUAGE CPP             #-}-#if !defined(__GHCJS__)-{-# LANGUAGE TemplateHaskell #-}-#endif-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.GHC.Conc.Windows-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'ConsoleEvent'.-This module is only available on Windows.--Note that this module does not export anything on GHCJS.--/Since: 0.5/--}-module Text.Show.Text.GHC.Conc.Windows (-#if defined(__GHCJS__)-    ) where-#else-      showbConsoleEvent-    ) where--import Data.Text.Lazy.Builder (Builder)--import GHC.Conc.Windows (ConsoleEvent)--import Text.Show.Text.Classes (showb)-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb)---- | Convert a 'ConsoleEvent' to a 'Builder'.--- --- /Since: 0.5/-showbConsoleEvent :: ConsoleEvent -> Builder-showbConsoleEvent = showb-{-# INLINE showbConsoleEvent #-}--$(deriveShowPragmas defaultInlineShowb ''ConsoleEvent)-#endif+{-# LANGUAGE CPP             #-}
+#if !defined(__GHCJS__)
+{-# LANGUAGE TemplateHaskell #-}
+#endif
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.GHC.Conc.Windows
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'ConsoleEvent'.
+This module is only available on Windows.
+
+Note that this module does not export anything on GHCJS.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.GHC.Conc.Windows (
+#if defined(__GHCJS__)
+    ) where
+#else
+      showbConsoleEvent
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import GHC.Conc.Windows (ConsoleEvent)
+
+import Text.Show.Text.Classes (showb)
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb)
+
+-- | Convert a 'ConsoleEvent' to a 'Builder'.
+-- 
+-- /Since: 0.5/
+showbConsoleEvent :: ConsoleEvent -> Builder
+showbConsoleEvent = showb
+{-# INLINE showbConsoleEvent #-}
+
+$(deriveShowPragmas defaultInlineShowb ''ConsoleEvent)
+#endif
src/Text/Show/Text/GHC/Event.hs view
@@ -1,57 +1,57 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.GHC.Event-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for data types in the @Event@ module.-This module is only available with @base-4.4.0.0@ or later and is not available-on Windows.--Note that this module does not export anything on GHCJS.--/Since: 0.3/--}-module Text.Show.Text.GHC.Event (-#if defined(__GHCJS__)-    ) where-#else-      showbEvent-    , showbFdKeyPrec-    ) where --import Data.Text.Lazy.Builder (Builder)-import GHC.Event (Event, FdKey)-import Prelude hiding (Show)-import Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))---- | Convert an 'Event' to a 'Builder'.--- This function is only available with @base-4.4.0.0@ or later and is not available--- on Windows.--- --- /Since: 0.3/-showbEvent :: Event -> Builder-showbEvent = showb . FromStringShow-{-# INLINE showbEvent #-}---- | Convert an 'FdKey' to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later and is not available--- on Windows.--- --- /Since: 0.3/-showbFdKeyPrec :: Int -> FdKey -> Builder-showbFdKeyPrec p = showbPrec p . FromStringShow-{-# INLINE showbFdKeyPrec #-}--instance Show Event where-    showb = showbEvent-    {-# INLINE showb #-}--instance Show FdKey where-    showbPrec = showbFdKeyPrec-    {-# INLINE showbPrec #-}-#endif+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.GHC.Event
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the @Event@ module.
+This module is only available with @base-4.4.0.0@ or later and is not available
+on Windows.
+
+Note that this module does not export anything on GHCJS.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.GHC.Event (
+#if defined(__GHCJS__)
+    ) where
+#else
+      showbEvent
+    , showbFdKeyPrec
+    ) where 
+
+import Data.Text.Lazy.Builder (Builder)
+import GHC.Event (Event, FdKey)
+import Prelude hiding (Show)
+import Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))
+
+-- | Convert an 'Event' to a 'Builder'.
+-- This function is only available with @base-4.4.0.0@ or later and is not available
+-- on Windows.
+-- 
+-- /Since: 0.3/
+showbEvent :: Event -> Builder
+showbEvent = showb . FromStringShow
+{-# INLINE showbEvent #-}
+
+-- | Convert an 'FdKey' to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later and is not available
+-- on Windows.
+-- 
+-- /Since: 0.3/
+showbFdKeyPrec :: Int -> FdKey -> Builder
+showbFdKeyPrec p = showbPrec p . FromStringShow
+{-# INLINE showbFdKeyPrec #-}
+
+instance Show Event where
+    showb = showbEvent
+    {-# INLINE showb #-}
+
+instance Show FdKey where
+    showbPrec = showbFdKeyPrec
+    {-# INLINE showbPrec #-}
+#endif
src/Text/Show/Text/GHC/Fingerprint.hs view
@@ -1,42 +1,42 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.GHC.Fingerprint-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Fingerprint' values.-This module is only available with @base-4.4.0.0@ or later.--/Since: 0.5/--}-module Text.Show.Text.GHC.Fingerprint (showbFingerprint) where--import Data.Semigroup (timesN)-import Data.Text.Lazy.Builder (Builder)-import Data.Word (Word64)--import GHC.Fingerprint.Type (Fingerprint(..))--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb))-import Text.Show.Text.Data.Integral (showbHex)-import Text.Show.Text.Utils ((<>), lengthB, s)---- | Convert a 'Fingerprint' to a 'Builder'.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.5/-showbFingerprint :: Fingerprint -> Builder-showbFingerprint (Fingerprint w1 w2) = hex16 w1 <> hex16 w2-  where-    hex16 :: Word64 -> Builder-    hex16 i = let hex = showbHex i-              in timesN (fromIntegral . max 0 $ 16 - lengthB hex) (s '0') <> hex--instance Show Fingerprint where-    showb = showbFingerprint-    {-# INLINE showb #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.GHC.Fingerprint
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Fingerprint' values.
+This module is only available with @base-4.4.0.0@ or later.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.GHC.Fingerprint (showbFingerprint) where
+
+import Data.Semigroup (timesN)
+import Data.Text.Lazy.Builder (Builder)
+import Data.Word (Word64)
+
+import GHC.Fingerprint.Type (Fingerprint(..))
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb))
+import Text.Show.Text.Data.Integral (showbHex)
+import Text.Show.Text.Utils ((<>), lengthB, s)
+
+-- | Convert a 'Fingerprint' to a 'Builder'.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbFingerprint :: Fingerprint -> Builder
+showbFingerprint (Fingerprint w1 w2) = hex16 w1 <> hex16 w2
+  where
+    hex16 :: Word64 -> Builder
+    hex16 i = let hex = showbHex i
+              in timesN (fromIntegral . max 0 $ 16 - lengthB hex) (s '0') <> hex
+
+instance Show Fingerprint where
+    showb = showbFingerprint
+    {-# INLINE showb #-}
src/Text/Show/Text/GHC/Generics.hs view
@@ -1,186 +1,186 @@-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE TemplateHaskell  #-}-{-# LANGUAGE TypeOperators    #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.GHC.Generics-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for generics-related data types.-This module is only available with @base-4.4.0.0@ or later.--/Since: 0.3/--}-module Text.Show.Text.GHC.Generics (-      showbU1-    , showbPar1Prec-    , showbRec1Prec-    , showbK1Prec-    , showbM1Prec-    , showbSumTypePrec-    , showbProductTypePrec-    , showbCompFunctorsPrec-    , showbFixityPrec-    , showbAssociativity-    , showbArityPrec-    ) where--import Data.Text.Lazy.Builder (Builder)--import GHC.Generics (U1(..), Par1, Rec1(..), K1(..),-                     M1(..), (:+:)(..), (:*:)(..), (:.:)(..),-                     Fixity, Associativity, Arity)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))-import Text.Show.Text.Data.Integral ()-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb,-                                   defaultInlineShowbPrec, mkShowbPrec)---- | Convert a 'U1' value to a 'Builder'.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbU1 :: U1 p -> Builder-showbU1 = showb-{-# INLINE showbU1 #-}---- | Convert a 'Par1' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbPar1Prec :: Show p => Int -> Par1 p -> Builder-showbPar1Prec = showbPrec-{-# INLINE showbPar1Prec #-}---- | Convert a 'Rec1' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbRec1Prec :: Show (f p) => Int -> Rec1 f p -> Builder-showbRec1Prec = showbPrec-{-# INLINE showbRec1Prec #-}---- | Convert a 'K1' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbK1Prec :: Show c => Int -> K1 i c p -> Builder-showbK1Prec = showbPrec-{-# INLINE showbK1Prec #-}---- | Convert an 'M1' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbM1Prec :: Show (f p) => Int -> M1 i c f p -> Builder-showbM1Prec = showbPrec-{-# INLINE showbM1Prec #-}---- | Convert a '(:+:)' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbSumTypePrec :: (Show (f p), Show (g p)) => Int -> (f :+: g) p -> Builder-showbSumTypePrec = showbPrec-{-# INLINE showbSumTypePrec #-}---- | Convert a '(:*:)' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbProductTypePrec :: (Show (f p), Show (g p)) => Int -> (f :*: g) p -> Builder-showbProductTypePrec = showbPrec-{-# INLINE showbProductTypePrec #-}---- | Convert a '(:.:)' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbCompFunctorsPrec :: Show (f (g p)) => Int -> (f :.: g) p -> Builder-showbCompFunctorsPrec = showbPrec-{-# INLINE showbCompFunctorsPrec #-}---- | Convert a 'Fixity' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbFixityPrec :: Int -> Fixity -> Builder-showbFixityPrec = showbPrec-{-# INLINE showbFixityPrec #-}---- | Convert an 'Associativity' value to a 'Builder'.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbAssociativity :: Associativity -> Builder-showbAssociativity = showb-{-# INLINE showbAssociativity #-}---- | Convert an 'Arity' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbArityPrec :: Int -> Arity -> Builder-showbArityPrec = showbPrec-{-# INLINE showbArityPrec #-}---- TODO: Derive with TH once it can detect phantom types properly-instance Show (U1 p) where-    showbPrec = $(mkShowbPrec ''U1)-    {-# INLINE showb #-}--instance Show1 U1 where-    showbPrec1 = showbPrec-    {-# INLINE showbPrec1 #-}--$(deriveShowPragmas defaultInlineShowbPrec ''Par1)--instance Show1 Par1 where-    showbPrec1 = showbPrec-    {-# INLINE showbPrec1 #-}---- TODO: Derive with TH once it can detect higher-kinded types properly-instance Show (f p) => Show (Rec1 f p) where-    showbPrec = $(mkShowbPrec ''Rec1)-    {-# INLINE showbPrec #-}---- TODO: Derive with TH once it can detect phantom types properly-instance Show c => Show (K1 i c p) where-    showbPrec = $(mkShowbPrec ''K1)-    {-# INLINE showbPrec #-}---- TODO: Derive with TH once it can detect phantom types properly-instance Show c => Show1 (K1 i c) where-    showbPrec1 = showbPrec-    {-# INLINE showbPrec1 #-}---- TODO: Derive with TH once it can detect phantom types--- and higher-kinded types properly-instance Show (f p) => Show (M1 i c f p) where-    showbPrec = $(mkShowbPrec ''M1)-    {-# INLINE showbPrec #-}---- TODO: Derive with TH once it can detect higher-kinded types properly-instance (Show (f p), Show (g p)) => Show ((f :+: g) p) where-    showbPrec = $(mkShowbPrec ''(:+:))-    {-# INLINE showbPrec #-}---- TODO: Derive with TH once it can detect higher-kinded types properly-instance (Show (f p), Show (g p)) => Show ((f :*: g) p) where-    showbPrec = $(mkShowbPrec ''(:*:))-    {-# INLINE showbPrec #-}---- TODO: Derive with TH once it can detect higher-kinded types properly-instance Show (f (g p)) => Show ((f :.: g) p) where-    showbPrec = $(mkShowbPrec ''(:.:))-    {-# INLINE showbPrec #-}--$(deriveShowPragmas defaultInlineShowbPrec ''Fixity)-$(deriveShowPragmas defaultInlineShowb     ''Associativity)-$(deriveShowPragmas defaultInlineShowbPrec ''Arity)+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE TemplateHaskell  #-}
+{-# LANGUAGE TypeOperators    #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.GHC.Generics
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for generics-related data types.
+This module is only available with @base-4.4.0.0@ or later.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.GHC.Generics (
+      showbU1
+    , showbPar1Prec
+    , showbRec1Prec
+    , showbK1Prec
+    , showbM1Prec
+    , showbSumTypePrec
+    , showbProductTypePrec
+    , showbCompFunctorsPrec
+    , showbFixityPrec
+    , showbAssociativity
+    , showbArityPrec
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import GHC.Generics (U1(..), Par1, Rec1(..), K1(..),
+                     M1(..), (:+:)(..), (:*:)(..), (:.:)(..),
+                     Fixity, Associativity, Arity)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(showbPrec1))
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb,
+                                   defaultInlineShowbPrec, mkShowbPrec)
+
+-- | Convert a 'U1' value to a 'Builder'.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbU1 :: U1 p -> Builder
+showbU1 = showb
+{-# INLINE showbU1 #-}
+
+-- | Convert a 'Par1' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbPar1Prec :: Show p => Int -> Par1 p -> Builder
+showbPar1Prec = showbPrec
+{-# INLINE showbPar1Prec #-}
+
+-- | Convert a 'Rec1' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbRec1Prec :: Show (f p) => Int -> Rec1 f p -> Builder
+showbRec1Prec = showbPrec
+{-# INLINE showbRec1Prec #-}
+
+-- | Convert a 'K1' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbK1Prec :: Show c => Int -> K1 i c p -> Builder
+showbK1Prec = showbPrec
+{-# INLINE showbK1Prec #-}
+
+-- | Convert an 'M1' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbM1Prec :: Show (f p) => Int -> M1 i c f p -> Builder
+showbM1Prec = showbPrec
+{-# INLINE showbM1Prec #-}
+
+-- | Convert a '(:+:)' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbSumTypePrec :: (Show (f p), Show (g p)) => Int -> (f :+: g) p -> Builder
+showbSumTypePrec = showbPrec
+{-# INLINE showbSumTypePrec #-}
+
+-- | Convert a '(:*:)' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbProductTypePrec :: (Show (f p), Show (g p)) => Int -> (f :*: g) p -> Builder
+showbProductTypePrec = showbPrec
+{-# INLINE showbProductTypePrec #-}
+
+-- | Convert a '(:.:)' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbCompFunctorsPrec :: Show (f (g p)) => Int -> (f :.: g) p -> Builder
+showbCompFunctorsPrec = showbPrec
+{-# INLINE showbCompFunctorsPrec #-}
+
+-- | Convert a 'Fixity' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbFixityPrec :: Int -> Fixity -> Builder
+showbFixityPrec = showbPrec
+{-# INLINE showbFixityPrec #-}
+
+-- | Convert an 'Associativity' value to a 'Builder'.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbAssociativity :: Associativity -> Builder
+showbAssociativity = showb
+{-# INLINE showbAssociativity #-}
+
+-- | Convert an 'Arity' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbArityPrec :: Int -> Arity -> Builder
+showbArityPrec = showbPrec
+{-# INLINE showbArityPrec #-}
+
+-- TODO: Derive with TH once it can detect phantom types properly
+instance Show (U1 p) where
+    showbPrec = $(mkShowbPrec ''U1)
+    {-# INLINE showb #-}
+
+instance Show1 U1 where
+    showbPrec1 = showbPrec
+    {-# INLINE showbPrec1 #-}
+
+$(deriveShowPragmas defaultInlineShowbPrec ''Par1)
+
+instance Show1 Par1 where
+    showbPrec1 = showbPrec
+    {-# INLINE showbPrec1 #-}
+
+-- TODO: Derive with TH once it can detect higher-kinded types properly
+instance Show (f p) => Show (Rec1 f p) where
+    showbPrec = $(mkShowbPrec ''Rec1)
+    {-# INLINE showbPrec #-}
+
+-- TODO: Derive with TH once it can detect phantom types properly
+instance Show c => Show (K1 i c p) where
+    showbPrec = $(mkShowbPrec ''K1)
+    {-# INLINE showbPrec #-}
+
+-- TODO: Derive with TH once it can detect phantom types properly
+instance Show c => Show1 (K1 i c) where
+    showbPrec1 = showbPrec
+    {-# INLINE showbPrec1 #-}
+
+-- TODO: Derive with TH once it can detect phantom types
+-- and higher-kinded types properly
+instance Show (f p) => Show (M1 i c f p) where
+    showbPrec = $(mkShowbPrec ''M1)
+    {-# INLINE showbPrec #-}
+
+-- TODO: Derive with TH once it can detect higher-kinded types properly
+instance (Show (f p), Show (g p)) => Show ((f :+: g) p) where
+    showbPrec = $(mkShowbPrec ''(:+:))
+    {-# INLINE showbPrec #-}
+
+-- TODO: Derive with TH once it can detect higher-kinded types properly
+instance (Show (f p), Show (g p)) => Show ((f :*: g) p) where
+    showbPrec = $(mkShowbPrec ''(:*:))
+    {-# INLINE showbPrec #-}
+
+-- TODO: Derive with TH once it can detect higher-kinded types properly
+instance Show (f (g p)) => Show ((f :.: g) p) where
+    showbPrec = $(mkShowbPrec ''(:.:))
+    {-# INLINE showbPrec #-}
+
+$(deriveShowPragmas defaultInlineShowbPrec ''Fixity)
+$(deriveShowPragmas defaultInlineShowb     ''Associativity)
+$(deriveShowPragmas defaultInlineShowbPrec ''Arity)
src/Text/Show/Text/GHC/RTS/Flags.hs view
@@ -1,239 +1,239 @@-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell   #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.GHC.RTS.Flags-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for data types in the 'GHC.RTS.Flags' module.-This module is only available with @base-4.8.0.0@ or later.--/Since: 0.5/--}-module Text.Show.Text.GHC.RTS.Flags (-      showbRTSFlagsPrec-    , showbGCFlagsPrec-    , showbConcFlagsPrec-    , showbMiscFlagsPrec-    , showbDebugFlagsPrec-    , showbCCFlagsPrec-    , showbProfFlagsPrec-    , showbTraceFlagsPrec-    , showbTickyFlagsPrec-    ) where--import Data.Text.Lazy.Builder (Builder)--import GHC.RTS.Flags-import GHC.Show (appPrec)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, FromStringShow(..))-import Text.Show.Text.Data.Bool (showbBool)-import Text.Show.Text.Data.Char ()-import Text.Show.Text.Data.Floating (showbDoublePrec)-import Text.Show.Text.Data.Integral (showbIntPrec, showbWord, showbWord64)-import Text.Show.Text.Data.List ()-import Text.Show.Text.Data.Maybe (showbMaybePrec)-import Text.Show.Text.Utils ((<>), s)-import Text.Show.Text.TH.Internal (deriveShow)---- | Convert an 'RTSFlags' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbRTSFlagsPrec :: Int -> RTSFlags -> Builder-showbRTSFlagsPrec = showbPrec-{-# INLINE showbRTSFlagsPrec #-}---- | Convert a 'GCFlags' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbGCFlagsPrec :: Int -> GCFlags -> Builder-showbGCFlagsPrec p gcfs = showbParen (p > appPrec) $-       "GCFlags {statsFile = "-    <> showbMaybePrec 0 (statsFile gcfs)-    <> ", giveStats = "-    <> showb (FromStringShow $ giveStats gcfs)-    <> ", maxStkSize = "-    <> showb (maxStkSize gcfs)-    <> ", initialStkSize = "-    <> showb (initialStkSize gcfs)-    <> ", stkChunkSize = "-    <> showb (stkChunkSize gcfs)-    <> ", stkChunkBufferSize = "-    <> showb (stkChunkBufferSize gcfs)-    <> ", maxHeapSize = "-    <> showb (maxHeapSize gcfs)-    <> ", minAllocAreaSize = "-    <> showb (minAllocAreaSize gcfs)-    <> ", minOldGenSize = "-    <> showb (minOldGenSize gcfs)-    <> ", heapSizeSuggestion = "-    <> showb (heapSizeSuggestion gcfs)-    <> ", heapSizeSuggestionAuto = "-    <> showbBool (heapSizeSuggestionAuto gcfs)-    <> ", oldGenFactor = "-    <> showbDoublePrec 0 (oldGenFactor gcfs)-    <> ", pcFreeHeap = "-    <> showbDoublePrec 0 (pcFreeHeap gcfs)-    <> ", generations = "-    <> showb (generations gcfs)-    <> ", steps = "-    <> showb (steps gcfs)-    <> ", squeezeUpdFrames = "-    <> showbBool (squeezeUpdFrames gcfs)-    <> ", compact = "-    <> showbBool (compact gcfs)-    <> ", compactThreshold = "-    <> showbDoublePrec 0 (compactThreshold gcfs)-    <> ", sweep = "-    <> showbBool (sweep gcfs)-    <> ", ringBell = "-    <> showbBool (ringBell gcfs)-    <> ", frontpanel = "-    <> showbBool (frontpanel gcfs)-    <> ", idleGCDelayTime = "-    <> showbWord64 (idleGCDelayTime gcfs)-    <> ", doIdleGC = "-    <> showbBool (doIdleGC gcfs)-    <> ", heapBase = "-    <> showbWord (heapBase gcfs)-    <> ", allocLimitGrace = "-    <> showbWord (allocLimitGrace gcfs)-    <> s '}'---- | Convert a 'ConcFlags' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbConcFlagsPrec :: Int -> ConcFlags -> Builder-showbConcFlagsPrec = showbPrec-{-# INLINE showbConcFlagsPrec #-}---- | Convert a 'MiscFlags' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbMiscFlagsPrec :: Int -> MiscFlags -> Builder-showbMiscFlagsPrec = showbPrec-{-# INLINE showbMiscFlagsPrec #-}---- | Convert a 'DebugFlags' value to a 'Builder' with the given precedence.--- --- /Since: 0.5/-showbDebugFlagsPrec :: Int -> DebugFlags -> Builder-showbDebugFlagsPrec = showbPrec-{-# INLINE showbDebugFlagsPrec #-}---- | Convert a 'CCFlags' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbCCFlagsPrec :: Int -> CCFlags -> Builder-showbCCFlagsPrec p ccfs = showbParen (p > appPrec) $-       "CCFlags {doCostCentres = "-    <> showb (FromStringShow $ doCostCentres ccfs)-    <> ", profilerTicks = "-    <> showbIntPrec 0 (profilerTicks ccfs)-    <> ", msecsPerTick = "-    <> showbIntPrec 0 (msecsPerTick ccfs)-    <> s '}'---- | Convert a 'ProfFlags' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbProfFlagsPrec :: Int -> ProfFlags -> Builder-showbProfFlagsPrec p pfs = showbParen (p > appPrec) $-       "ProfFlags {doHeapProfile = "-    <> showb (FromStringShow $ doHeapProfile pfs)-    <> ", heapProfileInterval = "-    <> showbWord64 (heapProfileInterval pfs)-    <> ", heapProfileIntervalTicks = "-    <> showbWord (heapProfileIntervalTicks pfs)-    <> ", includeTSOs = "-    <> showbBool (includeTSOs pfs)-    <> ", showCCSOnException = "-    <> showbBool (showCCSOnException pfs)-    <> ", maxRetainerSetSize = "-    <> showbWord (maxRetainerSetSize pfs)-    <> ", ccsLength = "-    <> showbWord (ccsLength pfs)-    <> ", modSelector = "-    <> showbMaybePrec 0 (modSelector pfs)-    <> ", descrSelector = "-    <> showbMaybePrec 0 (descrSelector pfs)-    <> ", typeSelector = "-    <> showbMaybePrec 0 (typeSelector pfs)-    <> ", ccSelector = "-    <> showbMaybePrec 0 (ccSelector pfs)-    <> ", ccsSelector = "-    <> showbMaybePrec 0 (ccsSelector pfs)-    <> ", retainerSelector = "-    <> showbMaybePrec 0 (retainerSelector pfs)-    <> ", bioSelector = "-    <> showbMaybePrec 0 (bioSelector pfs)-    <> s '}'---- | Convert a 'TraceFlags' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbTraceFlagsPrec :: Int -> TraceFlags -> Builder-showbTraceFlagsPrec p tfs = showbParen (p > appPrec) $-       "TraceFlags {tracing = "-    <> showb (FromStringShow $ tracing tfs)-    <> ", timestamp = "-    <> showbBool (timestamp tfs)-    <> ", traceScheduler = "-    <> showbBool (traceScheduler tfs)-    <> ", traceGc = "-    <> showbBool (traceGc tfs)-    <> ", sparksSampled = "-    <> showbBool (sparksSampled tfs)-    <> ", sparksFull = "-    <> showbBool (sparksFull tfs)-    <> ", user = "-    <> showbBool (user tfs)-    <> s '}'---- | Convert a 'TickyFlags' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbTickyFlagsPrec :: Int -> TickyFlags -> Builder-showbTickyFlagsPrec = showbPrec-{-# INLINE showbTickyFlagsPrec #-}--$(deriveShow ''RTSFlags)--instance Show GCFlags where-    showbPrec = showbGCFlagsPrec-    {-# INLINE showbPrec #-}--$(deriveShow ''ConcFlags)--$(deriveShow ''MiscFlags)--$(deriveShow ''DebugFlags)--instance Show CCFlags where-    showbPrec = showbCCFlagsPrec-    {-# INLINE showbPrec #-}--instance Show ProfFlags where-    showbPrec = showbProfFlagsPrec-    {-# INLINE showbPrec #-}--instance Show TraceFlags where-    showbPrec = showbTraceFlagsPrec-    {-# INLINE showbPrec #-}--$(deriveShow ''TickyFlags)+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell   #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.GHC.RTS.Flags
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the 'GHC.RTS.Flags' module.
+This module is only available with @base-4.8.0.0@ or later.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.GHC.RTS.Flags (
+      showbRTSFlagsPrec
+    , showbGCFlagsPrec
+    , showbConcFlagsPrec
+    , showbMiscFlagsPrec
+    , showbDebugFlagsPrec
+    , showbCCFlagsPrec
+    , showbProfFlagsPrec
+    , showbTraceFlagsPrec
+    , showbTickyFlagsPrec
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import GHC.RTS.Flags
+import GHC.Show (appPrec)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, FromStringShow(..))
+import Text.Show.Text.Data.Bool (showbBool)
+import Text.Show.Text.Data.Char ()
+import Text.Show.Text.Data.Floating (showbDoublePrec)
+import Text.Show.Text.Data.Integral (showbIntPrec, showbWord, showbWord64)
+import Text.Show.Text.Data.List ()
+import Text.Show.Text.Data.Maybe (showbMaybePrec)
+import Text.Show.Text.Utils ((<>), s)
+import Text.Show.Text.TH.Internal (deriveShow)
+
+-- | Convert an 'RTSFlags' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbRTSFlagsPrec :: Int -> RTSFlags -> Builder
+showbRTSFlagsPrec = showbPrec
+{-# INLINE showbRTSFlagsPrec #-}
+
+-- | Convert a 'GCFlags' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbGCFlagsPrec :: Int -> GCFlags -> Builder
+showbGCFlagsPrec p gcfs = showbParen (p > appPrec) $
+       "GCFlags {statsFile = "
+    <> showbMaybePrec 0 (statsFile gcfs)
+    <> ", giveStats = "
+    <> showb (FromStringShow $ giveStats gcfs)
+    <> ", maxStkSize = "
+    <> showb (maxStkSize gcfs)
+    <> ", initialStkSize = "
+    <> showb (initialStkSize gcfs)
+    <> ", stkChunkSize = "
+    <> showb (stkChunkSize gcfs)
+    <> ", stkChunkBufferSize = "
+    <> showb (stkChunkBufferSize gcfs)
+    <> ", maxHeapSize = "
+    <> showb (maxHeapSize gcfs)
+    <> ", minAllocAreaSize = "
+    <> showb (minAllocAreaSize gcfs)
+    <> ", minOldGenSize = "
+    <> showb (minOldGenSize gcfs)
+    <> ", heapSizeSuggestion = "
+    <> showb (heapSizeSuggestion gcfs)
+    <> ", heapSizeSuggestionAuto = "
+    <> showbBool (heapSizeSuggestionAuto gcfs)
+    <> ", oldGenFactor = "
+    <> showbDoublePrec 0 (oldGenFactor gcfs)
+    <> ", pcFreeHeap = "
+    <> showbDoublePrec 0 (pcFreeHeap gcfs)
+    <> ", generations = "
+    <> showb (generations gcfs)
+    <> ", steps = "
+    <> showb (steps gcfs)
+    <> ", squeezeUpdFrames = "
+    <> showbBool (squeezeUpdFrames gcfs)
+    <> ", compact = "
+    <> showbBool (compact gcfs)
+    <> ", compactThreshold = "
+    <> showbDoublePrec 0 (compactThreshold gcfs)
+    <> ", sweep = "
+    <> showbBool (sweep gcfs)
+    <> ", ringBell = "
+    <> showbBool (ringBell gcfs)
+    <> ", frontpanel = "
+    <> showbBool (frontpanel gcfs)
+    <> ", idleGCDelayTime = "
+    <> showbWord64 (idleGCDelayTime gcfs)
+    <> ", doIdleGC = "
+    <> showbBool (doIdleGC gcfs)
+    <> ", heapBase = "
+    <> showbWord (heapBase gcfs)
+    <> ", allocLimitGrace = "
+    <> showbWord (allocLimitGrace gcfs)
+    <> s '}'
+
+-- | Convert a 'ConcFlags' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbConcFlagsPrec :: Int -> ConcFlags -> Builder
+showbConcFlagsPrec = showbPrec
+{-# INLINE showbConcFlagsPrec #-}
+
+-- | Convert a 'MiscFlags' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbMiscFlagsPrec :: Int -> MiscFlags -> Builder
+showbMiscFlagsPrec = showbPrec
+{-# INLINE showbMiscFlagsPrec #-}
+
+-- | Convert a 'DebugFlags' value to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.5/
+showbDebugFlagsPrec :: Int -> DebugFlags -> Builder
+showbDebugFlagsPrec = showbPrec
+{-# INLINE showbDebugFlagsPrec #-}
+
+-- | Convert a 'CCFlags' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbCCFlagsPrec :: Int -> CCFlags -> Builder
+showbCCFlagsPrec p ccfs = showbParen (p > appPrec) $
+       "CCFlags {doCostCentres = "
+    <> showb (FromStringShow $ doCostCentres ccfs)
+    <> ", profilerTicks = "
+    <> showbIntPrec 0 (profilerTicks ccfs)
+    <> ", msecsPerTick = "
+    <> showbIntPrec 0 (msecsPerTick ccfs)
+    <> s '}'
+
+-- | Convert a 'ProfFlags' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbProfFlagsPrec :: Int -> ProfFlags -> Builder
+showbProfFlagsPrec p pfs = showbParen (p > appPrec) $
+       "ProfFlags {doHeapProfile = "
+    <> showb (FromStringShow $ doHeapProfile pfs)
+    <> ", heapProfileInterval = "
+    <> showbWord64 (heapProfileInterval pfs)
+    <> ", heapProfileIntervalTicks = "
+    <> showbWord (heapProfileIntervalTicks pfs)
+    <> ", includeTSOs = "
+    <> showbBool (includeTSOs pfs)
+    <> ", showCCSOnException = "
+    <> showbBool (showCCSOnException pfs)
+    <> ", maxRetainerSetSize = "
+    <> showbWord (maxRetainerSetSize pfs)
+    <> ", ccsLength = "
+    <> showbWord (ccsLength pfs)
+    <> ", modSelector = "
+    <> showbMaybePrec 0 (modSelector pfs)
+    <> ", descrSelector = "
+    <> showbMaybePrec 0 (descrSelector pfs)
+    <> ", typeSelector = "
+    <> showbMaybePrec 0 (typeSelector pfs)
+    <> ", ccSelector = "
+    <> showbMaybePrec 0 (ccSelector pfs)
+    <> ", ccsSelector = "
+    <> showbMaybePrec 0 (ccsSelector pfs)
+    <> ", retainerSelector = "
+    <> showbMaybePrec 0 (retainerSelector pfs)
+    <> ", bioSelector = "
+    <> showbMaybePrec 0 (bioSelector pfs)
+    <> s '}'
+
+-- | Convert a 'TraceFlags' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbTraceFlagsPrec :: Int -> TraceFlags -> Builder
+showbTraceFlagsPrec p tfs = showbParen (p > appPrec) $
+       "TraceFlags {tracing = "
+    <> showb (FromStringShow $ tracing tfs)
+    <> ", timestamp = "
+    <> showbBool (timestamp tfs)
+    <> ", traceScheduler = "
+    <> showbBool (traceScheduler tfs)
+    <> ", traceGc = "
+    <> showbBool (traceGc tfs)
+    <> ", sparksSampled = "
+    <> showbBool (sparksSampled tfs)
+    <> ", sparksFull = "
+    <> showbBool (sparksFull tfs)
+    <> ", user = "
+    <> showbBool (user tfs)
+    <> s '}'
+
+-- | Convert a 'TickyFlags' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbTickyFlagsPrec :: Int -> TickyFlags -> Builder
+showbTickyFlagsPrec = showbPrec
+{-# INLINE showbTickyFlagsPrec #-}
+
+$(deriveShow ''RTSFlags)
+
+instance Show GCFlags where
+    showbPrec = showbGCFlagsPrec
+    {-# INLINE showbPrec #-}
+
+$(deriveShow ''ConcFlags)
+
+$(deriveShow ''MiscFlags)
+
+$(deriveShow ''DebugFlags)
+
+instance Show CCFlags where
+    showbPrec = showbCCFlagsPrec
+    {-# INLINE showbPrec #-}
+
+instance Show ProfFlags where
+    showbPrec = showbProfFlagsPrec
+    {-# INLINE showbPrec #-}
+
+instance Show TraceFlags where
+    showbPrec = showbTraceFlagsPrec
+    {-# INLINE showbPrec #-}
+
+$(deriveShow ''TickyFlags)
src/Text/Show/Text/GHC/StaticPtr.hs view
@@ -1,37 +1,37 @@-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.GHC.StaticPtr-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'StaticPtrInfo' values.-This module is only available with @base-4.8.0.0@ or later.--/Since: 0.5/--}-module Text.Show.Text.GHC.StaticPtr (showbStaticPtrInfoPrec) where--import Data.Text.Lazy.Builder (Builder)--import GHC.StaticPtr (StaticPtrInfo)--import Text.Show.Text.Classes (showbPrec)-import Text.Show.Text.Data.Char     ()-import Text.Show.Text.Data.Integral ()-import Text.Show.Text.Data.List     ()-import Text.Show.Text.Data.Tuple    ()-import Text.Show.Text.TH.Internal (deriveShow)---- | Conver a 'StaticPtrInfo' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.8.0.0@ or later.--- --- /Since: 0.5/-showbStaticPtrInfoPrec :: Int -> StaticPtrInfo -> Builder-showbStaticPtrInfoPrec = showbPrec-{-# INLINE showbStaticPtrInfoPrec #-}--$(deriveShow ''StaticPtrInfo)+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.GHC.StaticPtr
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'StaticPtrInfo' values.
+This module is only available with @base-4.8.0.0@ or later.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.GHC.StaticPtr (showbStaticPtrInfoPrec) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import GHC.StaticPtr (StaticPtrInfo)
+
+import Text.Show.Text.Classes (showbPrec)
+import Text.Show.Text.Data.Char     ()
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.Data.List     ()
+import Text.Show.Text.Data.Tuple    ()
+import Text.Show.Text.TH.Internal (deriveShow)
+
+-- | Conver a 'StaticPtrInfo' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbStaticPtrInfoPrec :: Int -> StaticPtrInfo -> Builder
+showbStaticPtrInfoPrec = showbPrec
+{-# INLINE showbStaticPtrInfoPrec #-}
+
+$(deriveShow ''StaticPtrInfo)
src/Text/Show/Text/GHC/Stats.hs view
@@ -1,35 +1,35 @@-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.GHC.Stats-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'GCStats'.-This module is only available with @base-4.5.0.0@ or later.--/Since: 0.3/--}-module Text.Show.Text.GHC.Stats (showbGCStatsPrec) where --import Data.Text.Lazy.Builder (Builder)--import GHC.Stats (GCStats)--import Text.Show.Text.Classes (showbPrec)-import Text.Show.Text.Data.Integral ()-import Text.Show.Text.Data.Floating ()-import Text.Show.Text.TH.Internal (deriveShow)---- | Convert a 'GCStats' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.5.0.0@ or later.--- --- /Since: 0.3/-showbGCStatsPrec :: Int -> GCStats -> Builder-showbGCStatsPrec = showbPrec-{-# INLINE showbGCStatsPrec #-}-+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.GHC.Stats
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'GCStats'.
+This module is only available with @base-4.5.0.0@ or later.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.GHC.Stats (showbGCStatsPrec) where 
+
+import Data.Text.Lazy.Builder (Builder)
+
+import GHC.Stats (GCStats)
+
+import Text.Show.Text.Classes (showbPrec)
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.Data.Floating ()
+import Text.Show.Text.TH.Internal (deriveShow)
+
+-- | Convert a 'GCStats' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.5.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbGCStatsPrec :: Int -> GCStats -> Builder
+showbGCStatsPrec = showbPrec
+{-# INLINE showbGCStatsPrec #-}
+
 $(deriveShow ''GCStats)
src/Text/Show/Text/GHC/TypeLits.hs view
@@ -1,105 +1,105 @@-{-# LANGUAGE CPP                  #-}-#if !(MIN_VERSION_base(4,7,0))-{-# LANGUAGE FlexibleContexts     #-}-{-# LANGUAGE GADTs                #-}-{-# LANGUAGE KindSignatures       #-}-{-# LANGUAGE OverloadedStrings    #-}-{-# LANGUAGE PolyKinds            #-}-{-# LANGUAGE UndecidableInstances #-}-#endif-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.GHC.TypeLits-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for data types in the @GHC.TypeLits@ module.-This module is only available with @base-4.6.0.0@ or later.--/Since: 0.5/--}-module Text.Show.Text.GHC.TypeLits (-#if MIN_VERSION_base(4,7,0)-      showbSomeNatPrec-    , showbSomeSymbol-#else-      showbIsEven-    , showbIsZero-#endif-    ) where--import Data.Text.Lazy.Builder (Builder)-import Prelude hiding (Show)-import Text.Show.Text.Classes (Show(showb, showbPrec))--#if MIN_VERSION_base(4,7,0)-import GHC.TypeLits (SomeNat(..), SomeSymbol(..), natVal, symbolVal)-import Text.Show.Text.Data.Char (showbString)-import Text.Show.Text.Data.Integral (showbIntegerPrec)-#else-import GHC.TypeLits (IsEven(..), IsZero(..), Kind, Sing, SingE(fromSing))-import Text.Show.Text.Data.Integral ()-import Text.Show.Text.Utils ((<>), s)-#endif--#if MIN_VERSION_base(4,7,0)--- | Convert a 'SomeNat' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.7.0.0@ or later.--- --- /Since: 0.5/-showbSomeNatPrec :: Int -> SomeNat -> Builder-showbSomeNatPrec p (SomeNat x) = showbIntegerPrec p $ natVal x-{-# INLINE showbSomeNatPrec #-}---- | Convert a 'SomeSymbol' value to a 'Builder' with the given precedence.--- This function is only available with @base-4.7.0.0@ or later.--- --- /Since: 0.5/-showbSomeSymbol :: SomeSymbol -> Builder-showbSomeSymbol (SomeSymbol x) = showbString $ symbolVal x-{-# INLINE showbSomeSymbol #-}-#else--- | Convert an 'IsEven' value to a 'Builder'.--- This function is only available with @base-4.6@.--- --- /Since: 0.5/-showbIsEven :: IsEven n -> Builder-showbIsEven IsEvenZero = s '0'-showbIsEven (IsEven x) = "(2 * " <> showb x <> s ')'-showbIsEven (IsOdd  x) = "(2 * " <> showb x <> " + 1)"-{-# INLINE showbIsEven #-}---- | Convert an 'IsZero' value to a 'Builder'.--- This function is only available with @base-4.6@.--- --- /Since: 0.5/-showbIsZero :: IsZero n -> Builder-showbIsZero IsZero     = s '0'-showbIsZero (IsSucc n) = s '(' <> showb n <> " + 1)"-{-# INLINE showbIsZero #-}-#endif--#if MIN_VERSION_base(4,7,0)-instance Show SomeNat where-    showbPrec = showbSomeNatPrec-    {-# INLINE showbPrec #-}--instance Show SomeSymbol where-    showb = showbSomeSymbol-    {-# INLINE showb #-}-#else-instance Show (IsEven n) where-    showb = showbIsEven-    {-# INLINE showb #-}--instance Show (IsZero n) where-    showb = showbIsZero-    {-# INLINE showb #-}--instance (SingE (Kind :: k) rep, Show rep) => Show (Sing (a :: k)) where-    showbPrec p = showbPrec p . fromSing-    {-# INLINE showbPrec #-}-#endif+{-# LANGUAGE CPP                  #-}
+#if !(MIN_VERSION_base(4,7,0))
+{-# LANGUAGE FlexibleContexts     #-}
+{-# LANGUAGE GADTs                #-}
+{-# LANGUAGE KindSignatures       #-}
+{-# LANGUAGE OverloadedStrings    #-}
+{-# LANGUAGE PolyKinds            #-}
+{-# LANGUAGE UndecidableInstances #-}
+#endif
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.GHC.TypeLits
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the @GHC.TypeLits@ module.
+This module is only available with @base-4.6.0.0@ or later.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.GHC.TypeLits (
+#if MIN_VERSION_base(4,7,0)
+      showbSomeNatPrec
+    , showbSomeSymbol
+#else
+      showbIsEven
+    , showbIsZero
+#endif
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+import Prelude hiding (Show)
+import Text.Show.Text.Classes (Show(showb, showbPrec))
+
+#if MIN_VERSION_base(4,7,0)
+import GHC.TypeLits (SomeNat(..), SomeSymbol(..), natVal, symbolVal)
+import Text.Show.Text.Data.Char (showbString)
+import Text.Show.Text.Data.Integral (showbIntegerPrec)
+#else
+import GHC.TypeLits (IsEven(..), IsZero(..), Kind, Sing, SingE(fromSing))
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.Utils ((<>), s)
+#endif
+
+#if MIN_VERSION_base(4,7,0)
+-- | Convert a 'SomeNat' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.7.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbSomeNatPrec :: Int -> SomeNat -> Builder
+showbSomeNatPrec p (SomeNat x) = showbIntegerPrec p $ natVal x
+{-# INLINE showbSomeNatPrec #-}
+
+-- | Convert a 'SomeSymbol' value to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.7.0.0@ or later.
+-- 
+-- /Since: 0.5/
+showbSomeSymbol :: SomeSymbol -> Builder
+showbSomeSymbol (SomeSymbol x) = showbString $ symbolVal x
+{-# INLINE showbSomeSymbol #-}
+#else
+-- | Convert an 'IsEven' value to a 'Builder'.
+-- This function is only available with @base-4.6@.
+-- 
+-- /Since: 0.5/
+showbIsEven :: IsEven n -> Builder
+showbIsEven IsEvenZero = s '0'
+showbIsEven (IsEven x) = "(2 * " <> showb x <> s ')'
+showbIsEven (IsOdd  x) = "(2 * " <> showb x <> " + 1)"
+{-# INLINE showbIsEven #-}
+
+-- | Convert an 'IsZero' value to a 'Builder'.
+-- This function is only available with @base-4.6@.
+-- 
+-- /Since: 0.5/
+showbIsZero :: IsZero n -> Builder
+showbIsZero IsZero     = s '0'
+showbIsZero (IsSucc n) = s '(' <> showb n <> " + 1)"
+{-# INLINE showbIsZero #-}
+#endif
+
+#if MIN_VERSION_base(4,7,0)
+instance Show SomeNat where
+    showbPrec = showbSomeNatPrec
+    {-# INLINE showbPrec #-}
+
+instance Show SomeSymbol where
+    showb = showbSomeSymbol
+    {-# INLINE showb #-}
+#else
+instance Show (IsEven n) where
+    showb = showbIsEven
+    {-# INLINE showb #-}
+
+instance Show (IsZero n) where
+    showb = showbIsZero
+    {-# INLINE showb #-}
+
+instance (SingE (Kind :: k) rep, Show rep) => Show (Sing (a :: k)) where
+    showbPrec p = showbPrec p . fromSing
+    {-# INLINE showbPrec #-}
+#endif
src/Text/Show/Text/Generic.hs view
@@ -1,318 +1,318 @@-{-# LANGUAGE CPP                 #-}-{-# LANGUAGE DeriveDataTypeable  #-}-{-# LANGUAGE DeriveGeneric       #-}-{-# LANGUAGE FlexibleContexts    #-}-{-# LANGUAGE FlexibleInstances   #-}-{-# LANGUAGE OverloadedStrings   #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TypeOperators       #-}-#if __GLASGOW_HASKELL__ >= 708-{-# LANGUAGE StandaloneDeriving #-}-#endif-{-|-Module:      Text.Show.Text.Generic-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Generic versions of 'Show' class functions, as an alternative to "Text.Show.Text.TH",-which uses Template Haskell. This module is only available if the compiler supports-generics (on GHC, 7.2 or above).--This implementation is based off of the @Generics.Deriving.Show@ module from the-@generic-deriving@ library.--/Since: 0.6/--}-module Text.Show.Text.Generic (-      -- * Generic @show@ functions-      -- $generics-      -      -- ** Understanding a compiler error-      -- $generic_err-      genericShow-    , genericShowLazy-    , genericShowPrec-    , genericShowPrecLazy-    , genericShowList-    , genericShowListLazy-    , genericShowb-    , genericShowbPrec-    , genericShowbList-    , genericPrint-    , genericPrintLazy-    , genericHPrint-    , genericHPrintLazy-      -- * The 'GShow' class-    , GShow(..)-    , ConType(..)-    ) where--#if !(MIN_VERSION_base(4,8,0))-import           Data.Monoid (mempty)-#endif-import qualified Data.Text    as TS (Text)-import qualified Data.Text.IO as TS (putStrLn, hPutStrLn)-import           Data.Text.Lazy (toStrict)-import           Data.Text.Lazy.Builder (Builder, fromString, toLazyText)-import qualified Data.Text.Lazy    as TL (Text)-import qualified Data.Text.Lazy.IO as TL (putStrLn, hPutStrLn)-import           Data.Typeable (Typeable)--import           GHC.Generics-import           GHC.Show (appPrec, appPrec1)--import           Prelude hiding (Show)--import           System.IO (Handle)--import qualified Text.Show as S (Show)-import qualified Text.Show.Text.Classes as T-import           Text.Show.Text.Classes (Show(showbPrec), showbListWith,-                                         showbParen, showbSpace)-import           Text.Show.Text.Instances ()-import           Text.Show.Text.Utils ((<>), isInfixTypeCon, isTupleString,-                                       s, toString)--#include "inline.h"--{- $generics--'T.Show' instances can be easily defined for data types that are 'Generic' instances.-The easiest way to do this is to use the @DeriveGeneric@ extension.--@-&#123;-&#35; LANGUAGE DeriveGeneric &#35;-&#125;-import Text.Show.Text-import Text.Show.Generic (genericShowbPrec)--data D a = Nullary-         | Unary Int-         | Product String Char a-         | Record { testOne   :: Double-                  , testTwo   :: Bool-                  , testThree :: D a-                  }--instance Show a => Show (D a) where-    showbPrec = 'genericShowbPrec'-@--@D@ now has a 'T.Show' instance analogous to what would be generated by a-@deriving Show@ clause.---}--{- $generic_err--Suppose you intend to tuse 'genericShowbPrec' to define a 'T.Show' instance.--@-data Oops = Oops-    -- forgot to add \"deriving Generic\" here!--instance Show Oops where-    showbPrec = 'genericShowbPrec'-@--If you forget to add a @deriving 'Generic'@ clause to your data type, at-compile-time, you will get an error message that begins roughly as follows:--@-No instance for ('GShow' (Rep Oops))-@--This error can be confusing, but don't let it intimidate you. The correct fix is-simply to add the missing \"@deriving 'Generic'@\" clause.--}---- | A 'Generic' implementation of 'T.show'.--- --- /Since: 0.6/-genericShow :: (Generic a, GShow (Rep a)) => a -> TS.Text-genericShow = toStrict . genericShowLazy---- | A 'Generic' implementation of 'T.showLazy'.--- --- /Since: 0.6/-genericShowLazy :: (Generic a, GShow (Rep a)) => a -> TL.Text-genericShowLazy = toLazyText . genericShowb---- | A 'Generic' implementation of 'T.showPrec'.--- --- /Since: 0.6/-genericShowPrec :: (Generic a, GShow (Rep a)) => Int -> a -> TS.Text-genericShowPrec p = toStrict . genericShowPrecLazy p---- | A 'Generic' implementation of 'T.showPrecLazy'.--- --- /Since: 0.6/-genericShowPrecLazy :: (Generic a, GShow (Rep a)) => Int -> a -> TL.Text-genericShowPrecLazy p = toLazyText . genericShowbPrec p---- | A 'Generic' implementation of 'T.showList'.--- --- /Since: 0.6/-genericShowList :: (Generic a, GShow (Rep a)) => [a] -> TS.Text-genericShowList = toStrict . genericShowListLazy---- | A 'Generic' implementation of 'T.showListLazy'.--- --- /Since: 0.6/-genericShowListLazy :: (Generic a, GShow (Rep a)) => [a] -> TL.Text-genericShowListLazy = toLazyText . genericShowbList---- | A 'Generic' implementation of 'T.showb'.--- --- /Since: 0.6/-genericShowb :: (Generic a, GShow (Rep a)) => a -> Builder-genericShowb = genericShowbPrec 0---- | A 'Generic' implementation of 'T.showbPrec'.--- --- /Since: 0.6/-genericShowbPrec :: (Generic a, GShow (Rep a)) => Int -> a -> Builder-genericShowbPrec p = gShowbPrec Pref p . from---- | A 'Generic' implementation of 'T.showbList'.--- --- /Since: 0.6/-genericShowbList :: (Generic a, GShow (Rep a)) => [a] -> Builder-genericShowbList = showbListWith genericShowb---- | A 'Generic' implementation of 'T.print'.--- --- /Since: 0.6/-genericPrint :: (Generic a, GShow (Rep a)) => a -> IO ()-genericPrint = TS.putStrLn . genericShow---- | A 'Generic' implementation of 'T.printLazy'.--- --- /Since: 0.6/-genericPrintLazy :: (Generic a, GShow (Rep a)) => a -> IO ()-genericPrintLazy = TL.putStrLn . genericShowLazy---- | A 'Generic' implementation of 'T.hPrint'.--- --- /Since: 0.6/-genericHPrint :: (Generic a, GShow (Rep a)) => Handle -> a -> IO ()-genericHPrint h = TS.hPutStrLn h . genericShow---- | A 'Generic' implementation of 'T.hPrintLazy'.--- --- /Since: 0.6/-genericHPrintLazy :: (Generic a, GShow (Rep a)) => Handle -> a -> IO ()-genericHPrintLazy h = TL.hPutStrLn h . genericShowLazy---- | Whether a constructor is a record ('Rec'), a tuple ('Tup'), is prefix ('Pref'),--- or infix ('Inf').--- --- /Since: 0.6/-data ConType = Rec | Tup | Pref | Inf Builder-  deriving ( Generic-           , S.Show-           , Typeable-#if MIN_VERSION_text(0,11,1)-           , Eq-           , Ord-#endif-           )--instance T.Show ConType where-    showbPrec = genericShowbPrec-    INLINE_INST_FUN(showbPrec)---- | Class of generic representation types ('Rep') that can be converted to--- a 'Builder'.--- --- /Since: 0.6/-class GShow f where-    -- This function is used as the default generic implementation of 'showbPrec'.-    gShowbPrec :: ConType -> Int -> f a -> Builder-    -- Whether a representation type has any constructors.-    isNullary  :: f a -> Bool-    isNullary = error "generic show (isNullary): unnecessary case"--#if __GLASGOW_HASKELL__ >= 708-deriving instance Typeable GShow-#endif--instance GShow U1 where-    gShowbPrec _ _ U1 = mempty-    isNullary _ = True--instance T.Show c => GShow (K1 i c) where-    gShowbPrec _ n (K1 a) = showbPrec n a-    isNullary _ = False--instance (Constructor c, GShow a) => GShow (M1 C c a) where-    gShowbPrec _ n c@(M1 x) = case fixity of-        Prefix -> showbParen (n > appPrec && not (isNullary x || conIsTuple c)) $-               (if (conIsTuple c) then mempty else fromString (conName c))-            <> (if (isNullary x || conIsTuple c) then mempty else s ' ')-            <> (showbBraces t (gShowbPrec t appPrec1 x))-        Infix _ m -> showbParen (n > m) . showbBraces t $ gShowbPrec t (m+1) x-      where-        fixity :: Fixity-        fixity = conFixity c-        -        t :: ConType-        t = if (conIsRecord c)-            then Rec-            else case conIsTuple c of-                True  -> Tup-                False -> case fixity of-                    Prefix    -> Pref-                    Infix _ _ -> Inf . fromString $ conName c-        -        showbBraces :: ConType -> Builder -> Builder-        showbBraces Rec     b = s '{' <> b <> s '}'-        showbBraces Tup     b = s '(' <> b <> s ')'-        showbBraces Pref    b = b-        showbBraces (Inf _) b = b-        -        conIsTuple :: M1 C c a b -> Bool-        conIsTuple = isTupleString . conName--instance (Selector s, GShow a) => GShow (M1 S s a) where-    gShowbPrec t n sel@(M1 x)-        | selName sel == "" = gShowbPrec t n x-        | otherwise         = fromString (selName sel) <> " = " <> gShowbPrec t 0 x-    isNullary (M1 x) = isNullary x--instance GShow a => GShow (M1 D d a) where-    gShowbPrec t n (M1 x) = gShowbPrec t n x--instance (GShow a, GShow b) => GShow (a :+: b) where-    gShowbPrec t n (L1 x) = gShowbPrec t n x-    gShowbPrec t n (R1 x) = gShowbPrec t n x--instance (GShow a, GShow b) => GShow (a :*: b) where-    gShowbPrec t@Rec _ (a :*: b) =-           gShowbPrec t 0 a-        <> ", "-        <> gShowbPrec t 0 b-    gShowbPrec t@(Inf o) n (a :*: b) =-           gShowbPrec t n a-        <> showbSpace-        <> infixOp-        <> showbSpace-        <> gShowbPrec t n b-      where-        infixOp :: Builder-        infixOp = if isInfixTypeCon (toString o)-                     then o-                     else s '`' <> o <> s '`'-    gShowbPrec t@Tup _ (a :*: b) =-           gShowbPrec t 0 a-        <> s ','-        <> gShowbPrec t 0 b-    gShowbPrec t@Pref n (a :*: b) =-           gShowbPrec t n a-        <> showbSpace-        <> gShowbPrec t n b-    -    -- If we have a product then it is not a nullary constructor-    isNullary _ = False+{-# LANGUAGE CPP                 #-}
+{-# LANGUAGE DeriveDataTypeable  #-}
+{-# LANGUAGE DeriveGeneric       #-}
+{-# LANGUAGE FlexibleContexts    #-}
+{-# LANGUAGE FlexibleInstances   #-}
+{-# LANGUAGE OverloadedStrings   #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeOperators       #-}
+#if __GLASGOW_HASKELL__ >= 708
+{-# LANGUAGE StandaloneDeriving #-}
+#endif
+{-|
+Module:      Text.Show.Text.Generic
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Generic versions of 'Show' class functions, as an alternative to "Text.Show.Text.TH",
+which uses Template Haskell. This module is only available if the compiler supports
+generics (on GHC, 7.2 or above).
+
+This implementation is based off of the @Generics.Deriving.Show@ module from the
+@generic-deriving@ library.
+
+/Since: 0.6/
+-}
+module Text.Show.Text.Generic (
+      -- * Generic @show@ functions
+      -- $generics
+      
+      -- ** Understanding a compiler error
+      -- $generic_err
+      genericShow
+    , genericShowLazy
+    , genericShowPrec
+    , genericShowPrecLazy
+    , genericShowList
+    , genericShowListLazy
+    , genericShowb
+    , genericShowbPrec
+    , genericShowbList
+    , genericPrint
+    , genericPrintLazy
+    , genericHPrint
+    , genericHPrintLazy
+      -- * The 'GShow' class
+    , GShow(..)
+    , ConType(..)
+    ) where
+
+#if !(MIN_VERSION_base(4,8,0))
+import           Data.Monoid (mempty)
+#endif
+import qualified Data.Text    as TS (Text)
+import qualified Data.Text.IO as TS (putStrLn, hPutStrLn)
+import           Data.Text.Lazy (toStrict)
+import           Data.Text.Lazy.Builder (Builder, fromString, toLazyText)
+import qualified Data.Text.Lazy    as TL (Text)
+import qualified Data.Text.Lazy.IO as TL (putStrLn, hPutStrLn)
+import           Data.Typeable (Typeable)
+
+import           GHC.Generics
+import           GHC.Show (appPrec, appPrec1)
+
+import           Prelude hiding (Show)
+
+import           System.IO (Handle)
+
+import qualified Text.Show as S (Show)
+import qualified Text.Show.Text.Classes as T
+import           Text.Show.Text.Classes (Show(showbPrec), showbListWith,
+                                         showbParen, showbSpace)
+import           Text.Show.Text.Instances ()
+import           Text.Show.Text.Utils ((<>), isInfixTypeCon, isTupleString,
+                                       s, toString)
+
+#include "inline.h"
+
+{- $generics
+
+'T.Show' instances can be easily defined for data types that are 'Generic' instances.
+The easiest way to do this is to use the @DeriveGeneric@ extension.
+
+@
+&#123;-&#35; LANGUAGE DeriveGeneric &#35;-&#125;
+import Text.Show.Text
+import Text.Show.Generic (genericShowbPrec)
+
+data D a = Nullary
+         | Unary Int
+         | Product String Char a
+         | Record { testOne   :: Double
+                  , testTwo   :: Bool
+                  , testThree :: D a
+                  }
+
+instance Show a => Show (D a) where
+    showbPrec = 'genericShowbPrec'
+@
+
+@D@ now has a 'T.Show' instance analogous to what would be generated by a
+@deriving Show@ clause.
+
+-}
+
+{- $generic_err
+
+Suppose you intend to tuse 'genericShowbPrec' to define a 'T.Show' instance.
+
+@
+data Oops = Oops
+    -- forgot to add \"deriving Generic\" here!
+
+instance Show Oops where
+    showbPrec = 'genericShowbPrec'
+@
+
+If you forget to add a @deriving 'Generic'@ clause to your data type, at
+compile-time, you will get an error message that begins roughly as follows:
+
+@
+No instance for ('GShow' (Rep Oops))
+@
+
+This error can be confusing, but don't let it intimidate you. The correct fix is
+simply to add the missing \"@deriving 'Generic'@\" clause.
+-}
+
+-- | A 'Generic' implementation of 'T.show'.
+-- 
+-- /Since: 0.6/
+genericShow :: (Generic a, GShow (Rep a)) => a -> TS.Text
+genericShow = toStrict . genericShowLazy
+
+-- | A 'Generic' implementation of 'T.showLazy'.
+-- 
+-- /Since: 0.6/
+genericShowLazy :: (Generic a, GShow (Rep a)) => a -> TL.Text
+genericShowLazy = toLazyText . genericShowb
+
+-- | A 'Generic' implementation of 'T.showPrec'.
+-- 
+-- /Since: 0.6/
+genericShowPrec :: (Generic a, GShow (Rep a)) => Int -> a -> TS.Text
+genericShowPrec p = toStrict . genericShowPrecLazy p
+
+-- | A 'Generic' implementation of 'T.showPrecLazy'.
+-- 
+-- /Since: 0.6/
+genericShowPrecLazy :: (Generic a, GShow (Rep a)) => Int -> a -> TL.Text
+genericShowPrecLazy p = toLazyText . genericShowbPrec p
+
+-- | A 'Generic' implementation of 'T.showList'.
+-- 
+-- /Since: 0.6/
+genericShowList :: (Generic a, GShow (Rep a)) => [a] -> TS.Text
+genericShowList = toStrict . genericShowListLazy
+
+-- | A 'Generic' implementation of 'T.showListLazy'.
+-- 
+-- /Since: 0.6/
+genericShowListLazy :: (Generic a, GShow (Rep a)) => [a] -> TL.Text
+genericShowListLazy = toLazyText . genericShowbList
+
+-- | A 'Generic' implementation of 'T.showb'.
+-- 
+-- /Since: 0.6/
+genericShowb :: (Generic a, GShow (Rep a)) => a -> Builder
+genericShowb = genericShowbPrec 0
+
+-- | A 'Generic' implementation of 'T.showbPrec'.
+-- 
+-- /Since: 0.6/
+genericShowbPrec :: (Generic a, GShow (Rep a)) => Int -> a -> Builder
+genericShowbPrec p = gShowbPrec Pref p . from
+
+-- | A 'Generic' implementation of 'T.showbList'.
+-- 
+-- /Since: 0.6/
+genericShowbList :: (Generic a, GShow (Rep a)) => [a] -> Builder
+genericShowbList = showbListWith genericShowb
+
+-- | A 'Generic' implementation of 'T.print'.
+-- 
+-- /Since: 0.6/
+genericPrint :: (Generic a, GShow (Rep a)) => a -> IO ()
+genericPrint = TS.putStrLn . genericShow
+
+-- | A 'Generic' implementation of 'T.printLazy'.
+-- 
+-- /Since: 0.6/
+genericPrintLazy :: (Generic a, GShow (Rep a)) => a -> IO ()
+genericPrintLazy = TL.putStrLn . genericShowLazy
+
+-- | A 'Generic' implementation of 'T.hPrint'.
+-- 
+-- /Since: 0.6/
+genericHPrint :: (Generic a, GShow (Rep a)) => Handle -> a -> IO ()
+genericHPrint h = TS.hPutStrLn h . genericShow
+
+-- | A 'Generic' implementation of 'T.hPrintLazy'.
+-- 
+-- /Since: 0.6/
+genericHPrintLazy :: (Generic a, GShow (Rep a)) => Handle -> a -> IO ()
+genericHPrintLazy h = TL.hPutStrLn h . genericShowLazy
+
+-- | Whether a constructor is a record ('Rec'), a tuple ('Tup'), is prefix ('Pref'),
+-- or infix ('Inf').
+-- 
+-- /Since: 0.6/
+data ConType = Rec | Tup | Pref | Inf Builder
+  deriving ( Generic
+           , S.Show
+           , Typeable
+#if MIN_VERSION_text(0,11,1)
+           , Eq
+           , Ord
+#endif
+           )
+
+instance T.Show ConType where
+    showbPrec = genericShowbPrec
+    INLINE_INST_FUN(showbPrec)
+
+-- | Class of generic representation types ('Rep') that can be converted to
+-- a 'Builder'.
+-- 
+-- /Since: 0.6/
+class GShow f where
+    -- This function is used as the default generic implementation of 'showbPrec'.
+    gShowbPrec :: ConType -> Int -> f a -> Builder
+    -- Whether a representation type has any constructors.
+    isNullary  :: f a -> Bool
+    isNullary = error "generic show (isNullary): unnecessary case"
+
+#if __GLASGOW_HASKELL__ >= 708
+deriving instance Typeable GShow
+#endif
+
+instance GShow U1 where
+    gShowbPrec _ _ U1 = mempty
+    isNullary _ = True
+
+instance T.Show c => GShow (K1 i c) where
+    gShowbPrec _ n (K1 a) = showbPrec n a
+    isNullary _ = False
+
+instance (Constructor c, GShow a) => GShow (M1 C c a) where
+    gShowbPrec _ n c@(M1 x) = case fixity of
+        Prefix -> showbParen (n > appPrec && not (isNullary x || conIsTuple c)) $
+               (if (conIsTuple c) then mempty else fromString (conName c))
+            <> (if (isNullary x || conIsTuple c) then mempty else s ' ')
+            <> (showbBraces t (gShowbPrec t appPrec1 x))
+        Infix _ m -> showbParen (n > m) . showbBraces t $ gShowbPrec t (m+1) x
+      where
+        fixity :: Fixity
+        fixity = conFixity c
+        
+        t :: ConType
+        t = if (conIsRecord c)
+            then Rec
+            else case conIsTuple c of
+                True  -> Tup
+                False -> case fixity of
+                    Prefix    -> Pref
+                    Infix _ _ -> Inf . fromString $ conName c
+        
+        showbBraces :: ConType -> Builder -> Builder
+        showbBraces Rec     b = s '{' <> b <> s '}'
+        showbBraces Tup     b = s '(' <> b <> s ')'
+        showbBraces Pref    b = b
+        showbBraces (Inf _) b = b
+        
+        conIsTuple :: M1 C c a b -> Bool
+        conIsTuple = isTupleString . conName
+
+instance (Selector s, GShow a) => GShow (M1 S s a) where
+    gShowbPrec t n sel@(M1 x)
+        | selName sel == "" = gShowbPrec t n x
+        | otherwise         = fromString (selName sel) <> " = " <> gShowbPrec t 0 x
+    isNullary (M1 x) = isNullary x
+
+instance GShow a => GShow (M1 D d a) where
+    gShowbPrec t n (M1 x) = gShowbPrec t n x
+
+instance (GShow a, GShow b) => GShow (a :+: b) where
+    gShowbPrec t n (L1 x) = gShowbPrec t n x
+    gShowbPrec t n (R1 x) = gShowbPrec t n x
+
+instance (GShow a, GShow b) => GShow (a :*: b) where
+    gShowbPrec t@Rec _ (a :*: b) =
+           gShowbPrec t 0 a
+        <> ", "
+        <> gShowbPrec t 0 b
+    gShowbPrec t@(Inf o) n (a :*: b) =
+           gShowbPrec t n a
+        <> showbSpace
+        <> infixOp
+        <> showbSpace
+        <> gShowbPrec t n b
+      where
+        infixOp :: Builder
+        infixOp = if isInfixTypeCon (toString o)
+                     then o
+                     else s '`' <> o <> s '`'
+    gShowbPrec t@Tup _ (a :*: b) =
+           gShowbPrec t 0 a
+        <> s ','
+        <> gShowbPrec t 0 b
+    gShowbPrec t@Pref n (a :*: b) =
+           gShowbPrec t n a
+        <> showbSpace
+        <> gShowbPrec t n b
+    
+    -- If we have a product then it is not a nullary constructor
+    isNullary _ = False
src/Text/Show/Text/Instances.hs view
@@ -1,19 +1,19 @@-{-|-Module:      Text.Show.Text.Instances-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Imports 'Show' instances for all data types covered by @text-show@.--}-module Text.Show.Text.Instances () where--import Text.Show.Text.Control ()-import Text.Show.Text.Data    ()-import Text.Show.Text.Foreign ()-import Text.Show.Text.GHC     ()-import Text.Show.Text.Numeric ()-import Text.Show.Text.System  ()-import Text.Show.Text.Text    ()+{-|
+Module:      Text.Show.Text.Instances
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Imports 'Show' instances for all data types covered by @text-show@.
+-}
+module Text.Show.Text.Instances () where
+
+import Text.Show.Text.Control ()
+import Text.Show.Text.Data    ()
+import Text.Show.Text.Foreign ()
+import Text.Show.Text.GHC     ()
+import Text.Show.Text.Numeric ()
+import Text.Show.Text.System  ()
+import Text.Show.Text.Text    ()
src/Text/Show/Text/Numeric.hs view
@@ -1,13 +1,13 @@-{-|-Module:      Text.Show.Text.Numeric-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Imports 'Show' instances for @Numeric@ modules.--}-module Text.Show.Text.Numeric () where--import Text.Show.Text.Numeric.Natural ()+{-|
+Module:      Text.Show.Text.Numeric
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Imports 'Show' instances for @Numeric@ modules.
+-}
+module Text.Show.Text.Numeric () where
+
+import Text.Show.Text.Numeric.Natural ()
src/Text/Show/Text/Numeric/Natural.hs view
@@ -1,53 +1,53 @@-{-# LANGUAGE CPP       #-}-#if MIN_VERSION_base(4,8,0)-{-# LANGUAGE MagicHash #-}-#endif-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Numeric.Natural-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Natural's.--/Since: 0.5/--}-module Text.Show.Text.Numeric.Natural (showbNaturalPrec) where--import Data.Text.Lazy.Builder (Builder)--#if MIN_VERSION_base(4,8,0)-import GHC.Integer.GMP.Internals (Integer(..))-import GHC.Natural (Natural(..))-import GHC.Types (Word(..))--import Text.Show.Text.Data.Integral (showbWord)-#else-import Numeric.Natural (Natural)-#endif--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec))-import Text.Show.Text.Data.Integral (showbIntegerPrec)--#include "inline.h"---- | Convert a 'Natural' to a 'Builder' with the given precedence.--- --- /Since: 0.5/-showbNaturalPrec :: Int -> Natural -> Builder-#if MIN_VERSION_base(4,8,0)-showbNaturalPrec _ (NatS# w#)  = showbWord $ W# w#-showbNaturalPrec p (NatJ# bn)  = showbIntegerPrec p $ Jp# bn-#else-showbNaturalPrec p             = showbIntegerPrec p . toInteger-{-# INLINE showbNaturalPrec #-}-#endif--instance Show Natural where-    showbPrec = showbNaturalPrec-    INLINE_INST_FUN(showbPrec)+{-# LANGUAGE CPP       #-}
+#if MIN_VERSION_base(4,8,0)
+{-# LANGUAGE MagicHash #-}
+#endif
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Numeric.Natural
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Natural's.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Numeric.Natural (showbNaturalPrec) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+#if MIN_VERSION_base(4,8,0)
+import GHC.Integer.GMP.Internals (Integer(..))
+import GHC.Natural (Natural(..))
+import GHC.Types (Word(..))
+
+import Text.Show.Text.Data.Integral (showbWord)
+#else
+import Numeric.Natural (Natural)
+#endif
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec))
+import Text.Show.Text.Data.Integral (showbIntegerPrec)
+
+#include "inline.h"
+
+-- | Convert a 'Natural' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.5/
+showbNaturalPrec :: Int -> Natural -> Builder
+#if MIN_VERSION_base(4,8,0)
+showbNaturalPrec _ (NatS# w#)  = showbWord $ W# w#
+showbNaturalPrec p (NatJ# bn)  = showbIntegerPrec p $ Jp# bn
+#else
+showbNaturalPrec p             = showbIntegerPrec p . toInteger
+{-# INLINE showbNaturalPrec #-}
+#endif
+
+instance Show Natural where
+    showbPrec = showbNaturalPrec
+    INLINE_INST_FUN(showbPrec)
src/Text/Show/Text/System.hs view
@@ -1,15 +1,15 @@-{-|-Module:      Text.Show.Text.System-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Imports 'Show' instances for @System@ modules.--}-module Text.Show.Text.System () where --import Text.Show.Text.System.Exit        ()-import Text.Show.Text.System.IO          ()+{-|
+Module:      Text.Show.Text.System
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Imports 'Show' instances for @System@ modules.
+-}
+module Text.Show.Text.System () where 
+
+import Text.Show.Text.System.Exit        ()
+import Text.Show.Text.System.IO          ()
 import Text.Show.Text.System.Posix.Types ()
src/Text/Show/Text/System/Exit.hs view
@@ -1,32 +1,32 @@-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.System.Exit-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'ExitCode'.--/Since: 0.3/--}-module Text.Show.Text.System.Exit (showbExitCodePrec) where--import Data.Text.Lazy.Builder (Builder)--import System.Exit (ExitCode)--import Text.Show.Text.Classes (showbPrec)-import Text.Show.Text.Data.Integral ()-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)---- | Convert an 'ExitCode' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbExitCodePrec :: Int -> ExitCode -> Builder-showbExitCodePrec = showbPrec-{-# INLINE showbExitCodePrec #-}-+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.System.Exit
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'ExitCode'.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.System.Exit (showbExitCodePrec) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import System.Exit (ExitCode)
+
+import Text.Show.Text.Classes (showbPrec)
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)
+
+-- | Convert an 'ExitCode' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbExitCodePrec :: Int -> ExitCode -> Builder
+showbExitCodePrec = showbPrec
+{-# INLINE showbExitCodePrec #-}
+
 $(deriveShowPragmas defaultInlineShowbPrec ''ExitCode)
src/Text/Show/Text/System/IO.hs view
@@ -1,168 +1,168 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell   #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.System.IO-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'IO'-related data types.--/Since: 0.3/--}-module Text.Show.Text.System.IO (-      showbHandle-    , showbIOMode-    , showbBufferModePrec-    , showbHandlePosn-    , showbSeekMode-#if MIN_VERSION_base(4,3,0)-    , showbTextEncoding-#endif-#if MIN_VERSION_base(4,4,0)-    , showbCodingProgress-    , showbCodingFailureMode-#endif-    , showbNewline-    , showbNewlineModePrec-    ) where--import Data.Text.Lazy.Builder (Builder, fromString)--#include "inline.h"--#if MIN_VERSION_base(4,3,0)-import GHC.IO.Encoding.Types (TextEncoding(textEncodingName))-#endif-#if MIN_VERSION_base(4,4,0)-import GHC.IO.Encoding.Failure (CodingFailureMode)-import GHC.IO.Encoding.Types (CodingProgress)-#endif-import GHC.IO.Handle (HandlePosn(..))-import GHC.IO.Handle.Types (Handle(..))--import Prelude hiding (Show)--import System.IO (BufferMode, IOMode, Newline, NewlineMode, SeekMode)--import Text.Show.Text.Classes (Show(showb, showbPrec))-import Text.Show.Text.Data.Integral (showbIntegerPrec)-import Text.Show.Text.Data.Maybe ()-import Text.Show.Text.TH.Internal (deriveShow, deriveShowPragmas,-                                   defaultInlineShowb, defaultInlineShowbPrec)-import Text.Show.Text.Utils ((<>), s)---- | Convert a 'Handle' to a 'Builder'.--- --- /Since: 0.3/-showbHandle :: Handle -> Builder-showbHandle (FileHandle   file _)   = showbHandleFilePath file-showbHandle (DuplexHandle file _ _) = showbHandleFilePath file-{-# INLINE showbHandle #-}---- | Convert a 'Handle`'s 'FilePath' to a 'Builder'.-showbHandleFilePath :: FilePath -> Builder-showbHandleFilePath file = "{handle: " <> fromString file <> s '}'-{-# INLINE showbHandleFilePath #-}---- | Convert an 'IOMode' to a 'Builder'.--- --- /Since: 0.3/-showbIOMode :: IOMode -> Builder-showbIOMode = showb-{-# INLINE showbIOMode #-}---- | Convert a 'BufferMode' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbBufferModePrec :: Int -> BufferMode -> Builder-showbBufferModePrec = showbPrec-{-# INLINE showbBufferModePrec #-}---- | Convert a 'HandlePosn' to a 'Builder'.--- --- /Since: 0.3/-showbHandlePosn :: HandlePosn -> Builder-showbHandlePosn (HandlePosn h pos)-    = showbHandle h <> " at position " <> showbIntegerPrec 0 pos-{-# INLINE showbHandlePosn #-}---- | Convert a 'SeekMode' to a 'Builder'.--- --- /Since: 0.3/-showbSeekMode :: SeekMode -> Builder-showbSeekMode = showb-{-# INLINE showbSeekMode #-}--#if MIN_VERSION_base(4,3,0)--- | Convert a 'TextEncoding' to a 'Builder'.--- This function is only available with @base-4.3.0.0@ or later.--- --- /Since: 0.3/-showbTextEncoding :: TextEncoding -> Builder-showbTextEncoding = fromString . textEncodingName-{-# INLINE showbTextEncoding #-}-#endif--#if MIN_VERSION_base(4,4,0)--- | Convert a 'CodingProgress' to a 'Builder'.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbCodingProgress :: CodingProgress -> Builder-showbCodingProgress = showb-{-# INLINE showbCodingProgress #-}---- | Convert a 'CodingFailureMode' value to a 'Builder'.--- This function is only available with @base-4.4.0.0@ or later.--- --- /Since: 0.3/-showbCodingFailureMode :: CodingFailureMode -> Builder-showbCodingFailureMode = showb-{-# INLINE showbCodingFailureMode #-}-#endif---- | Convert a 'Newline' to a 'Builder'.--- --- /Since: 0.3/-showbNewline :: Newline -> Builder-showbNewline = showb-{-# INLINE showbNewline #-}---- | Convert a 'NewlineMode' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbNewlineModePrec :: Int -> NewlineMode -> Builder-showbNewlineModePrec = showbPrec-{-# INLINE showbNewlineModePrec #-}--instance Show Handle where-    showb = showbHandle-    INLINE_INST_FUN(showb)--$(deriveShowPragmas defaultInlineShowb     ''IOMode)-$(deriveShow                               ''BufferMode)--instance Show HandlePosn where-    showb = showbHandlePosn-    INLINE_INST_FUN(showb)--$(deriveShowPragmas defaultInlineShowb     ''SeekMode)--#if MIN_VERSION_base(4,3,0)-instance Show TextEncoding where-    showb = showbTextEncoding-    INLINE_INST_FUN(showb)-#endif--#if MIN_VERSION_base(4,4,0)-$(deriveShowPragmas defaultInlineShowb     ''CodingProgress)-$(deriveShowPragmas defaultInlineShowb     ''CodingFailureMode)-#endif--$(deriveShowPragmas defaultInlineShowb     ''Newline)-$(deriveShowPragmas defaultInlineShowbPrec ''NewlineMode)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell   #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.System.IO
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'IO'-related data types.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.System.IO (
+      showbHandle
+    , showbIOMode
+    , showbBufferModePrec
+    , showbHandlePosn
+    , showbSeekMode
+#if MIN_VERSION_base(4,3,0)
+    , showbTextEncoding
+#endif
+#if MIN_VERSION_base(4,4,0)
+    , showbCodingProgress
+    , showbCodingFailureMode
+#endif
+    , showbNewline
+    , showbNewlineModePrec
+    ) where
+
+import Data.Text.Lazy.Builder (Builder, fromString)
+
+#include "inline.h"
+
+#if MIN_VERSION_base(4,3,0)
+import GHC.IO.Encoding.Types (TextEncoding(textEncodingName))
+#endif
+#if MIN_VERSION_base(4,4,0)
+import GHC.IO.Encoding.Failure (CodingFailureMode)
+import GHC.IO.Encoding.Types (CodingProgress)
+#endif
+import GHC.IO.Handle (HandlePosn(..))
+import GHC.IO.Handle.Types (Handle(..))
+
+import Prelude hiding (Show)
+
+import System.IO (BufferMode, IOMode, Newline, NewlineMode, SeekMode)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec))
+import Text.Show.Text.Data.Integral (showbIntegerPrec)
+import Text.Show.Text.Data.Maybe ()
+import Text.Show.Text.TH.Internal (deriveShow, deriveShowPragmas,
+                                   defaultInlineShowb, defaultInlineShowbPrec)
+import Text.Show.Text.Utils ((<>), s)
+
+-- | Convert a 'Handle' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbHandle :: Handle -> Builder
+showbHandle (FileHandle   file _)   = showbHandleFilePath file
+showbHandle (DuplexHandle file _ _) = showbHandleFilePath file
+{-# INLINE showbHandle #-}
+
+-- | Convert a 'Handle`'s 'FilePath' to a 'Builder'.
+showbHandleFilePath :: FilePath -> Builder
+showbHandleFilePath file = "{handle: " <> fromString file <> s '}'
+{-# INLINE showbHandleFilePath #-}
+
+-- | Convert an 'IOMode' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbIOMode :: IOMode -> Builder
+showbIOMode = showb
+{-# INLINE showbIOMode #-}
+
+-- | Convert a 'BufferMode' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbBufferModePrec :: Int -> BufferMode -> Builder
+showbBufferModePrec = showbPrec
+{-# INLINE showbBufferModePrec #-}
+
+-- | Convert a 'HandlePosn' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbHandlePosn :: HandlePosn -> Builder
+showbHandlePosn (HandlePosn h pos)
+    = showbHandle h <> " at position " <> showbIntegerPrec 0 pos
+{-# INLINE showbHandlePosn #-}
+
+-- | Convert a 'SeekMode' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbSeekMode :: SeekMode -> Builder
+showbSeekMode = showb
+{-# INLINE showbSeekMode #-}
+
+#if MIN_VERSION_base(4,3,0)
+-- | Convert a 'TextEncoding' to a 'Builder'.
+-- This function is only available with @base-4.3.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbTextEncoding :: TextEncoding -> Builder
+showbTextEncoding = fromString . textEncodingName
+{-# INLINE showbTextEncoding #-}
+#endif
+
+#if MIN_VERSION_base(4,4,0)
+-- | Convert a 'CodingProgress' to a 'Builder'.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbCodingProgress :: CodingProgress -> Builder
+showbCodingProgress = showb
+{-# INLINE showbCodingProgress #-}
+
+-- | Convert a 'CodingFailureMode' value to a 'Builder'.
+-- This function is only available with @base-4.4.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbCodingFailureMode :: CodingFailureMode -> Builder
+showbCodingFailureMode = showb
+{-# INLINE showbCodingFailureMode #-}
+#endif
+
+-- | Convert a 'Newline' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbNewline :: Newline -> Builder
+showbNewline = showb
+{-# INLINE showbNewline #-}
+
+-- | Convert a 'NewlineMode' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbNewlineModePrec :: Int -> NewlineMode -> Builder
+showbNewlineModePrec = showbPrec
+{-# INLINE showbNewlineModePrec #-}
+
+instance Show Handle where
+    showb = showbHandle
+    INLINE_INST_FUN(showb)
+
+$(deriveShowPragmas defaultInlineShowb     ''IOMode)
+$(deriveShow                               ''BufferMode)
+
+instance Show HandlePosn where
+    showb = showbHandlePosn
+    INLINE_INST_FUN(showb)
+
+$(deriveShowPragmas defaultInlineShowb     ''SeekMode)
+
+#if MIN_VERSION_base(4,3,0)
+instance Show TextEncoding where
+    showb = showbTextEncoding
+    INLINE_INST_FUN(showb)
+#endif
+
+#if MIN_VERSION_base(4,4,0)
+$(deriveShowPragmas defaultInlineShowb     ''CodingProgress)
+$(deriveShowPragmas defaultInlineShowb     ''CodingFailureMode)
+#endif
+
+$(deriveShowPragmas defaultInlineShowb     ''Newline)
+$(deriveShowPragmas defaultInlineShowbPrec ''NewlineMode)
src/Text/Show/Text/System/Posix/Types.hs view
@@ -1,399 +1,399 @@-{-# LANGUAGE CPP                        #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-#if !(MIN_VERSION_base(4,5,0))-{-# LANGUAGE MagicHash                  #-}-#endif-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.System.Posix.Types-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' functions for Haskell equivalents of POSIX data types.-Note that these functions are only available if the operating system supports them,-so some OSes (e.g., Windows) will not be able to use all of the functions in this-module.--/Since: 0.3/--}-#include "HsBaseConfig.h"--module Text.Show.Text.System.Posix.Types (-      showbFdPrec-#if defined(HTYPE_DEV_T)-    , showbCDev-#endif-#if defined(HTYPE_INO_T)-    , showbCIno-#endif-#if defined(HTYPE_MODE_T)-    , showbCMode-#endif-#if defined(HTYPE_OFF_T)-    , showbCOffPrec-#endif-#if defined(HTYPE_PID_T)-    , showbCPidPrec-#endif-#if defined(HTYPE_SSIZE_T)-    , showbCSsizePrec-#endif-#if defined(HTYPE_GID_T)-    , showbCGid-#endif-#if defined(HTYPE_NLINK_T)-    , showbCNlink-#endif-#if defined(HTYPE_UID_T)-    , showbCUid-#endif-#if defined(HTYPE_CC_T)-    , showbCCc-#endif-#if defined(HTYPE_SPEED_T)-    , showbCSpeed-#endif-#if defined(HTYPE_TCFLAG_T)-    , showbCTcflag-#endif-#if defined(HTYPE_RLIM_T)-    , showbCRLim-#endif-    ) where--import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import System.Posix.Types--import Text.Show.Text.Classes (Show(showb, showbPrec))-import Text.Show.Text.Data.Integral ()-import Text.Show.Text.Foreign.C.Types ()--#if !(MIN_VERSION_base(4,5,0))-import GHC.Prim (unsafeCoerce#)--import Text.Show.Text.Data.Integral ( showbInt32Prec-                                    , showbInt64Prec-                                    , showbWord8-                                    , showbWord32-                                    , showbWord64-                                    )--# include "inline.h"-#endif--#if defined(HTYPE_DEV_T)--- | Convert a 'CDev' to a 'Builder'.--- --- /Since: 0.3/-showbCDev :: CDev -> Builder-# if MIN_VERSION_base(4,5,0)-showbCDev = showb-{-# INLINE showbCDev #-}-# else-showbCDev c = showbWord64 $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_INO_T)--- | Convert a 'CIno' to a 'Builder'.--- --- /Since: 0.3/-showbCIno :: CIno -> Builder-# if MIN_VERSION_base(4,5,0)-showbCIno = showb-{-# INLINE showbCIno #-}-# else-showbCIno c = showbWord64 $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_MODE_T)--- | Convert a 'CMode' to a 'Builder'.--- --- /Since: 0.3/-showbCMode :: CMode -> Builder-# if MIN_VERSION_base(4,5,0)-showbCMode = showb-{-# INLINE showbCMode #-}-# else-showbCMode c = showbWord32 $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_OFF_T)--- | Convert a 'COff' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCOffPrec :: Int -> COff -> Builder-# if MIN_VERSION_base(4,5,0)-showbCOffPrec = showbPrec-{-# INLINE showbCOffPrec #-}-# else-showbCOffPrec p c = showbInt64Prec p $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_PID_T)--- | Convert a 'CPid' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCPidPrec :: Int -> CPid -> Builder-# if MIN_VERSION_base(4,5,0)-showbCPidPrec = showbPrec-{-# INLINE showbCPidPrec #-}-# else-showbCPidPrec p c = showbInt32Prec p $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_SSIZE_T)--- | Convert a 'CSsize' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbCSsizePrec :: Int -> CSsize -> Builder-# if MIN_VERSION_base(4,5,0)-showbCSsizePrec = showbPrec-{-# INLINE showbCSsizePrec #-}-# else-showbCSsizePrec p c = showbInt32Prec p $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_GID_T)--- | Convert a 'CGid' to a 'Builder'.--- --- /Since: 0.3/-showbCGid :: CGid -> Builder-# if MIN_VERSION_base(4,5,0)-showbCGid = showb-{-# INLINE showbCGid #-}-# else-showbCGid c = showbWord32 $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_NLINK_T)--- | Convert a 'CNlink' to a 'Builder'.--- --- /Since: 0.3/-showbCNlink :: CNlink -> Builder-# if MIN_VERSION_base(4,5,0)-showbCNlink = showb-{-# INLINE showbCNlink #-}-# else-showbCNlink c = showbWord32 $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_UID_T)--- | Convert a 'CUid' to a 'Builder'.--- --- /Since: 0.3/-showbCUid :: CUid -> Builder-# if MIN_VERSION_base(4,5,0)-showbCUid = showb-{-# INLINE showbCUid #-}-# else-showbCUid c = showbWord32 $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_CC_T)--- | Convert a 'CCc' to a 'Builder'.--- --- /Since: 0.3/-showbCCc :: CCc -> Builder-# if MIN_VERSION_base(4,5,0)-showbCCc = showb-{-# INLINE showbCCc #-}-# else-showbCCc c = showbWord8 $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_SPEED_T)--- | Convert a 'CSpeed' to a 'Builder'.--- --- /Since: 0.3/-showbCSpeed :: CSpeed -> Builder-# if MIN_VERSION_base(4,5,0)-showbCSpeed = showb-{-# INLINE showbCSpeed #-}-# else-showbCSpeed c = showbWord32 $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_TCFLAG_T)--- | Convert a 'CTcflag' to a 'Builder'.--- --- /Since: 0.3/-showbCTcflag :: CTcflag -> Builder-# if MIN_VERSION_base(4,5,0)-showbCTcflag = showb-{-# INLINE showbCTcflag #-}-# else-showbCTcflag c = showbWord32 $ unsafeCoerce# c-# endif-#endif--#if defined(HTYPE_RLIM_T)--- | Convert a 'CRLim' to a 'Builder'.--- --- /Since: 0.3/-showbCRLim :: CRLim -> Builder-# if MIN_VERSION_base(4,5,0)-showbCRLim = showb-{-# INLINE showbCRLim #-}-# else-showbCRLim c = showbWord64 $ unsafeCoerce# c-# endif-#endif---- | Convert an 'Fd' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbFdPrec :: Int -> Fd -> Builder-showbFdPrec = showbPrec-{-# INLINE showbFdPrec #-}--#if MIN_VERSION_base(4,5,0)-# if defined(HTYPE_DEV_T)-deriving instance Show CDev-# endif--# if defined(HTYPE_INO_T)-deriving instance Show CIno-# endif--# if defined(HTYPE_MODE_T)-deriving instance Show CMode-# endif--# if defined(HTYPE_OFF_T)-deriving instance Show COff-# endif--# if defined(HTYPE_PID_T)-deriving instance Show CPid-# endif--# if defined(HTYPE_SSIZE_T)-deriving instance Show CSsize-# endif--# if defined(HTYPE_GID_T)-deriving instance Show CGid-# endif--# if defined(HTYPE_NLINK_T)-deriving instance Show CNlink-# endif--# if defined(HTYPE_UID_T)-deriving instance Show CUid-# endif--# if defined(HTYPE_CC_T)-deriving instance Show CCc-# endif--# if defined(HTYPE_SPEED_T)-deriving instance Show CSpeed-# endif--# if defined(HTYPE_TCFLAG_T)-deriving instance Show CTcflag-# endif--# if defined(HTYPE_RLIM_T)-deriving instance Show CRLim-# endif-#else-# if defined(HTYPE_DEV_T)-instance Show CDev where-    showb = showbCDev-    INLINE_INST_FUN(showb)-# endif--# if defined(HTYPE_INO_T)-instance Show CIno where-    showb = showbCIno-    INLINE_INST_FUN(showb)-# endif--# if defined(HTYPE_MODE_T)-instance Show CMode where-    showb = showbCMode-    INLINE_INST_FUN(showb)-# endif--# if defined(HTYPE_OFF_T)-instance Show COff where-    showbPrec = showbCOffPrec-    INLINE_INST_FUN(showbPrec)-# endif--# if defined(HTYPE_PID_T)-instance Show CPid where-    showbPrec = showbCPidPrec-    INLINE_INST_FUN(showbPrec)-# endif--# if defined(HTYPE_SSIZE_T)-instance Show CSsize where-    showbPrec = showbCSsizePrec-    INLINE_INST_FUN(showbPrec)-# endif--# if defined(HTYPE_GID_T)-instance Show CGid where-    showb = showbCGid-    INLINE_INST_FUN(showb)-# endif--# if defined(HTYPE_NLINK_T)-instance Show CNlink where-    showb = showbCNlink-    INLINE_INST_FUN(showb)-# endif--# if defined(HTYPE_UID_T)-instance Show CUid where-    showb = showbCUid-    INLINE_INST_FUN(showb)-# endif--# if defined(HTYPE_CC_T)-instance Show CCc where-    showb = showbCCc-    INLINE_INST_FUN(showb)-# endif--# if defined(HTYPE_SPEED_T)-instance Show CSpeed where-    showb = showbCSpeed-    INLINE_INST_FUN(showb)-# endif--# if defined(HTYPE_TCFLAG_T)-instance Show CTcflag where-    showb = showbCTcflag-    INLINE_INST_FUN(showb)-# endif--# if defined(HTYPE_RLIM_T)-instance Show CRLim where-    showb = showbCRLim-    INLINE_INST_FUN(showb)-# endif-#endif--deriving instance Show Fd+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+#if !(MIN_VERSION_base(4,5,0))
+{-# LANGUAGE MagicHash                  #-}
+#endif
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.System.Posix.Types
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' functions for Haskell equivalents of POSIX data types.
+Note that these functions are only available if the operating system supports them,
+so some OSes (e.g., Windows) will not be able to use all of the functions in this
+module.
+
+/Since: 0.3/
+-}
+#include "HsBaseConfig.h"
+
+module Text.Show.Text.System.Posix.Types (
+      showbFdPrec
+#if defined(HTYPE_DEV_T)
+    , showbCDev
+#endif
+#if defined(HTYPE_INO_T)
+    , showbCIno
+#endif
+#if defined(HTYPE_MODE_T)
+    , showbCMode
+#endif
+#if defined(HTYPE_OFF_T)
+    , showbCOffPrec
+#endif
+#if defined(HTYPE_PID_T)
+    , showbCPidPrec
+#endif
+#if defined(HTYPE_SSIZE_T)
+    , showbCSsizePrec
+#endif
+#if defined(HTYPE_GID_T)
+    , showbCGid
+#endif
+#if defined(HTYPE_NLINK_T)
+    , showbCNlink
+#endif
+#if defined(HTYPE_UID_T)
+    , showbCUid
+#endif
+#if defined(HTYPE_CC_T)
+    , showbCCc
+#endif
+#if defined(HTYPE_SPEED_T)
+    , showbCSpeed
+#endif
+#if defined(HTYPE_TCFLAG_T)
+    , showbCTcflag
+#endif
+#if defined(HTYPE_RLIM_T)
+    , showbCRLim
+#endif
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import System.Posix.Types
+
+import Text.Show.Text.Classes (Show(showb, showbPrec))
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.Foreign.C.Types ()
+
+#if !(MIN_VERSION_base(4,5,0))
+import GHC.Prim (unsafeCoerce#)
+
+import Text.Show.Text.Data.Integral ( showbInt32Prec
+                                    , showbInt64Prec
+                                    , showbWord8
+                                    , showbWord32
+                                    , showbWord64
+                                    )
+
+# include "inline.h"
+#endif
+
+#if defined(HTYPE_DEV_T)
+-- | Convert a 'CDev' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCDev :: CDev -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCDev = showb
+{-# INLINE showbCDev #-}
+# else
+showbCDev c = showbWord64 $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_INO_T)
+-- | Convert a 'CIno' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCIno :: CIno -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCIno = showb
+{-# INLINE showbCIno #-}
+# else
+showbCIno c = showbWord64 $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_MODE_T)
+-- | Convert a 'CMode' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCMode :: CMode -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCMode = showb
+{-# INLINE showbCMode #-}
+# else
+showbCMode c = showbWord32 $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_OFF_T)
+-- | Convert a 'COff' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCOffPrec :: Int -> COff -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCOffPrec = showbPrec
+{-# INLINE showbCOffPrec #-}
+# else
+showbCOffPrec p c = showbInt64Prec p $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_PID_T)
+-- | Convert a 'CPid' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCPidPrec :: Int -> CPid -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCPidPrec = showbPrec
+{-# INLINE showbCPidPrec #-}
+# else
+showbCPidPrec p c = showbInt32Prec p $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_SSIZE_T)
+-- | Convert a 'CSsize' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbCSsizePrec :: Int -> CSsize -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCSsizePrec = showbPrec
+{-# INLINE showbCSsizePrec #-}
+# else
+showbCSsizePrec p c = showbInt32Prec p $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_GID_T)
+-- | Convert a 'CGid' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCGid :: CGid -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCGid = showb
+{-# INLINE showbCGid #-}
+# else
+showbCGid c = showbWord32 $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_NLINK_T)
+-- | Convert a 'CNlink' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCNlink :: CNlink -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCNlink = showb
+{-# INLINE showbCNlink #-}
+# else
+showbCNlink c = showbWord32 $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_UID_T)
+-- | Convert a 'CUid' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCUid :: CUid -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCUid = showb
+{-# INLINE showbCUid #-}
+# else
+showbCUid c = showbWord32 $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_CC_T)
+-- | Convert a 'CCc' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCCc :: CCc -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCCc = showb
+{-# INLINE showbCCc #-}
+# else
+showbCCc c = showbWord8 $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_SPEED_T)
+-- | Convert a 'CSpeed' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCSpeed :: CSpeed -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCSpeed = showb
+{-# INLINE showbCSpeed #-}
+# else
+showbCSpeed c = showbWord32 $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_TCFLAG_T)
+-- | Convert a 'CTcflag' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCTcflag :: CTcflag -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCTcflag = showb
+{-# INLINE showbCTcflag #-}
+# else
+showbCTcflag c = showbWord32 $ unsafeCoerce# c
+# endif
+#endif
+
+#if defined(HTYPE_RLIM_T)
+-- | Convert a 'CRLim' to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbCRLim :: CRLim -> Builder
+# if MIN_VERSION_base(4,5,0)
+showbCRLim = showb
+{-# INLINE showbCRLim #-}
+# else
+showbCRLim c = showbWord64 $ unsafeCoerce# c
+# endif
+#endif
+
+-- | Convert an 'Fd' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbFdPrec :: Int -> Fd -> Builder
+showbFdPrec = showbPrec
+{-# INLINE showbFdPrec #-}
+
+#if MIN_VERSION_base(4,5,0)
+# if defined(HTYPE_DEV_T)
+deriving instance Show CDev
+# endif
+
+# if defined(HTYPE_INO_T)
+deriving instance Show CIno
+# endif
+
+# if defined(HTYPE_MODE_T)
+deriving instance Show CMode
+# endif
+
+# if defined(HTYPE_OFF_T)
+deriving instance Show COff
+# endif
+
+# if defined(HTYPE_PID_T)
+deriving instance Show CPid
+# endif
+
+# if defined(HTYPE_SSIZE_T)
+deriving instance Show CSsize
+# endif
+
+# if defined(HTYPE_GID_T)
+deriving instance Show CGid
+# endif
+
+# if defined(HTYPE_NLINK_T)
+deriving instance Show CNlink
+# endif
+
+# if defined(HTYPE_UID_T)
+deriving instance Show CUid
+# endif
+
+# if defined(HTYPE_CC_T)
+deriving instance Show CCc
+# endif
+
+# if defined(HTYPE_SPEED_T)
+deriving instance Show CSpeed
+# endif
+
+# if defined(HTYPE_TCFLAG_T)
+deriving instance Show CTcflag
+# endif
+
+# if defined(HTYPE_RLIM_T)
+deriving instance Show CRLim
+# endif
+#else
+# if defined(HTYPE_DEV_T)
+instance Show CDev where
+    showb = showbCDev
+    INLINE_INST_FUN(showb)
+# endif
+
+# if defined(HTYPE_INO_T)
+instance Show CIno where
+    showb = showbCIno
+    INLINE_INST_FUN(showb)
+# endif
+
+# if defined(HTYPE_MODE_T)
+instance Show CMode where
+    showb = showbCMode
+    INLINE_INST_FUN(showb)
+# endif
+
+# if defined(HTYPE_OFF_T)
+instance Show COff where
+    showbPrec = showbCOffPrec
+    INLINE_INST_FUN(showbPrec)
+# endif
+
+# if defined(HTYPE_PID_T)
+instance Show CPid where
+    showbPrec = showbCPidPrec
+    INLINE_INST_FUN(showbPrec)
+# endif
+
+# if defined(HTYPE_SSIZE_T)
+instance Show CSsize where
+    showbPrec = showbCSsizePrec
+    INLINE_INST_FUN(showbPrec)
+# endif
+
+# if defined(HTYPE_GID_T)
+instance Show CGid where
+    showb = showbCGid
+    INLINE_INST_FUN(showb)
+# endif
+
+# if defined(HTYPE_NLINK_T)
+instance Show CNlink where
+    showb = showbCNlink
+    INLINE_INST_FUN(showb)
+# endif
+
+# if defined(HTYPE_UID_T)
+instance Show CUid where
+    showb = showbCUid
+    INLINE_INST_FUN(showb)
+# endif
+
+# if defined(HTYPE_CC_T)
+instance Show CCc where
+    showb = showbCCc
+    INLINE_INST_FUN(showb)
+# endif
+
+# if defined(HTYPE_SPEED_T)
+instance Show CSpeed where
+    showb = showbCSpeed
+    INLINE_INST_FUN(showb)
+# endif
+
+# if defined(HTYPE_TCFLAG_T)
+instance Show CTcflag where
+    showb = showbCTcflag
+    INLINE_INST_FUN(showb)
+# endif
+
+# if defined(HTYPE_RLIM_T)
+instance Show CRLim where
+    showb = showbCRLim
+    INLINE_INST_FUN(showb)
+# endif
+#endif
+
+deriving instance Show Fd
src/Text/Show/Text/TH.hs view
@@ -1,18 +1,18 @@-{-|-Module:      Text.Show.Text.TH-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Functions to mechanically derive @Show@ instances or splice-@show@-related expressions into Haskell source code. You need to enable-the @TemplateHaskell@ language extension in order to use this module.--/Since: 0.3/--}-module Text.Show.Text.TH (module Text.Show.Text.TH.Internal) where--import Text.Show.Text.Instances ()+{-|
+Module:      Text.Show.Text.TH
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Functions to mechanically derive @Show@ instances or splice
+@show@-related expressions into Haskell source code. You need to enable
+the @TemplateHaskell@ language extension in order to use this module.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.TH (module Text.Show.Text.TH.Internal) where
+
+import Text.Show.Text.Instances ()
 import Text.Show.Text.TH.Internal
src/Text/Show/Text/TH/Internal.hs view
@@ -1,784 +1,784 @@-{-# LANGUAGE CPP             #-}-{-# LANGUAGE MagicHash       #-}-{-# LANGUAGE TemplateHaskell #-}-{-|-Module:      Text.Show.Text.TH.Internal-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Functions to mechanically derive 'T.Show' instances or splice-@show@-related expressions into Haskell source code. You need to enable-the @TemplateHaskell@ language extension in order to use this module.--This implementation is based off of the @Data.Aeson.TH@ module from the-@aeson@ library.--}-module Text.Show.Text.TH.Internal (-      -- * @deriveShow@-      -- $deriveShow-      deriveShow-    , deriveShowPragmas-      -- * @mk@ functions-      -- $mk-    , mkShow-    , mkShowLazy-    , mkShowPrec-    , mkShowPrecLazy-    , mkShowList-    , mkShowListLazy-    , mkShowb-    , mkShowbPrec-    , mkShowbList-    , mkPrint-    , mkPrintLazy-    , mkHPrint-    , mkHPrintLazy-      -- * Advanced pragma options-    , PragmaOptions(..)-    , defaultPragmaOptions-    , defaultInlineShowbPrec-    , defaultInlineShowb-    , defaultInlineShowbList-    ) where--#if !(MIN_VERSION_base(4,8,0))-import           Data.Functor ((<$>))-#endif-import           Data.List (foldl', intersperse)-#if MIN_VERSION_template_haskell(2,7,0)-import           Data.List (find)-import           Data.Maybe (fromJust)-#endif-import qualified Data.Text    as TS ()-import qualified Data.Text.IO as TS (putStrLn, hPutStrLn)-import           Data.Text.Lazy (toStrict)-import           Data.Text.Lazy.Builder (fromString, toLazyText)-import qualified Data.Text.Lazy    as TL ()-import qualified Data.Text.Lazy.IO as TL (putStrLn, hPutStrLn)--import           GHC.Exts (Char(..), Double(..), Float(..), Int(..), Word(..))-import           GHC.Prim (Char#, Double#, Float#, Int#, Word#)-import           GHC.Show (appPrec, appPrec1)--import           Language.Haskell.TH--import           Prelude hiding (Show)--import qualified Text.Show as S (Show(show))-import qualified Text.Show.Text.Classes as T-import           Text.Show.Text.Classes (showb, showbPrec, showbListWith,-                                         showbParen, showbSpace)-#if __GLASGOW_HASKELL__ >= 702-import           Text.Show.Text.Classes (showbList)-#endif-import           Text.Show.Text.Utils ((<>), isInfixTypeCon, isTupleString, s)--{- $deriveShow--'deriveShow' automatically generates a 'T.Show' instance declaration for a @data@-type, a @newtype@, a data family instance, or a whole data family. This emulates what-would (hypothetically) happen if you could attach a @deriving 'T.Show'@ clause to the-end of a data declaration.--Here are some examples of how to derive simple data types:--@-&#123;-&#35; LANGUAGE TemplateHaskell &#35;-&#125;-import Text.Show.Text.TH (deriveShow)--data Letter = A | B | C-$('deriveShow' ''Letter) -- instance Show Letter where ...--newtype Box a = Box a-$('deriveShow' ''Box)    -- instance Show a => Show (Box a) where ...-@--If you are using @template-haskell-2.7.0.0@ or later, 'deriveShow' can also be used-to derive 'T.Show' instances for data families. Some examples:--@-&#123;-&#35; LANGUAGE FlexibleInstances, TemplateHaskell, TypeFamilies &#35;-&#125;-import Text.Show.Text.TH (deriveShow)--class AssocClass a where-    data AssocData a-instance AssocClass Int where-    data AssocData Int = AssocDataInt Int Int-instance AssocClass Char where-    newtype AssocData Char = AssocDataChar Char-$('deriveShow' 'AssocDataChar) -- Only one single quote!--- Generates a Show instance for AssocDataChar, but not AssocDataInt--data family DataFam a-data instance DataFam Int = DataFamInt Int Int-newtype instance DataFam Char = DataFamChar Char-$('deriveShow' ''DataFam) -- Two single quotes!--- Generates Show instances for all data instances of DataFam--- (DataFamInt and DataFamChar)-@--Note that at the moment, there are some limitations to this approach:--* The 'Name' argument to 'deriveShow' must not be a type synonym.--* 'deriveShow' makes the assumption that all type variables in a data type require a-  'T.Show' constraint when creating the type context. For example, if you have @data-  Phantom a = Phantom@, then @('deriveShow' ''Phantom)@ will generate @instance-  'T.Show' a => 'T.Show' (Phantom a) where@, even though @'T.Show' a@ is not required.-  If you want a proper 'T.Show' instance for @Phantom@, you will need to use-  'mkShowbPrec' (see the documentation of the 'mk' functions for more information).--* 'deriveShow' lacks the ability to properly detect data types with higher-kinded-   type parameters (e.g., @data HK f a = HK (f a)@) or with kinds other than @*@-   (e.g., @data List a (empty :: Bool)@). If you wish to derive 'T.Show'-   instances for these data types, you will need to use 'mkShowbPrec' (see the-   documentation of the 'mk' functions for more information).--* Some data constructors have arguments whose 'T.Show' instance depends on a-  typeclass besides 'T.Show'. For example, consider @newtype MyFixed a = MyFixed-  (Fixed a)@. @'Fixed' a@ is a 'T.Show' instance only if @a@ is an instance of both-  @HasResolution@ and 'T.Show'. Unfortunately, 'deriveShow' cannot infer that 'a' must-  be an instance of 'HasResolution', so it cannot create a 'T.Show' instance for-  @MyFixed@. However, you can use 'mkShowbPrec' to get around this (see the-  documentation of the 'mk' functions for more information).---}---- | Generates a 'T.Show' instance declaration for the given data type or family.--- --- /Since: 0.3/-deriveShow :: Name -- ^ Name of the data type to make an instance of 'T.Show'-           -> Q [Dec]-deriveShow = deriveShowPragmas defaultPragmaOptions---- | Generates a 'T.Show' instance declaration for the given data type or family.--- You shouldn't need to use this function unless you know what you are doing.--- --- Unlike 'deriveShow', this function allows configuration of whether to inline--- 'showbPrec', 'showb', or 'showbList'. It also allows for specializing instances--- certain types. For example:--- --- @--- &#123;-&#35; LANGUAGE TemplateHaskell &#35;-&#125;--- import Text.Show.Text.TH--- --- data ADT a = ADT a--- $(deriveShowPragmas 'defaultInlineShowbPrec' {---                         specializeTypes = [ [t| ADT Int |] ]---                      }---                      ''ADT)--- @--- --- This declararation would produce code like this:--- --- @--- instance Show a => Show (ADT a) where---     &#123;-&#35; INLINE showbPrec &#35;-&#125;---     &#123;-&#35; SPECIALIZE instance Show (ADT Int) &#35;-&#125;---     showbPrec = ...--- @--- --- Beware: 'deriveShow' can generate extremely long code splices, so it may be unwise--- to inline in some cases. Use with caution.--- --- /Since: 0.5/-deriveShowPragmas :: PragmaOptions -- ^ Specifies what pragmas to generate with this instance-                  -> Name          -- ^ Name of the data type to make an instance of 'T.Show'-                  -> Q [Dec]-deriveShowPragmas opts name = do-    info <- reify name-    case info of-        TyConI{} -> deriveShowTyCon opts name-#if MIN_VERSION_template_haskell(2,7,0)-        DataConI{} -> deriveShowDataFamInst opts name-        FamilyI (FamilyD DataFam _ _ _) _ -> deriveShowDataFam opts name-        FamilyI (FamilyD TypeFam _ _ _) _ -> error $ ns ++ "Cannot use a type family name."-        -- TODO: Figure out how this whole multiline string business works-        _ -> error $ ns ++ "The name must be of a plain type constructor, data family, or data family instance constructor."-#else-        _ -> error $ ns ++ "The name must be of a plain type constructor."-#endif-  where-    ns :: String-    ns = "Text.Show.Text.TH.deriveShow: "---- | Generates a 'T.Show' instance declaration for a plain type constructor.-deriveShowTyCon :: PragmaOptions-                -> Name-                -> Q [Dec]-deriveShowTyCon opts tyConName = withTyCon tyConName fromCons-  where-    fromCons :: [TyVarBndr] -> [Con] -> Q [Dec]-    fromCons tvbs cons = (:[]) <$>-        instanceD (applyCon ''T.Show typeNames)-                  (appT (conT ''T.Show) instanceType)-                  (showbPrecDecs opts cons)-      where-        typeNames :: [Name]-        typeNames = map tvbName tvbs-        -        instanceType :: Q Type-        instanceType = foldl' appT (conT tyConName) $ map varT typeNames--#if MIN_VERSION_template_haskell(2,7,0)--- | Generates a 'T.Show' instance declaration for a data family name.-deriveShowDataFam :: PragmaOptions-                  -> Name-                  -> Q [Dec]-deriveShowDataFam opts dataFamName = withDataFam dataFamName $ \tvbs decs ->-    flip mapM decs $ deriveShowDataFamFromDec opts dataFamName tvbs---- | Generates a 'T.Show' instance declaration for a data family instance constructor.-deriveShowDataFamInst :: PragmaOptions-                      -> Name-                      -> Q [Dec]-deriveShowDataFamInst opts dataFamInstName = (:[]) <$>-    withDataFamInstCon dataFamInstName (deriveShowDataFamFromDec opts)---- | Generates a single 'T.Show' instance declaration for a data family instance. This--- code is used by 'deriveShowDataFam' and 'deriveShowDataFamInst' alike.-deriveShowDataFamFromDec :: PragmaOptions-                         -> Name-                         -> [TyVarBndr]-                         -> Dec-                         -> Q Dec-deriveShowDataFamFromDec opts parentName tvbs dec =-    instanceD (applyCon ''T.Show lhsTypeNames)-              (appT (conT ''T.Show) instanceType)-              (showbPrecDecs opts $ decCons [dec])-  where-    typeNames :: [Name]-    typeNames = map tvbName tvbs-    -    -- It seems that Template Haskell's representation of the type variable binders-    -- in a data family instance declaration has changed considerably with each new-    -- version. Yikes.-    -- -    -- In @template-haskell-2.8.0.0@, only the TyVarBndrs up to the rightmost non-type-    -- variable are provided, so we have to do some careful Name manipulation to get-    -- the LHS of the instance context just right.-    -- -    -- Other versions of @template-haskell@ seem a bit more sensible.-    lhsTypeNames :: [Name]-# if !(MIN_VERSION_template_haskell(2,9,0)) || MIN_VERSION_template_haskell(2,10,0)-    lhsTypeNames = filterTyVars typeNames instTypes-# else-    lhsTypeNames = filterTyVars (take (length instTypes) typeNames) instTypes-                ++ drop (length instTypes) typeNames-# endif--    filterTyVars :: [Name] -> [Type] -> [Name]-    filterTyVars ns     (SigT t _:ts) = filterTyVars ns (t:ts)-    filterTyVars (_:ns) (VarT n  :ts) = n : filterTyVars ns ts-    filterTyVars (_:ns) (_       :ts) = filterTyVars ns ts-    filterTyVars []     _             = []-    filterTyVars _      []            = []--    rhsTypes :: [Type]-    rhsTypes = instTypes ++ drop (length instTypes) (map VarT typeNames)-    -    instTypes :: [Type]-    instTypes = let tys = case dec of-                              DataInstD    _ _ tys' _ _ -> tys'-                              NewtypeInstD _ _ tys' _ _ -> tys'-                              _ -> error "Text.Show.Text.TH.deriveShow: The impossible happened."-# if MIN_VERSION_template_haskell(2,10,0)-                in tys-# else-                -- If PolyKinds is enabled, the first entries in this list will be-                -- kind signatures on early versions of GHC, so drop them-                in if length tys > length tvbs-                      then drop (length tvbs) tys-                      else tys-# endif--    instanceType :: Q Type-    instanceType = foldl' appT (conT parentName) $ map return rhsTypes-#endif--{- $mk--There may be scenarios in which you want to show an arbitrary data type or family-without having to make the type an instance of 'T.Show'. For these cases,-"Text.Show.Text.TH" provide several functions (all prefixed with @mk@) that splice-the appropriate lambda expression into your source code.--As an example, suppose you have @data ADT = ADT@, which is not an instance of 'T.Show'.-With @mkShow@, you can still convert it to 'Text':--@-&#123;-&#35; LANGUAGE OverloadedStrings, TemplateHaskell &#35;-&#125;-import Text.Show.Text.TH (mkShow)--whichADT :: Bool-whichADT = $(mkShow ''ADT) ADT == \"ADT\"-@--'mk' functions are also useful for creating 'T.Show' instances for data types with-sophisticated type parameters. For example, 'deriveShow' cannot infer the correct type-context for @newtype HigherKinded f a = HigherKinded (f a)@, since @f@ is a-higher-kinded type parameter. However, it is still possible to derive a 'T.Show'-instance for @HigherKinded@ without too much trouble using 'mkShowbPrec':--@-&#123;-&#35; LANGUAGE FlexibleContexts, TemplateHaskell &#35;-&#125;-import Prelude hiding (Show)-import Text.Show.Text (Show(showbPrec))-import Text.Show.Text.TH (mkShowbPrec)--instance Show (f a) => Show (HigherKinded f a) where-    showbPrec = $(mkShowbPrec ''HigherKinded)-@---}---- | Generates a lambda expression which behaves like 'T.show' (without requiring a--- 'T.Show' instance).--- --- /Since: 0.3.1/-mkShow :: Name -> Q Exp-mkShow name = [| toStrict . $(mkShowLazy name) |]---- | Generates a lambda expression which behaves like 'T.showLazy' (without requiring a--- 'T.Show' instance).--- --- /Since: 0.3.1/-mkShowLazy :: Name -> Q Exp-mkShowLazy name = [| toLazyText . $(mkShowb name) |]---- | Generates a lambda expression which behaves like 'T.showPrec' (without requiring a--- 'T.Show' instance).--- --- /Since: 0.3.1/-mkShowPrec :: Name -> Q Exp-mkShowPrec name = [| \p -> toStrict . $(mkShowPrecLazy name) p |]---- | Generates a lambda expression which behaves like 'T.showPrecLazy' (without--- requiring a 'T.Show' instance).--- --- /Since: 0.3.1/-mkShowPrecLazy :: Name -> Q Exp-mkShowPrecLazy name = [| \p -> toLazyText . $(mkShowbPrec name) p |]---- | Generates a lambda expression which behaves like 'T.showList' (without requiring a--- 'T.Show' instance).--- --- /Since: 0.5/-mkShowList :: Name -> Q Exp-mkShowList name = [| toStrict . $(mkShowListLazy name) |]---- | Generates a lambda expression which behaves like 'T.showListLazy' (without--- requiring a 'T.Show' instance).--- --- /Since: 0.5/-mkShowListLazy :: Name -> Q Exp-mkShowListLazy name = [| toLazyText . $(mkShowbList name) |]---- | Generates a lambda expression which behaves like 'T.showb' (without requiring a--- 'T.Show' instance).--- --- /Since: 0.3.1/-mkShowb :: Name -> Q Exp-mkShowb name = mkShowbPrec name `appE` [| 0 :: Int |]---- | Generates a lambda expression which behaves like 'T.showPrec' (without requiring a--- 'T.Show' instance).--- --- /Since: 0.3.1/-mkShowbPrec :: Name -> Q Exp-mkShowbPrec name = do-    info <- reify name-    case info of-        TyConI{} -> withTyCon name $ \_ decs -> consToShow decs-#if MIN_VERSION_template_haskell(2,7,0)-        DataConI{} -> withDataFamInstCon name $ \_ _ dec ->-            consToShow $ decCons [dec]-        FamilyI (FamilyD DataFam _ _ _) _ -> withDataFam name $ \_ decs ->-            consToShow $ decCons decs-        FamilyI (FamilyD TypeFam _ _ _) _ -> error $ ns ++ "Cannot use a type family name."-        -- TODO: Figure out how this whole multiline string business works-        _ -> error $ ns ++ "The name must be of a plain type constructor, data family, or data family instance constructor."-#else-        _ -> error $ ns ++ "The name must be of a plain type constructor."-#endif-  where-    ns :: String-    ns = "Text.Show.Text.TH.mk: "---- | Generates a lambda expression which behaves like 'T.showbList' (without requiring a--- 'T.Show' instance).--- --- /Since: 0.5/-mkShowbList :: Name -> Q Exp-mkShowbList name = [| showbListWith $(mkShowb name) |]---- | Generates a lambda expression which behaves like 'T.print' (without requiring a--- 'T.Show' instance).--- --- /Since: 0.3.1/-mkPrint :: Name -> Q Exp-mkPrint name = [| TS.putStrLn . $(mkShow name) |]---- | Generates a lambda expression which behaves like 'T.printLazy' (without requiring a--- 'T.Show' instance).--- --- /Since: 0.3.1/-mkPrintLazy :: Name -> Q Exp-mkPrintLazy name = [| TL.putStrLn . $(mkShowLazy name) |]---- | Generates a lambda expression which behaves like 'T.hPrint' (without requiring a--- 'T.Show' instance).--- --- /Since: 0.3.1/-mkHPrint :: Name -> Q Exp-mkHPrint name = [| \h -> TS.hPutStrLn h . $(mkShow name) |]---- | Generates a lambda expression which behaves like 'T.hPrintLazy' (without--- requiring a 'T.Show' instance).--- --- /Since: 0.3.1/-mkHPrintLazy :: Name -> Q Exp-mkHPrintLazy name = [| \h -> TL.hPutStrLn h . $(mkShowLazy name) |]---- | Options that specify what @INLINE@ or @SPECIALIZE@ pragmas to generate with--- a 'T.Show' instance.--- --- /Since: 0.5/-data PragmaOptions = PragmaOptions {-    inlineShowbPrec  :: Bool    -- ^ Whether to inline 'showbPrec'-  , inlineShowb      :: Bool    -- ^ Whether to inline 'showb'-  , inlineShowbList  :: Bool    -- ^ Whether to inline 'showbList'-  , specializeTypes :: [Q Type] -- ^ Types for which to create specialized instance declarations-}---- | Do not generate any pragmas with a 'T.Show' instance.--- --- /Since: 0.5/-defaultPragmaOptions :: PragmaOptions-defaultPragmaOptions = PragmaOptions False False False []---- | Inline the 'showbPrec' function in a 'T.Show' instance.--- --- /Since: 0.5/-defaultInlineShowbPrec :: PragmaOptions-defaultInlineShowbPrec = defaultPragmaOptions { inlineShowbPrec = True }---- | Inline the 'showb' function in a 'T.Show' instance.--- --- /Since: 0.5/-defaultInlineShowb :: PragmaOptions-defaultInlineShowb = defaultPragmaOptions { inlineShowb = True }---- | Inline the 'showbList' function in a 'T.Show' instance.--- --- /Since: 0.5/-defaultInlineShowbList :: PragmaOptions-defaultInlineShowbList = defaultPragmaOptions { inlineShowbList = True }---- | Generates code to generate the 'T.Show' encoding of a number of constructors.--- All constructors must be from the same type.-consToShow :: [Con] -> Q Exp-consToShow []   = error $ "Text.Show.Text.TH.consToShow: Not a single constructor given!"-consToShow cons = do-    p     <- newName "p"-    value <- newName "value"-    lam1E (varP p)-        . lam1E (varP value)-        . caseE (varE value)-        $ map (encodeArgs p) cons---- | Generates code to generate the 'T.Show' encoding of a single constructor.-encodeArgs :: Name -> Con -> Q Match-encodeArgs p (NormalC conName [])-    = match (conP conName [])-            (normalB [| intConst (fromString $(stringE (nameBase conName))) $(varE p) |])-            []-encodeArgs p (NormalC conName [(_, argTy)]) = do-    arg <- newName "arg"-    -    let showArg  = showbPrecPrim appPrec1 argTy arg-        namedArg = [| fromString $(stringE (nameBase conName)) <> showbSpace <> $(showArg) |] -    -    match (conP conName [varP arg])-          (normalB [| showbParen ($(varE p) > appPrec) $(namedArg) |])-          []-encodeArgs p (NormalC conName ts) = do-    args <- mapM newName ["arg" ++ S.show n | (_, n) <- zip ts [1 :: Int ..]]-    -    if isNonUnitTuple conName-       then do-           let showArgs       = map (appE [| showb |] . varE) args-               parenCommaArgs = [| s '(' |] : intersperse [| s ',' |] showArgs-               mappendArgs    = foldr (flip infixApp [| (<>) |])-                                      [| s ')' |]-                                      parenCommaArgs-           -           match (conP conName $ map varP args)-                 (normalB [| intConst $(mappendArgs) $(varE p) |])-                 []-       else do-           let showArgs = map (\(arg, (_, argTy)) -> showbPrecPrim appPrec1 argTy arg)-                              (zip args ts)-               mappendArgs = foldr1 (\v q -> [| $(v) <> showbSpace <> $(q) |]) showArgs-               namedArgs   = [| fromString $(stringE (nameBase conName)) <> showbSpace <> $(mappendArgs) |]-           -           match (conP conName $ map varP args)-                 (normalB [| showbParen ($(varE p) > appPrec) $(namedArgs) |])-                 []-encodeArgs p (RecC conName []) = encodeArgs p $ NormalC conName []-encodeArgs p (RecC conName ts) = do-    args <- mapM newName ["arg" ++ S.show n | (_, n) <- zip ts [1 :: Int ..]]-    -    let showArgs       = concatMap (\(arg, (argName, _, argTy))-                                      -> [ [| fromString $(stringE (nameBase argName)) |]-                                         , [| fromString " = "                         |]-                                         , showbPrecPrim 0 argTy arg-                                         , [| fromString ", "                          |]-                                         ]-                                   )-                                   (zip args ts)-        braceCommaArgs = [| s '{' |] : take (length showArgs - 1) showArgs-        mappendArgs    = foldr (flip infixApp [| (<>) |])-                           [| s '}' |]-                           braceCommaArgs-        namedArgs      = [| fromString $(stringE (nameBase conName)) <> showbSpace <> $(mappendArgs) |]-    -    match (conP conName $ map varP args)-          (normalB [| showbParen ($(varE p) > appPrec) $(namedArgs) |])-          []-encodeArgs p (InfixC (_, alTy) conName (_, arTy)) = do-    al   <- newName "argL"-    ar   <- newName "argR"-    info <- reify conName-    -    let conPrec  = case info of-                        DataConI _ _ _ (Fixity prec _) -> prec-                        other -> error $ "Text.Show.Text.TH.encodeArgs: Unsupported type: " ++ S.show other-        opName   = nameBase conName-        infixOpE = if isInfixTypeCon opName-                     then [| fromString opName |]-                     else [| s '`' <> fromString opName <> s '`' |]-    -    match (infixP (varP al) conName (varP ar))-          (normalB $ appE [| showbParen ($(varE p) > conPrec) |]-                          [| $(showbPrecPrim (conPrec + 1) alTy al)-                          <> showbSpace-                          <> $(infixOpE)-                          <> showbSpace-                          <> $(showbPrecPrim (conPrec + 1) arTy ar)-                          |]-          )-          []-encodeArgs p (ForallC _ _ con) = encodeArgs p con------------------------------------------------------------------------------------ Utility functions------------------------------------------------------------------------------------ | Checks if an type variable has an unlifted type that can be shown. If so,--- wrap it in its corresponding constructor and show it. Otherwise, only show--- the type variable.-showbPrecPrim :: Int -> Type -> Name -> Q Exp-#if __GLASGOW_HASKELL__ >= 712--- Starting with GHC 7.10, data types containing unlifted types with derived @Show@--- instances show hashed literals with actual hash signs, and negative hashed--- literals are not surrounded with parentheses.-showbPrecPrim p (ConT tyName) tyVarName = showE-  where-    tyVarE :: Q Exp-    tyVarE = varE tyVarName-    -    showE :: Q Exp-    showE | tyName == ''Char#   = [| showbPrec 0 (C# $(tyVarE)) <> s '#'           |]-          | tyName == ''Double# = [| showbPrec 0 (D# $(tyVarE)) <> fromString "##" |]-          | tyName == ''Float#  = [| showbPrec 0 (F# $(tyVarE)) <> s '#'           |]-          | tyName == ''Int#    = [| showbPrec 0 (I# $(tyVarE)) <> s '#'           |]-          | tyName == ''Word#   = [| showbPrec 0 (W# $(tyVarE)) <> fromString "##" |]-          | otherwise = [| showbPrec p $(tyVarE) |]-#else-showbPrecPrim p (ConT tyName) tyVarName = [| showbPrec p $(expr) |]-  where-    tyVarE :: Q Exp-    tyVarE = varE tyVarName-    -    expr :: Q Exp-    expr | tyName == ''Char#   = [| C# $(tyVarE) |]-         | tyName == ''Double# = [| D# $(tyVarE) |]-         | tyName == ''Float#  = [| F# $(tyVarE) |]-         | tyName == ''Int#    = [| I# $(tyVarE) |]-         | tyName == ''Word#   = [| W# $(tyVarE) |]-         | otherwise = tyVarE-#endif-showbPrecPrim p _ tyVarName = [| showbPrec p $(varE tyVarName) |]---- | Checks if a 'Name' represents a tuple type constructor (other than '()')-isNonUnitTuple :: Name -> Bool-isNonUnitTuple = isTupleString . nameBase---- | A type-restricted version of 'const'. This is useful when generating the lambda--- expression in 'mkShowbPrec' for a data type with only nullary constructors (since--- the expression wouldn't depend on the precedence). For example, if you had @data--- Nullary = Nullary@ and attempted to run @$(mkShowbPrec ''Nullary) Nullary@, simply--- ignoring the precedence argument would cause the type signature of @$(mkShowbPrec--- ''Nullary)@ to be @a -> Nullary -> Builder@, not @Int -> Nullary -> Builder@.--- --- To avoid this problem, after computing the 'Builder' @b@, we call @intConst b p@,--- where @p@ is the precedence argument. This forces @p :: Int@.-intConst :: a -> Int -> a-intConst = const-{-# INLINE intConst #-}---- | Extracts a plain type constructor's information.-withTyCon :: Name -- ^ Name of the plain type constructor-            -> ([TyVarBndr] -> [Con] -> Q a)-            -- ^ Function that generates the actual code. Will be applied-            -- to the type variable binders and constructors extracted-            -- from the given 'Name'.-            -> Q a-            -- ^ Resulting value in the 'Q'uasi monad.-withTyCon name f = do-    info <- reify name-    case info of-        TyConI dec ->-            case dec of-                DataD    _ _ tvbs cons _ -> f tvbs cons-                NewtypeD _ _ tvbs con  _ -> f tvbs [con]-                other -> error $ ns ++ "Unsupported type " ++ S.show other ++ ". Must be a data type or newtype."-        _ -> error $ ns ++ "The name must be of a plain type constructor."-  where-    ns :: String-    ns = "Text.Show.Text.TH.withTyCon: "--#if MIN_VERSION_template_haskell(2,7,0)--- | Extracts a data family name's information.-withDataFam :: Name-            -> ([TyVarBndr] -> [Dec] -> Q a)-            -> Q a-withDataFam name f = do-    info <- reify name-    case info of-        FamilyI (FamilyD DataFam _ tvbs _) decs -> f tvbs decs-        FamilyI (FamilyD TypeFam _ _    _) _    ->-            error $ ns ++ "Cannot use a type family name."-        other -> error $ ns ++ "Unsupported type " ++ S.show other ++ ". Must be a data family name."-  where-    ns :: String-    ns = "Text.Show.Text.TH.withDataFam: "---- | Extracts a data family instance constructor's information.-withDataFamInstCon :: Name-                   -> (Name -> [TyVarBndr] -> Dec -> Q a)-                   -> Q a-withDataFamInstCon dficName f = do-    dficInfo <- reify dficName-    case dficInfo of-        DataConI _ _ parentName _ -> do-            parentInfo <- reify parentName-            case parentInfo of-                FamilyI (FamilyD DataFam _ _ _) _ -> withDataFam parentName $ \tvbs decs ->-                    let sameDefDec = fromJust . flip find decs $ \dec ->-                          case dec of-                              DataInstD    _ _ _ cons _ -> any ((dficName ==) . constructorName) cons -                              NewtypeInstD _ _ _ con  _ -> dficName == constructorName con-                              _ -> error $ ns ++ "Must be a data or newtype instance."-                    in f parentName tvbs sameDefDec-                _ -> error $ ns ++ "Data constructor " ++ S.show dficName ++ " is not from a data family instance."-        other -> error $ ns ++ "Unsupported type " ++ S.show other ++ ". Must be a data family instance constructor."-  where-    ns :: String-    ns = "Text.Show.Text.TH.withDataFamInstCon: "-#endif---- | Extracts the information about the constructors from several @data@ or @newtype@--- declarations.-decCons :: [Dec] -> [Con]-decCons decs = flip concatMap decs $ \dec -> case dec of-    DataInstD    _ _ _ cons _ -> cons-    NewtypeInstD _ _ _ con  _ -> [con]-    _ -> error $ "Text.Show.Text.TH.decCons: Must be a data or newtype instance."---- | Extracts the name of a constructor.-constructorName :: Con -> Name-constructorName (NormalC name      _  ) = name-constructorName (RecC    name      _  ) = name-constructorName (InfixC  _    name _  ) = name-constructorName (ForallC _    _    con) = constructorName con---- | Extracts the name from a type variable binder.-tvbName :: TyVarBndr -> Name-tvbName (PlainTV  name  ) = name-tvbName (KindedTV name _) = name---- | Applies a typeclass to several type parameters to produce the type predicate of--- an instance declaration.-applyCon :: Name -> [Name] -> Q [Pred]-applyCon con typeNames = return $ map apply typeNames-  where-    apply :: Name -> Pred-    apply t =-#if MIN_VERSION_template_haskell(2,10,0)-        AppT (ConT con) (VarT t)-#else-        ClassP con [VarT t]-#endif---- | Generates a declaration defining the 'showbPrec' function, followed by any custom--- pragma declarations specified by the 'PragmaOptions' argument.--- --- The Template Haskell API for generating pragmas (as well as GHC's treatment of--- pragmas themselves) have changed considerably over the years, so there's a lot of--- CPP magic required to get this to work uniformly across different versions of GHC.-showbPrecDecs :: PragmaOptions -> [Con] -> [Q Dec]-#if __GLASGOW_HASKELL__ >= 702-showbPrecDecs opts cons =-#else-showbPrecDecs _    cons =-#endif-    [ funD 'showbPrec [ clause []-                               (normalB $ consToShow cons)-                               []-                      ]-    ] ++ inlineShowbPrecDec-      ++ inlineShowbDec-      ++ inlineShowbListDec-      ++ specializeDecs-  where-    inlineShowbPrecDec, inlineShowbDec, inlineShowbListDec :: [Q Dec]-#if __GLASGOW_HASKELL__ >= 702-    inlineShowbPrecDec = inline inlineShowbPrec 'showbPrec-    inlineShowbDec     = inline inlineShowb 'showb-    inlineShowbListDec = inline inlineShowbList 'showbList-#else-    inlineShowbPrecDec = []-    inlineShowbDec     = []-    inlineShowbListDec = []-#endif-          -#if __GLASGOW_HASKELL__ >= 702-    inline :: (PragmaOptions -> Bool) -> Name -> [Q Dec]-    inline isInlining funName-        | isInlining opts = [ pragInlD funName-# if MIN_VERSION_template_haskell(2,8,0)-                                       Inline FunLike AllPhases-# else-                                       (inlineSpecNoPhase True False)-# endif-                            ]-        | otherwise       = []-#endif-          -    specializeDecs :: [Q Dec]-#if MIN_VERSION_template_haskell(2,8,0)-    specializeDecs = (map . fmap) (PragmaD-                                       . SpecialiseInstP-                                       . AppT (ConT ''T.Show)-                                  )-                                  (specializeTypes opts)-#else-    -- There doesn't appear to be an equivalent of SpecialiseInstP in early-    -- versions Template Haskell.-    specializeDecs = []-#endif+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE MagicHash       #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-|
+Module:      Text.Show.Text.TH.Internal
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Functions to mechanically derive 'T.Show' instances or splice
+@show@-related expressions into Haskell source code. You need to enable
+the @TemplateHaskell@ language extension in order to use this module.
+
+This implementation is based off of the @Data.Aeson.TH@ module from the
+@aeson@ library.
+-}
+module Text.Show.Text.TH.Internal (
+      -- * @deriveShow@
+      -- $deriveShow
+      deriveShow
+    , deriveShowPragmas
+      -- * @mk@ functions
+      -- $mk
+    , mkShow
+    , mkShowLazy
+    , mkShowPrec
+    , mkShowPrecLazy
+    , mkShowList
+    , mkShowListLazy
+    , mkShowb
+    , mkShowbPrec
+    , mkShowbList
+    , mkPrint
+    , mkPrintLazy
+    , mkHPrint
+    , mkHPrintLazy
+      -- * Advanced pragma options
+    , PragmaOptions(..)
+    , defaultPragmaOptions
+    , defaultInlineShowbPrec
+    , defaultInlineShowb
+    , defaultInlineShowbList
+    ) where
+
+#if !(MIN_VERSION_base(4,8,0))
+import           Data.Functor ((<$>))
+#endif
+import           Data.List (foldl', intersperse)
+#if MIN_VERSION_template_haskell(2,7,0)
+import           Data.List (find)
+import           Data.Maybe (fromJust)
+#endif
+import qualified Data.Text    as TS ()
+import qualified Data.Text.IO as TS (putStrLn, hPutStrLn)
+import           Data.Text.Lazy (toStrict)
+import           Data.Text.Lazy.Builder (fromString, toLazyText)
+import qualified Data.Text.Lazy    as TL ()
+import qualified Data.Text.Lazy.IO as TL (putStrLn, hPutStrLn)
+
+import           GHC.Exts (Char(..), Double(..), Float(..), Int(..), Word(..))
+import           GHC.Prim (Char#, Double#, Float#, Int#, Word#)
+import           GHC.Show (appPrec, appPrec1)
+
+import           Language.Haskell.TH
+
+import           Prelude hiding (Show)
+
+import qualified Text.Show as S (Show(show))
+import qualified Text.Show.Text.Classes as T
+import           Text.Show.Text.Classes (showb, showbPrec, showbListWith,
+                                         showbParen, showbSpace)
+#if __GLASGOW_HASKELL__ >= 702
+import           Text.Show.Text.Classes (showbList)
+#endif
+import           Text.Show.Text.Utils ((<>), isInfixTypeCon, isTupleString, s)
+
+{- $deriveShow
+
+'deriveShow' automatically generates a 'T.Show' instance declaration for a @data@
+type, a @newtype@, a data family instance, or a whole data family. This emulates what
+would (hypothetically) happen if you could attach a @deriving 'T.Show'@ clause to the
+end of a data declaration.
+
+Here are some examples of how to derive simple data types:
+
+@
+&#123;-&#35; LANGUAGE TemplateHaskell &#35;-&#125;
+import Text.Show.Text.TH (deriveShow)
+
+data Letter = A | B | C
+$('deriveShow' ''Letter) -- instance Show Letter where ...
+
+newtype Box a = Box a
+$('deriveShow' ''Box)    -- instance Show a => Show (Box a) where ...
+@
+
+If you are using @template-haskell-2.7.0.0@ or later, 'deriveShow' can also be used
+to derive 'T.Show' instances for data families. Some examples:
+
+@
+&#123;-&#35; LANGUAGE FlexibleInstances, TemplateHaskell, TypeFamilies &#35;-&#125;
+import Text.Show.Text.TH (deriveShow)
+
+class AssocClass a where
+    data AssocData a
+instance AssocClass Int where
+    data AssocData Int = AssocDataInt Int Int
+instance AssocClass Char where
+    newtype AssocData Char = AssocDataChar Char
+$('deriveShow' 'AssocDataChar) -- Only one single quote!
+-- Generates a Show instance for AssocDataChar, but not AssocDataInt
+
+data family DataFam a
+data instance DataFam Int = DataFamInt Int Int
+newtype instance DataFam Char = DataFamChar Char
+$('deriveShow' ''DataFam) -- Two single quotes!
+-- Generates Show instances for all data instances of DataFam
+-- (DataFamInt and DataFamChar)
+@
+
+Note that at the moment, there are some limitations to this approach:
+
+* The 'Name' argument to 'deriveShow' must not be a type synonym.
+
+* 'deriveShow' makes the assumption that all type variables in a data type require a
+  'T.Show' constraint when creating the type context. For example, if you have @data
+  Phantom a = Phantom@, then @('deriveShow' ''Phantom)@ will generate @instance
+  'T.Show' a => 'T.Show' (Phantom a) where@, even though @'T.Show' a@ is not required.
+  If you want a proper 'T.Show' instance for @Phantom@, you will need to use
+  'mkShowbPrec' (see the documentation of the 'mk' functions for more information).
+
+* 'deriveShow' lacks the ability to properly detect data types with higher-kinded
+   type parameters (e.g., @data HK f a = HK (f a)@) or with kinds other than @*@
+   (e.g., @data List a (empty :: Bool)@). If you wish to derive 'T.Show'
+   instances for these data types, you will need to use 'mkShowbPrec' (see the
+   documentation of the 'mk' functions for more information).
+
+* Some data constructors have arguments whose 'T.Show' instance depends on a
+  typeclass besides 'T.Show'. For example, consider @newtype MyFixed a = MyFixed
+  (Fixed a)@. @'Fixed' a@ is a 'T.Show' instance only if @a@ is an instance of both
+  @HasResolution@ and 'T.Show'. Unfortunately, 'deriveShow' cannot infer that 'a' must
+  be an instance of 'HasResolution', so it cannot create a 'T.Show' instance for
+  @MyFixed@. However, you can use 'mkShowbPrec' to get around this (see the
+  documentation of the 'mk' functions for more information).
+
+-}
+
+-- | Generates a 'T.Show' instance declaration for the given data type or family.
+-- 
+-- /Since: 0.3/
+deriveShow :: Name -- ^ Name of the data type to make an instance of 'T.Show'
+           -> Q [Dec]
+deriveShow = deriveShowPragmas defaultPragmaOptions
+
+-- | Generates a 'T.Show' instance declaration for the given data type or family.
+-- You shouldn't need to use this function unless you know what you are doing.
+-- 
+-- Unlike 'deriveShow', this function allows configuration of whether to inline
+-- 'showbPrec', 'showb', or 'showbList'. It also allows for specializing instances
+-- certain types. For example:
+-- 
+-- @
+-- &#123;-&#35; LANGUAGE TemplateHaskell &#35;-&#125;
+-- import Text.Show.Text.TH
+-- 
+-- data ADT a = ADT a
+-- $(deriveShowPragmas 'defaultInlineShowbPrec' {
+--                         specializeTypes = [ [t| ADT Int |] ]
+--                      }
+--                      ''ADT)
+-- @
+-- 
+-- This declararation would produce code like this:
+-- 
+-- @
+-- instance Show a => Show (ADT a) where
+--     &#123;-&#35; INLINE showbPrec &#35;-&#125;
+--     &#123;-&#35; SPECIALIZE instance Show (ADT Int) &#35;-&#125;
+--     showbPrec = ...
+-- @
+-- 
+-- Beware: 'deriveShow' can generate extremely long code splices, so it may be unwise
+-- to inline in some cases. Use with caution.
+-- 
+-- /Since: 0.5/
+deriveShowPragmas :: PragmaOptions -- ^ Specifies what pragmas to generate with this instance
+                  -> Name          -- ^ Name of the data type to make an instance of 'T.Show'
+                  -> Q [Dec]
+deriveShowPragmas opts name = do
+    info <- reify name
+    case info of
+        TyConI{} -> deriveShowTyCon opts name
+#if MIN_VERSION_template_haskell(2,7,0)
+        DataConI{} -> deriveShowDataFamInst opts name
+        FamilyI (FamilyD DataFam _ _ _) _ -> deriveShowDataFam opts name
+        FamilyI (FamilyD TypeFam _ _ _) _ -> error $ ns ++ "Cannot use a type family name."
+        -- TODO: Figure out how this whole multiline string business works
+        _ -> error $ ns ++ "The name must be of a plain type constructor, data family, or data family instance constructor."
+#else
+        _ -> error $ ns ++ "The name must be of a plain type constructor."
+#endif
+  where
+    ns :: String
+    ns = "Text.Show.Text.TH.deriveShow: "
+
+-- | Generates a 'T.Show' instance declaration for a plain type constructor.
+deriveShowTyCon :: PragmaOptions
+                -> Name
+                -> Q [Dec]
+deriveShowTyCon opts tyConName = withTyCon tyConName fromCons
+  where
+    fromCons :: [TyVarBndr] -> [Con] -> Q [Dec]
+    fromCons tvbs cons = (:[]) <$>
+        instanceD (applyCon ''T.Show typeNames)
+                  (appT (conT ''T.Show) instanceType)
+                  (showbPrecDecs opts cons)
+      where
+        typeNames :: [Name]
+        typeNames = map tvbName tvbs
+        
+        instanceType :: Q Type
+        instanceType = foldl' appT (conT tyConName) $ map varT typeNames
+
+#if MIN_VERSION_template_haskell(2,7,0)
+-- | Generates a 'T.Show' instance declaration for a data family name.
+deriveShowDataFam :: PragmaOptions
+                  -> Name
+                  -> Q [Dec]
+deriveShowDataFam opts dataFamName = withDataFam dataFamName $ \tvbs decs ->
+    flip mapM decs $ deriveShowDataFamFromDec opts dataFamName tvbs
+
+-- | Generates a 'T.Show' instance declaration for a data family instance constructor.
+deriveShowDataFamInst :: PragmaOptions
+                      -> Name
+                      -> Q [Dec]
+deriveShowDataFamInst opts dataFamInstName = (:[]) <$>
+    withDataFamInstCon dataFamInstName (deriveShowDataFamFromDec opts)
+
+-- | Generates a single 'T.Show' instance declaration for a data family instance. This
+-- code is used by 'deriveShowDataFam' and 'deriveShowDataFamInst' alike.
+deriveShowDataFamFromDec :: PragmaOptions
+                         -> Name
+                         -> [TyVarBndr]
+                         -> Dec
+                         -> Q Dec
+deriveShowDataFamFromDec opts parentName tvbs dec =
+    instanceD (applyCon ''T.Show lhsTypeNames)
+              (appT (conT ''T.Show) instanceType)
+              (showbPrecDecs opts $ decCons [dec])
+  where
+    typeNames :: [Name]
+    typeNames = map tvbName tvbs
+    
+    -- It seems that Template Haskell's representation of the type variable binders
+    -- in a data family instance declaration has changed considerably with each new
+    -- version. Yikes.
+    -- 
+    -- In @template-haskell-2.8.0.0@, only the TyVarBndrs up to the rightmost non-type
+    -- variable are provided, so we have to do some careful Name manipulation to get
+    -- the LHS of the instance context just right.
+    -- 
+    -- Other versions of @template-haskell@ seem a bit more sensible.
+    lhsTypeNames :: [Name]
+# if !(MIN_VERSION_template_haskell(2,9,0)) || MIN_VERSION_template_haskell(2,10,0)
+    lhsTypeNames = filterTyVars typeNames instTypes
+# else
+    lhsTypeNames = filterTyVars (take (length instTypes) typeNames) instTypes
+                ++ drop (length instTypes) typeNames
+# endif
+
+    filterTyVars :: [Name] -> [Type] -> [Name]
+    filterTyVars ns     (SigT t _:ts) = filterTyVars ns (t:ts)
+    filterTyVars (_:ns) (VarT n  :ts) = n : filterTyVars ns ts
+    filterTyVars (_:ns) (_       :ts) = filterTyVars ns ts
+    filterTyVars []     _             = []
+    filterTyVars _      []            = []
+
+    rhsTypes :: [Type]
+    rhsTypes = instTypes ++ drop (length instTypes) (map VarT typeNames)
+    
+    instTypes :: [Type]
+    instTypes = let tys = case dec of
+                              DataInstD    _ _ tys' _ _ -> tys'
+                              NewtypeInstD _ _ tys' _ _ -> tys'
+                              _ -> error "Text.Show.Text.TH.deriveShow: The impossible happened."
+# if MIN_VERSION_template_haskell(2,10,0)
+                in tys
+# else
+                -- If PolyKinds is enabled, the first entries in this list will be
+                -- kind signatures on early versions of GHC, so drop them
+                in if length tys > length tvbs
+                      then drop (length tvbs) tys
+                      else tys
+# endif
+
+    instanceType :: Q Type
+    instanceType = foldl' appT (conT parentName) $ map return rhsTypes
+#endif
+
+{- $mk
+
+There may be scenarios in which you want to show an arbitrary data type or family
+without having to make the type an instance of 'T.Show'. For these cases,
+"Text.Show.Text.TH" provide several functions (all prefixed with @mk@) that splice
+the appropriate lambda expression into your source code.
+
+As an example, suppose you have @data ADT = ADT@, which is not an instance of 'T.Show'.
+With @mkShow@, you can still convert it to 'Text':
+
+@
+&#123;-&#35; LANGUAGE OverloadedStrings, TemplateHaskell &#35;-&#125;
+import Text.Show.Text.TH (mkShow)
+
+whichADT :: Bool
+whichADT = $(mkShow ''ADT) ADT == \"ADT\"
+@
+
+'mk' functions are also useful for creating 'T.Show' instances for data types with
+sophisticated type parameters. For example, 'deriveShow' cannot infer the correct type
+context for @newtype HigherKinded f a = HigherKinded (f a)@, since @f@ is a
+higher-kinded type parameter. However, it is still possible to derive a 'T.Show'
+instance for @HigherKinded@ without too much trouble using 'mkShowbPrec':
+
+@
+&#123;-&#35; LANGUAGE FlexibleContexts, TemplateHaskell &#35;-&#125;
+import Prelude hiding (Show)
+import Text.Show.Text (Show(showbPrec))
+import Text.Show.Text.TH (mkShowbPrec)
+
+instance Show (f a) => Show (HigherKinded f a) where
+    showbPrec = $(mkShowbPrec ''HigherKinded)
+@
+
+-}
+
+-- | Generates a lambda expression which behaves like 'T.show' (without requiring a
+-- 'T.Show' instance).
+-- 
+-- /Since: 0.3.1/
+mkShow :: Name -> Q Exp
+mkShow name = [| toStrict . $(mkShowLazy name) |]
+
+-- | Generates a lambda expression which behaves like 'T.showLazy' (without requiring a
+-- 'T.Show' instance).
+-- 
+-- /Since: 0.3.1/
+mkShowLazy :: Name -> Q Exp
+mkShowLazy name = [| toLazyText . $(mkShowb name) |]
+
+-- | Generates a lambda expression which behaves like 'T.showPrec' (without requiring a
+-- 'T.Show' instance).
+-- 
+-- /Since: 0.3.1/
+mkShowPrec :: Name -> Q Exp
+mkShowPrec name = [| \p -> toStrict . $(mkShowPrecLazy name) p |]
+
+-- | Generates a lambda expression which behaves like 'T.showPrecLazy' (without
+-- requiring a 'T.Show' instance).
+-- 
+-- /Since: 0.3.1/
+mkShowPrecLazy :: Name -> Q Exp
+mkShowPrecLazy name = [| \p -> toLazyText . $(mkShowbPrec name) p |]
+
+-- | Generates a lambda expression which behaves like 'T.showList' (without requiring a
+-- 'T.Show' instance).
+-- 
+-- /Since: 0.5/
+mkShowList :: Name -> Q Exp
+mkShowList name = [| toStrict . $(mkShowListLazy name) |]
+
+-- | Generates a lambda expression which behaves like 'T.showListLazy' (without
+-- requiring a 'T.Show' instance).
+-- 
+-- /Since: 0.5/
+mkShowListLazy :: Name -> Q Exp
+mkShowListLazy name = [| toLazyText . $(mkShowbList name) |]
+
+-- | Generates a lambda expression which behaves like 'T.showb' (without requiring a
+-- 'T.Show' instance).
+-- 
+-- /Since: 0.3.1/
+mkShowb :: Name -> Q Exp
+mkShowb name = mkShowbPrec name `appE` [| 0 :: Int |]
+
+-- | Generates a lambda expression which behaves like 'T.showPrec' (without requiring a
+-- 'T.Show' instance).
+-- 
+-- /Since: 0.3.1/
+mkShowbPrec :: Name -> Q Exp
+mkShowbPrec name = do
+    info <- reify name
+    case info of
+        TyConI{} -> withTyCon name $ \_ decs -> consToShow decs
+#if MIN_VERSION_template_haskell(2,7,0)
+        DataConI{} -> withDataFamInstCon name $ \_ _ dec ->
+            consToShow $ decCons [dec]
+        FamilyI (FamilyD DataFam _ _ _) _ -> withDataFam name $ \_ decs ->
+            consToShow $ decCons decs
+        FamilyI (FamilyD TypeFam _ _ _) _ -> error $ ns ++ "Cannot use a type family name."
+        -- TODO: Figure out how this whole multiline string business works
+        _ -> error $ ns ++ "The name must be of a plain type constructor, data family, or data family instance constructor."
+#else
+        _ -> error $ ns ++ "The name must be of a plain type constructor."
+#endif
+  where
+    ns :: String
+    ns = "Text.Show.Text.TH.mk: "
+
+-- | Generates a lambda expression which behaves like 'T.showbList' (without requiring a
+-- 'T.Show' instance).
+-- 
+-- /Since: 0.5/
+mkShowbList :: Name -> Q Exp
+mkShowbList name = [| showbListWith $(mkShowb name) |]
+
+-- | Generates a lambda expression which behaves like 'T.print' (without requiring a
+-- 'T.Show' instance).
+-- 
+-- /Since: 0.3.1/
+mkPrint :: Name -> Q Exp
+mkPrint name = [| TS.putStrLn . $(mkShow name) |]
+
+-- | Generates a lambda expression which behaves like 'T.printLazy' (without requiring a
+-- 'T.Show' instance).
+-- 
+-- /Since: 0.3.1/
+mkPrintLazy :: Name -> Q Exp
+mkPrintLazy name = [| TL.putStrLn . $(mkShowLazy name) |]
+
+-- | Generates a lambda expression which behaves like 'T.hPrint' (without requiring a
+-- 'T.Show' instance).
+-- 
+-- /Since: 0.3.1/
+mkHPrint :: Name -> Q Exp
+mkHPrint name = [| \h -> TS.hPutStrLn h . $(mkShow name) |]
+
+-- | Generates a lambda expression which behaves like 'T.hPrintLazy' (without
+-- requiring a 'T.Show' instance).
+-- 
+-- /Since: 0.3.1/
+mkHPrintLazy :: Name -> Q Exp
+mkHPrintLazy name = [| \h -> TL.hPutStrLn h . $(mkShowLazy name) |]
+
+-- | Options that specify what @INLINE@ or @SPECIALIZE@ pragmas to generate with
+-- a 'T.Show' instance.
+-- 
+-- /Since: 0.5/
+data PragmaOptions = PragmaOptions {
+    inlineShowbPrec  :: Bool    -- ^ Whether to inline 'showbPrec'
+  , inlineShowb      :: Bool    -- ^ Whether to inline 'showb'
+  , inlineShowbList  :: Bool    -- ^ Whether to inline 'showbList'
+  , specializeTypes :: [Q Type] -- ^ Types for which to create specialized instance declarations
+}
+
+-- | Do not generate any pragmas with a 'T.Show' instance.
+-- 
+-- /Since: 0.5/
+defaultPragmaOptions :: PragmaOptions
+defaultPragmaOptions = PragmaOptions False False False []
+
+-- | Inline the 'showbPrec' function in a 'T.Show' instance.
+-- 
+-- /Since: 0.5/
+defaultInlineShowbPrec :: PragmaOptions
+defaultInlineShowbPrec = defaultPragmaOptions { inlineShowbPrec = True }
+
+-- | Inline the 'showb' function in a 'T.Show' instance.
+-- 
+-- /Since: 0.5/
+defaultInlineShowb :: PragmaOptions
+defaultInlineShowb = defaultPragmaOptions { inlineShowb = True }
+
+-- | Inline the 'showbList' function in a 'T.Show' instance.
+-- 
+-- /Since: 0.5/
+defaultInlineShowbList :: PragmaOptions
+defaultInlineShowbList = defaultPragmaOptions { inlineShowbList = True }
+
+-- | Generates code to generate the 'T.Show' encoding of a number of constructors.
+-- All constructors must be from the same type.
+consToShow :: [Con] -> Q Exp
+consToShow []   = error $ "Text.Show.Text.TH.consToShow: Not a single constructor given!"
+consToShow cons = do
+    p     <- newName "p"
+    value <- newName "value"
+    lam1E (varP p)
+        . lam1E (varP value)
+        . caseE (varE value)
+        $ map (encodeArgs p) cons
+
+-- | Generates code to generate the 'T.Show' encoding of a single constructor.
+encodeArgs :: Name -> Con -> Q Match
+encodeArgs p (NormalC conName [])
+    = match (conP conName [])
+            (normalB [| intConst (fromString $(stringE (nameBase conName))) $(varE p) |])
+            []
+encodeArgs p (NormalC conName [(_, argTy)]) = do
+    arg <- newName "arg"
+    
+    let showArg  = showbPrecPrim appPrec1 argTy arg
+        namedArg = [| fromString $(stringE (nameBase conName)) <> showbSpace <> $(showArg) |] 
+    
+    match (conP conName [varP arg])
+          (normalB [| showbParen ($(varE p) > appPrec) $(namedArg) |])
+          []
+encodeArgs p (NormalC conName ts) = do
+    args <- mapM newName ["arg" ++ S.show n | (_, n) <- zip ts [1 :: Int ..]]
+    
+    if isNonUnitTuple conName
+       then do
+           let showArgs       = map (appE [| showb |] . varE) args
+               parenCommaArgs = [| s '(' |] : intersperse [| s ',' |] showArgs
+               mappendArgs    = foldr (flip infixApp [| (<>) |])
+                                      [| s ')' |]
+                                      parenCommaArgs
+           
+           match (conP conName $ map varP args)
+                 (normalB [| intConst $(mappendArgs) $(varE p) |])
+                 []
+       else do
+           let showArgs = map (\(arg, (_, argTy)) -> showbPrecPrim appPrec1 argTy arg)
+                              (zip args ts)
+               mappendArgs = foldr1 (\v q -> [| $(v) <> showbSpace <> $(q) |]) showArgs
+               namedArgs   = [| fromString $(stringE (nameBase conName)) <> showbSpace <> $(mappendArgs) |]
+           
+           match (conP conName $ map varP args)
+                 (normalB [| showbParen ($(varE p) > appPrec) $(namedArgs) |])
+                 []
+encodeArgs p (RecC conName []) = encodeArgs p $ NormalC conName []
+encodeArgs p (RecC conName ts) = do
+    args <- mapM newName ["arg" ++ S.show n | (_, n) <- zip ts [1 :: Int ..]]
+    
+    let showArgs       = concatMap (\(arg, (argName, _, argTy))
+                                      -> [ [| fromString $(stringE (nameBase argName)) |]
+                                         , [| fromString " = "                         |]
+                                         , showbPrecPrim 0 argTy arg
+                                         , [| fromString ", "                          |]
+                                         ]
+                                   )
+                                   (zip args ts)
+        braceCommaArgs = [| s '{' |] : take (length showArgs - 1) showArgs
+        mappendArgs    = foldr (flip infixApp [| (<>) |])
+                           [| s '}' |]
+                           braceCommaArgs
+        namedArgs      = [| fromString $(stringE (nameBase conName)) <> showbSpace <> $(mappendArgs) |]
+    
+    match (conP conName $ map varP args)
+          (normalB [| showbParen ($(varE p) > appPrec) $(namedArgs) |])
+          []
+encodeArgs p (InfixC (_, alTy) conName (_, arTy)) = do
+    al   <- newName "argL"
+    ar   <- newName "argR"
+    info <- reify conName
+    
+    let conPrec  = case info of
+                        DataConI _ _ _ (Fixity prec _) -> prec
+                        other -> error $ "Text.Show.Text.TH.encodeArgs: Unsupported type: " ++ S.show other
+        opName   = nameBase conName
+        infixOpE = if isInfixTypeCon opName
+                     then [| fromString opName |]
+                     else [| s '`' <> fromString opName <> s '`' |]
+    
+    match (infixP (varP al) conName (varP ar))
+          (normalB $ appE [| showbParen ($(varE p) > conPrec) |]
+                          [| $(showbPrecPrim (conPrec + 1) alTy al)
+                          <> showbSpace
+                          <> $(infixOpE)
+                          <> showbSpace
+                          <> $(showbPrecPrim (conPrec + 1) arTy ar)
+                          |]
+          )
+          []
+encodeArgs p (ForallC _ _ con) = encodeArgs p con
+
+-------------------------------------------------------------------------------
+-- Utility functions
+-------------------------------------------------------------------------------
+
+-- | Checks if an type variable has an unlifted type that can be shown. If so,
+-- wrap it in its corresponding constructor and show it. Otherwise, only show
+-- the type variable.
+showbPrecPrim :: Int -> Type -> Name -> Q Exp
+#if __GLASGOW_HASKELL__ >= 712
+-- Starting with GHC 7.10, data types containing unlifted types with derived @Show@
+-- instances show hashed literals with actual hash signs, and negative hashed
+-- literals are not surrounded with parentheses.
+showbPrecPrim p (ConT tyName) tyVarName = showE
+  where
+    tyVarE :: Q Exp
+    tyVarE = varE tyVarName
+    
+    showE :: Q Exp
+    showE | tyName == ''Char#   = [| showbPrec 0 (C# $(tyVarE)) <> s '#'           |]
+          | tyName == ''Double# = [| showbPrec 0 (D# $(tyVarE)) <> fromString "##" |]
+          | tyName == ''Float#  = [| showbPrec 0 (F# $(tyVarE)) <> s '#'           |]
+          | tyName == ''Int#    = [| showbPrec 0 (I# $(tyVarE)) <> s '#'           |]
+          | tyName == ''Word#   = [| showbPrec 0 (W# $(tyVarE)) <> fromString "##" |]
+          | otherwise = [| showbPrec p $(tyVarE) |]
+#else
+showbPrecPrim p (ConT tyName) tyVarName = [| showbPrec p $(expr) |]
+  where
+    tyVarE :: Q Exp
+    tyVarE = varE tyVarName
+    
+    expr :: Q Exp
+    expr | tyName == ''Char#   = [| C# $(tyVarE) |]
+         | tyName == ''Double# = [| D# $(tyVarE) |]
+         | tyName == ''Float#  = [| F# $(tyVarE) |]
+         | tyName == ''Int#    = [| I# $(tyVarE) |]
+         | tyName == ''Word#   = [| W# $(tyVarE) |]
+         | otherwise = tyVarE
+#endif
+showbPrecPrim p _ tyVarName = [| showbPrec p $(varE tyVarName) |]
+
+-- | Checks if a 'Name' represents a tuple type constructor (other than '()')
+isNonUnitTuple :: Name -> Bool
+isNonUnitTuple = isTupleString . nameBase
+
+-- | A type-restricted version of 'const'. This is useful when generating the lambda
+-- expression in 'mkShowbPrec' for a data type with only nullary constructors (since
+-- the expression wouldn't depend on the precedence). For example, if you had @data
+-- Nullary = Nullary@ and attempted to run @$(mkShowbPrec ''Nullary) Nullary@, simply
+-- ignoring the precedence argument would cause the type signature of @$(mkShowbPrec
+-- ''Nullary)@ to be @a -> Nullary -> Builder@, not @Int -> Nullary -> Builder@.
+-- 
+-- To avoid this problem, after computing the 'Builder' @b@, we call @intConst b p@,
+-- where @p@ is the precedence argument. This forces @p :: Int@.
+intConst :: a -> Int -> a
+intConst = const
+{-# INLINE intConst #-}
+
+-- | Extracts a plain type constructor's information.
+withTyCon :: Name -- ^ Name of the plain type constructor
+            -> ([TyVarBndr] -> [Con] -> Q a)
+            -- ^ Function that generates the actual code. Will be applied
+            -- to the type variable binders and constructors extracted
+            -- from the given 'Name'.
+            -> Q a
+            -- ^ Resulting value in the 'Q'uasi monad.
+withTyCon name f = do
+    info <- reify name
+    case info of
+        TyConI dec ->
+            case dec of
+                DataD    _ _ tvbs cons _ -> f tvbs cons
+                NewtypeD _ _ tvbs con  _ -> f tvbs [con]
+                other -> error $ ns ++ "Unsupported type " ++ S.show other ++ ". Must be a data type or newtype."
+        _ -> error $ ns ++ "The name must be of a plain type constructor."
+  where
+    ns :: String
+    ns = "Text.Show.Text.TH.withTyCon: "
+
+#if MIN_VERSION_template_haskell(2,7,0)
+-- | Extracts a data family name's information.
+withDataFam :: Name
+            -> ([TyVarBndr] -> [Dec] -> Q a)
+            -> Q a
+withDataFam name f = do
+    info <- reify name
+    case info of
+        FamilyI (FamilyD DataFam _ tvbs _) decs -> f tvbs decs
+        FamilyI (FamilyD TypeFam _ _    _) _    ->
+            error $ ns ++ "Cannot use a type family name."
+        other -> error $ ns ++ "Unsupported type " ++ S.show other ++ ". Must be a data family name."
+  where
+    ns :: String
+    ns = "Text.Show.Text.TH.withDataFam: "
+
+-- | Extracts a data family instance constructor's information.
+withDataFamInstCon :: Name
+                   -> (Name -> [TyVarBndr] -> Dec -> Q a)
+                   -> Q a
+withDataFamInstCon dficName f = do
+    dficInfo <- reify dficName
+    case dficInfo of
+        DataConI _ _ parentName _ -> do
+            parentInfo <- reify parentName
+            case parentInfo of
+                FamilyI (FamilyD DataFam _ _ _) _ -> withDataFam parentName $ \tvbs decs ->
+                    let sameDefDec = fromJust . flip find decs $ \dec ->
+                          case dec of
+                              DataInstD    _ _ _ cons _ -> any ((dficName ==) . constructorName) cons 
+                              NewtypeInstD _ _ _ con  _ -> dficName == constructorName con
+                              _ -> error $ ns ++ "Must be a data or newtype instance."
+                    in f parentName tvbs sameDefDec
+                _ -> error $ ns ++ "Data constructor " ++ S.show dficName ++ " is not from a data family instance."
+        other -> error $ ns ++ "Unsupported type " ++ S.show other ++ ". Must be a data family instance constructor."
+  where
+    ns :: String
+    ns = "Text.Show.Text.TH.withDataFamInstCon: "
+#endif
+
+-- | Extracts the information about the constructors from several @data@ or @newtype@
+-- declarations.
+decCons :: [Dec] -> [Con]
+decCons decs = flip concatMap decs $ \dec -> case dec of
+    DataInstD    _ _ _ cons _ -> cons
+    NewtypeInstD _ _ _ con  _ -> [con]
+    _ -> error $ "Text.Show.Text.TH.decCons: Must be a data or newtype instance."
+
+-- | Extracts the name of a constructor.
+constructorName :: Con -> Name
+constructorName (NormalC name      _  ) = name
+constructorName (RecC    name      _  ) = name
+constructorName (InfixC  _    name _  ) = name
+constructorName (ForallC _    _    con) = constructorName con
+
+-- | Extracts the name from a type variable binder.
+tvbName :: TyVarBndr -> Name
+tvbName (PlainTV  name  ) = name
+tvbName (KindedTV name _) = name
+
+-- | Applies a typeclass to several type parameters to produce the type predicate of
+-- an instance declaration.
+applyCon :: Name -> [Name] -> Q [Pred]
+applyCon con typeNames = return $ map apply typeNames
+  where
+    apply :: Name -> Pred
+    apply t =
+#if MIN_VERSION_template_haskell(2,10,0)
+        AppT (ConT con) (VarT t)
+#else
+        ClassP con [VarT t]
+#endif
+
+-- | Generates a declaration defining the 'showbPrec' function, followed by any custom
+-- pragma declarations specified by the 'PragmaOptions' argument.
+-- 
+-- The Template Haskell API for generating pragmas (as well as GHC's treatment of
+-- pragmas themselves) have changed considerably over the years, so there's a lot of
+-- CPP magic required to get this to work uniformly across different versions of GHC.
+showbPrecDecs :: PragmaOptions -> [Con] -> [Q Dec]
+#if __GLASGOW_HASKELL__ >= 702
+showbPrecDecs opts cons =
+#else
+showbPrecDecs _    cons =
+#endif
+    [ funD 'showbPrec [ clause []
+                               (normalB $ consToShow cons)
+                               []
+                      ]
+    ] ++ inlineShowbPrecDec
+      ++ inlineShowbDec
+      ++ inlineShowbListDec
+      ++ specializeDecs
+  where
+    inlineShowbPrecDec, inlineShowbDec, inlineShowbListDec :: [Q Dec]
+#if __GLASGOW_HASKELL__ >= 702
+    inlineShowbPrecDec = inline inlineShowbPrec 'showbPrec
+    inlineShowbDec     = inline inlineShowb 'showb
+    inlineShowbListDec = inline inlineShowbList 'showbList
+#else
+    inlineShowbPrecDec = []
+    inlineShowbDec     = []
+    inlineShowbListDec = []
+#endif
+          
+#if __GLASGOW_HASKELL__ >= 702
+    inline :: (PragmaOptions -> Bool) -> Name -> [Q Dec]
+    inline isInlining funName
+        | isInlining opts = [ pragInlD funName
+# if MIN_VERSION_template_haskell(2,8,0)
+                                       Inline FunLike AllPhases
+# else
+                                       (inlineSpecNoPhase True False)
+# endif
+                            ]
+        | otherwise       = []
+#endif
+          
+    specializeDecs :: [Q Dec]
+#if MIN_VERSION_template_haskell(2,8,0)
+    specializeDecs = (map . fmap) (PragmaD
+                                       . SpecialiseInstP
+                                       . AppT (ConT ''T.Show)
+                                  )
+                                  (specializeTypes opts)
+#else
+    -- There doesn't appear to be an equivalent of SpecialiseInstP in early
+    -- versions Template Haskell.
+    specializeDecs = []
+#endif
src/Text/Show/Text/Text.hs view
@@ -1,13 +1,13 @@-{-|-Module:      Text.Show.Text.Text-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Imports 'Show' instances for @Text@ modules.--}-module Text.Show.Text.Text () where-+{-|
+Module:      Text.Show.Text.Text
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Imports 'Show' instances for @Text@ modules.
+-}
+module Text.Show.Text.Text () where
+
 import Text.Show.Text.Text.Read ()
src/Text/Show/Text/Text/Read.hs view
@@ -1,79 +1,79 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Text.Show.Text.Text.Read-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Monomorphic 'Show' function for 'Lexeme' (and 'Number', if using a-recent-enough version of @base@).--/Since: 0.3/--}-module Text.Show.Text.Text.Read (-      showbLexemePrec-#if MIN_VERSION_base(4,7,0)-    , showbNumberPrec-#endif-    ) where--import Data.Text.Lazy.Builder (Builder)--import Prelude hiding (Show)--import Text.Read.Lex (Lexeme(..))-#if MIN_VERSION_base(4,7,0)-import Text.Read.Lex (Number)-#endif-import Text.Show.Text.Classes (Show(showbPrec), showbUnary)-#if MIN_VERSION_base(4,6,0)-import Text.Show.Text.Classes (FromStringShow(..))-#else-import Text.Show.Text.Data.Integral ()-import Text.Show.Text.Data.Ratio ()-#endif-import Text.Show.Text.Data.Char ()-import Text.Show.Text.Data.List ()--#include "inline.h"---- | Convert a 'Lexeme' to a 'Builder' with the given precedence.--- --- /Since: 0.3/-showbLexemePrec :: Int -> Lexeme -> Builder-showbLexemePrec p (Char c)   = showbUnary "Char"   p c-showbLexemePrec p (String s) = showbUnary "String" p s-showbLexemePrec p (Punc pun) = showbUnary "Punc"   p pun-showbLexemePrec p (Ident i)  = showbUnary "Ident"  p i-showbLexemePrec p (Symbol s) = showbUnary "Symbol" p s-#if MIN_VERSION_base(4,6,0)-showbLexemePrec p (Number n) = showbUnary "Number" p $ FromStringShow n-#else-showbLexemePrec p (Int i)    = showbUnary "Int" p i-showbLexemePrec p (Rat r)    = showbUnary "Rat" p r-#endif-showbLexemePrec _ EOF        = "EOF"--#if MIN_VERSION_base(4,7,0)--- | Convert a 'Number' to a 'Builder' with the given precedence.--- This function is only available with @base-4.7.0.0@ or later.--- --- /Since: 0.3/-showbNumberPrec :: Int -> Number -> Builder-showbNumberPrec p = showbPrec p . FromStringShow-{-# INLINE showbNumberPrec #-}-#endif--instance Show Lexeme where-    showbPrec = showbLexemePrec-    INLINE_INST_FUN(showbPrec)--#if MIN_VERSION_base(4,7,0)-instance Show Number where-    showbPrec = showbNumberPrec-    {-# INLINE showbPrec #-}-#endif+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Text.Show.Text.Text.Read
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Monomorphic 'Show' function for 'Lexeme' (and 'Number', if using a
+recent-enough version of @base@).
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Text.Read (
+      showbLexemePrec
+#if MIN_VERSION_base(4,7,0)
+    , showbNumberPrec
+#endif
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Read.Lex (Lexeme(..))
+#if MIN_VERSION_base(4,7,0)
+import Text.Read.Lex (Number)
+#endif
+import Text.Show.Text.Classes (Show(showbPrec), showbUnary)
+#if MIN_VERSION_base(4,6,0)
+import Text.Show.Text.Classes (FromStringShow(..))
+#else
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.Data.Ratio ()
+#endif
+import Text.Show.Text.Data.Char ()
+import Text.Show.Text.Data.List ()
+
+#include "inline.h"
+
+-- | Convert a 'Lexeme' to a 'Builder' with the given precedence.
+-- 
+-- /Since: 0.3/
+showbLexemePrec :: Int -> Lexeme -> Builder
+showbLexemePrec p (Char c)   = showbUnary "Char"   p c
+showbLexemePrec p (String s) = showbUnary "String" p s
+showbLexemePrec p (Punc pun) = showbUnary "Punc"   p pun
+showbLexemePrec p (Ident i)  = showbUnary "Ident"  p i
+showbLexemePrec p (Symbol s) = showbUnary "Symbol" p s
+#if MIN_VERSION_base(4,6,0)
+showbLexemePrec p (Number n) = showbUnary "Number" p $ FromStringShow n
+#else
+showbLexemePrec p (Int i)    = showbUnary "Int" p i
+showbLexemePrec p (Rat r)    = showbUnary "Rat" p r
+#endif
+showbLexemePrec _ EOF        = "EOF"
+
+#if MIN_VERSION_base(4,7,0)
+-- | Convert a 'Number' to a 'Builder' with the given precedence.
+-- This function is only available with @base-4.7.0.0@ or later.
+-- 
+-- /Since: 0.3/
+showbNumberPrec :: Int -> Number -> Builder
+showbNumberPrec p = showbPrec p . FromStringShow
+{-# INLINE showbNumberPrec #-}
+#endif
+
+instance Show Lexeme where
+    showbPrec = showbLexemePrec
+    INLINE_INST_FUN(showbPrec)
+
+#if MIN_VERSION_base(4,7,0)
+instance Show Number where
+    showbPrec = showbNumberPrec
+    {-# INLINE showbPrec #-}
+#endif
src/Text/Show/Text/Utils.hs view
@@ -1,94 +1,94 @@-{-# LANGUAGE CPP       #-}-{-# LANGUAGE MagicHash #-}-{-|-Module:      Text.Show.Text.Utils-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Miscellaneous utility functions.--}-module Text.Show.Text.Utils where--import Data.Int (Int64)-#if !(MIN_VERSION_base(4,8,0))-import Data.Monoid (Monoid(mappend, mempty))-#endif-import Data.Text (Text)-import Data.Text.Lazy (length, toStrict, unpack)-import Data.Text.Lazy.Builder (Builder, singleton, toLazyText)--import GHC.Exts (Char(C#), Int(I#))-import GHC.Prim ((+#), chr#, ord#)--import Prelude hiding (length, replicate)---- | Unsafe conversion for decimal digits.-i2d :: Int -> Char-i2d (I# i#) = C# (chr# (ord# '0'# +# i#))-{-# INLINE i2d #-}--infixr 6 <>--- | Infix 'mappend', defined here for backwards-compatibility with older versions--- of @base@.-(<>) :: Monoid m => m -> m -> m-(<>) = mappend-{-# INLINE (<>) #-}---- | Checks if a 'String' names a valid Haskell infix type constructor (i.e., does--- it begin with a colon?).-isInfixTypeCon :: String -> Bool-isInfixTypeCon (':':_) = True-isInfixTypeCon _       = False-{-# INLINE isInfixTypeCon #-}---- | Checks if a 'String' represents a tuple (other than '()')-isTupleString :: String -> Bool-isTupleString ('(':',':_) = True-isTupleString _           = False-{-# INLINE isTupleString #-}---- | A shorter name for 'singleton' for convenience's sake (since it tends to be used--- pretty often in @text-show@).-s :: Char -> Builder-s = singleton-{-# INLINE s #-}---- | Computes the length of a 'Builder'.--- --- /Since: 0.3/-lengthB :: Builder -> Int64-lengthB = length . toLazyText-{-# INLINE lengthB #-}---- | Convert a 'Builder' to a 'String' (without surrounding it with double quotes,--- as 'show' would).--- --- /Since: 0.4.1/-toString :: Builder -> String-toString = unpack . toLazyText-{-# INLINE toString #-}---- | Convert a 'Builder' to a strict 'Text'.--- --- /Since: 0.4.1/-toText :: Builder -> Text-toText = toStrict . toLazyText-{-# INLINE toText #-}---- | Merges several 'Builder's, separating them by newlines.--- --- /Since: 0.1/-unlinesB :: [Builder] -> Builder-unlinesB (b:bs) = b <> s '\n' <> unlinesB bs-unlinesB []     = mempty---- | Merges several 'Builder's, separating them by spaces.--- --- /Since: 0.1/-unwordsB :: [Builder] -> Builder-unwordsB (b:bs@(_:_)) = b <> s ' ' <> unwordsB bs-unwordsB [b]          = b-unwordsB []           = mempty+{-# LANGUAGE CPP       #-}
+{-# LANGUAGE MagicHash #-}
+{-|
+Module:      Text.Show.Text.Utils
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Miscellaneous utility functions.
+-}
+module Text.Show.Text.Utils where
+
+import Data.Int (Int64)
+#if !(MIN_VERSION_base(4,8,0))
+import Data.Monoid (Monoid(mappend, mempty))
+#endif
+import Data.Text (Text)
+import Data.Text.Lazy (length, toStrict, unpack)
+import Data.Text.Lazy.Builder (Builder, singleton, toLazyText)
+
+import GHC.Exts (Char(C#), Int(I#))
+import GHC.Prim ((+#), chr#, ord#)
+
+import Prelude hiding (length, replicate)
+
+-- | Unsafe conversion for decimal digits.
+i2d :: Int -> Char
+i2d (I# i#) = C# (chr# (ord# '0'# +# i#))
+{-# INLINE i2d #-}
+
+infixr 6 <>
+-- | Infix 'mappend', defined here for backwards-compatibility with older versions
+-- of @base@.
+(<>) :: Monoid m => m -> m -> m
+(<>) = mappend
+{-# INLINE (<>) #-}
+
+-- | Checks if a 'String' names a valid Haskell infix type constructor (i.e., does
+-- it begin with a colon?).
+isInfixTypeCon :: String -> Bool
+isInfixTypeCon (':':_) = True
+isInfixTypeCon _       = False
+{-# INLINE isInfixTypeCon #-}
+
+-- | Checks if a 'String' represents a tuple (other than '()')
+isTupleString :: String -> Bool
+isTupleString ('(':',':_) = True
+isTupleString _           = False
+{-# INLINE isTupleString #-}
+
+-- | A shorter name for 'singleton' for convenience's sake (since it tends to be used
+-- pretty often in @text-show@).
+s :: Char -> Builder
+s = singleton
+{-# INLINE s #-}
+
+-- | Computes the length of a 'Builder'.
+-- 
+-- /Since: 0.3/
+lengthB :: Builder -> Int64
+lengthB = length . toLazyText
+{-# INLINE lengthB #-}
+
+-- | Convert a 'Builder' to a 'String' (without surrounding it with double quotes,
+-- as 'show' would).
+-- 
+-- /Since: 0.4.1/
+toString :: Builder -> String
+toString = unpack . toLazyText
+{-# INLINE toString #-}
+
+-- | Convert a 'Builder' to a strict 'Text'.
+-- 
+-- /Since: 0.4.1/
+toText :: Builder -> Text
+toText = toStrict . toLazyText
+{-# INLINE toText #-}
+
+-- | Merges several 'Builder's, separating them by newlines.
+-- 
+-- /Since: 0.1/
+unlinesB :: [Builder] -> Builder
+unlinesB (b:bs) = b <> s '\n' <> unlinesB bs
+unlinesB []     = mempty
+
+-- | Merges several 'Builder's, separating them by spaces.
+-- 
+-- /Since: 0.1/
+unwordsB :: [Builder] -> Builder
+unwordsB (b:bs@(_:_)) = b <> s ' ' <> unwordsB bs
+unwordsB [b]          = b
+unwordsB []           = mempty
tests/Derived.hs view
@@ -1,303 +1,303 @@-{-# LANGUAGE CPP                        #-}-{-# LANGUAGE DeriveGeneric              #-}-{-# LANGUAGE ExistentialQuantification  #-}-{-# LANGUAGE FlexibleContexts           #-}-{-# LANGUAGE FlexibleInstances          #-}-{-# LANGUAGE GADTs                      #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE MagicHash                  #-}-{-# LANGUAGE MultiParamTypeClasses      #-}-{-# LANGUAGE StandaloneDeriving         #-}-{-# LANGUAGE TypeOperators              #-}-{-# LANGUAGE UndecidableInstances       #-}-#if MIN_VERSION_template_haskell(2,7,0)-{-# LANGUAGE TypeFamilies               #-}-#endif-#if __GLASGOW_HASKELL__ >= 706--- GHC 7.4 also supports PolyKinds, but Template Haskell doesn't seem to play--- nicely with it for some reason.-{-# LANGUAGE PolyKinds                  #-}-#endif-#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710--- Starting with GHC 7.10, NullaryTypeClasses was deprecated in favor of--- MultiParamTypeClasses, which is already enabled-{-# LANGUAGE NullaryTypeClasses         #-}-#endif-{-|-Module:      Derived-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Defines data types with derived 'Show' instances (using "Text.Show.Text.TH")-for testing purposes.--}-module Derived (-      Nullary(..)-    , PhantomNullary(..)-    , MonomorphicUnary(..)-    , PolymorphicUnary(..)-    , MonomorphicProduct(..)-    , PolymorphicProduct(..)-    , MonomorphicRecord(..)-    , PolymorphicRecord(..)-    , MonomorphicInfix(..)-    , PolymorphicInfix(..)-    , MonomorphicForall(..)-    , PolymorphicForall(..)-    , AllAtOnce(..)-    , GADT(..)-    , PrimADT#(..)-    , LeftAssocTree(..)-    , RightAssocTree(..)-    , (:?:)(..)-    , HigherKindedTypeParams(..)-    , Restriction(..)-    , RestrictedContext(..)-    , Fix(..)-#if MIN_VERSION_template_haskell(2,7,0)-    , AllShow(..)-    , NotAllShow(..)-    , OneDataInstance(..)-    , AssocClass1(..)-    , AssocData1(..)-    , AssocClass2(..)-    , AssocData2(..)-    -- , AssocClass3(..)-    -- , AssocData3(..)-# if __GLASGOW_HASKELL__ >= 708-    , NullaryClass(..)-    , NullaryData(..)-# endif-    , GADTFam(..)-#endif-    ) where--import           GHC.Generics (Generic)-import           GHC.Prim (Char#, Double#, Float#, Int#, Word#)--import           Prelude hiding (Show)--import           Test.Tasty.QuickCheck (Arbitrary)--import qualified Text.Show as S (Show)-import qualified Text.Show.Text as T (Show)--data Nullary = Nullary deriving (S.Show, Generic)--data PhantomNullary a = PhantomNullary deriving (S.Show, Generic)--newtype MonomorphicUnary = MonomorphicUnary Int deriving (S.Show, Generic)--newtype PolymorphicUnary a b = PolymorphicUnary a deriving (S.Show, Generic)--data MonomorphicProduct = MonomorphicProduct Char Double Int deriving (S.Show, Generic)--data PolymorphicProduct a b c d = PolymorphicProduct a b c deriving (S.Show, Generic)--data MonomorphicRecord = MonomorphicRecord {-    monomorphicRecord1 :: Char-  , monomorphicRecord2 :: Double-  , monomorphicRecord3 :: Int-} deriving (S.Show, Generic)--data PolymorphicRecord a b c d = PolymorphicRecord {-    polymorphicRecord1 :: a-  , polymorphicRecord2 :: b-  , polymorphicRecord3 :: c-} deriving (S.Show, Generic)--infix 7 :/:-data MonomorphicInfix = Int :/: Double deriving (S.Show, Generic)--infix 8 `PolyInf`-data PolymorphicInfix a b c = a `PolyInf` b deriving (S.Show, Generic)---- TODO: Figure out how to create Generic instances for MonomorphicForall, PolymorphicForall,--- AllAtOnce, GADT, and PrimADT--data MonomorphicForall = forall a. (Arbitrary a, S.Show a, T.Show a) => MonomorphicForall a-deriving instance S.Show MonomorphicForall--data PolymorphicForall a b = forall c. (Arbitrary c, S.Show c, T.Show c) => PolymorphicForall a c-deriving instance S.Show a => S.Show (PolymorphicForall a b)--infix 3 :/\:-data AllAtOnce a b c d = AAONullary-                       | AAOUnary a-                       | AAOProduct a b c-                       | AAORecord {-                           aaoRecord1 :: a-                         , aaoRecord2 :: b-                         , aaoRecord3 :: c-                       }-                       | a :/\: b-                       | forall e. (Arbitrary e, S.Show e, T.Show e) => AAOForall a c e-deriving instance (S.Show a, S.Show b, S.Show c) => S.Show (AllAtOnce a b c d)--data GADT a b c where-    GADTCon1 ::           GADT Char   b      c-    GADTCon2 :: Double -> GADT Double Double c-    GADTCon3 :: Int    -> GADT Int    String c-    GADTCon4 :: a      -> GADT a      b      c-    GADTCon5 :: b      -> GADT b      b      c-deriving instance (S.Show a, S.Show b) => S.Show (GADT a b c)--infixr 5 `PrimInfixIntegral#`, `PrimInfixFloating#`, `PrimInfixChar#`-data PrimADT# a = PrimNormal# Int# Float# Double# Char# Word#-                | PrimRecord# {-                    primRecordInt#    :: Int#-                  , primRecordFloat#  :: Float#-                  , primRecordDouble# :: Double#-                  , primRecordChar#   :: Char#-                  , primRecordWord#   :: Word#-                }-                | Int#   `PrimInfixIntegral#` Word#-                | Float# `PrimInfixFloating#` Double#-                | Char#  `PrimInfixChar#`     Char#-                | forall b. (Arbitrary b, S.Show b, T.Show b)-                    => PrimForall# b Int# Float# Double# Char# Word#-deriving instance S.Show (PrimADT# a)--infixl 5 :<:-data LeftAssocTree a = LeftAssocLeaf a-                     | LeftAssocTree a :<: LeftAssocTree a-  deriving (S.Show, Generic)--infixl 5 :>:-data RightAssocTree a = RightAssocLeaf a-                      | RightAssocTree a :>: RightAssocTree a-  deriving (S.Show, Generic)--infix 4 :?:-data a :?: b = a :?: b deriving (S.Show, Generic)--newtype HigherKindedTypeParams f a = HigherKindedTypeParams (f a) deriving (S.Show, Generic)--newtype Restriction a = Restriction a deriving Generic-deriving instance (Read a, S.Show a) => S.Show (Restriction a)--newtype RestrictedContext a = RestrictedContext (Restriction a) deriving (S.Show, Generic)--newtype Fix f = Fix (f (Fix f)) deriving Generic-deriving instance S.Show (f (Fix f)) => S.Show (Fix f)--#if MIN_VERSION_template_haskell(2,7,0)-infix 2 `ASInfix`-data family AllShow a b c d :: *-data instance AllShow () () c d = ASNullary-  deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-           {- Woraround for a bizarre bug in older GHCs -}-           , Generic-# endif-           )-newtype instance AllShow Int b c d = ASUnary Int-  deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-           {- Woraround for a bizarre bug in older GHCs -}-           , Generic-# endif-           )-data instance AllShow Bool Bool c d = ASProduct Bool Bool-  deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-           {- Woraround for a bizarre bug in older GHCs -}-           , Generic-# endif-           )-data instance AllShow Char Double c d = ASRecord {-    asRecord1 :: Char-  , asRecord2 :: Double-  , asRecord3 :: c-  } deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-             {- Woraround for a bizarre bug in older GHCs -}-             , Generic-# endif-             )-data instance AllShow Float Ordering c d = Float `ASInfix` Ordering-  deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-           {- Woraround for a bizarre bug in older GHCs -}-           , Generic-# endif-           )--data family NotAllShow a b c d :: *-data instance NotAllShow ()  ()  ()  d = NASNoShow-data instance NotAllShow Int b   Int d = NASShow1 Int Int-                                       | NASShow2 b-  deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-           {- Woraround for a bizarre bug in older GHCs -}-           , Generic-# endif-           )--infix 1 `ODIInfix`-data family OneDataInstance a b c d :: *-data instance OneDataInstance a b c d = ODINullary-                                      | ODIUnary a-                                      | ODIProduct a b-                                      | ODIRecord {-                                          odiRecord1 :: a-                                        , odiRecord2 :: b-                                        , odiRecord3 :: c-                                      }-                                      | a `ODIInfix` b-  deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-           {- Woraround for a bizarre bug in older GHCs -}-           , Generic-# endif-           )--class AssocClass1 a where-    data AssocData1 a :: *-instance AssocClass1 () where-    newtype AssocData1 () = AssocCon1 Int deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-                                                   {- Woraround for a bizarre bug in older GHCs -}-                                                   , Generic-# endif-                                                   )--class AssocClass2 a b c where-    data AssocData2 a b c :: *-instance AssocClass2 () Int Int where-    newtype AssocData2 () Int Int = AssocCon2 Int deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-                                                           {- Woraround for a bizarre bug in older GHCs -}-                                                           , Generic-# endif-                                                           )---- class AssocClass3 a b c where---     data AssocData3 a b c :: *--- instance AssocClass3 () b c where---     newtype AssocData3 () b c = AssocCon3 Int deriving ( S.Show--- # if __GLASGOW_HASKELL__ >= 706---                                                        {- Woraround for a bizarre bug in older GHCs -}---                                                        , Generic--- # endif---                                                        )--# if __GLASGOW_HASKELL__ >= 708-class NullaryClass where-    data NullaryData-instance NullaryClass where-    newtype NullaryData = NullaryCon Int deriving (S.Show, Generic)-# endif--data family GADTFam a b c :: *-data instance GADTFam a b c where-    GADTFamCon1 ::           GADTFam Char   b      c-    GADTFamCon2 :: Double -> GADTFam Double Double c-    GADTFamCon3 :: Int    -> GADTFam Int    String c-    GADTFamCon4 :: a      -> GADTFam a      b      c-    GADTFamCon5 :: b      -> GADTFam b      b      c-deriving instance (S.Show a, S.Show b) => S.Show (GADTFam a b c)-#endif+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE DeriveGeneric              #-}
+{-# LANGUAGE ExistentialQuantification  #-}
+{-# LANGUAGE FlexibleContexts           #-}
+{-# LANGUAGE FlexibleInstances          #-}
+{-# LANGUAGE GADTs                      #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash                  #-}
+{-# LANGUAGE MultiParamTypeClasses      #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# LANGUAGE TypeOperators              #-}
+{-# LANGUAGE UndecidableInstances       #-}
+#if MIN_VERSION_template_haskell(2,7,0)
+{-# LANGUAGE TypeFamilies               #-}
+#endif
+#if __GLASGOW_HASKELL__ >= 706
+-- GHC 7.4 also supports PolyKinds, but Template Haskell doesn't seem to play
+-- nicely with it for some reason.
+{-# LANGUAGE PolyKinds                  #-}
+#endif
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+-- Starting with GHC 7.10, NullaryTypeClasses was deprecated in favor of
+-- MultiParamTypeClasses, which is already enabled
+{-# LANGUAGE NullaryTypeClasses         #-}
+#endif
+{-|
+Module:      Derived
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Defines data types with derived 'Show' instances (using "Text.Show.Text.TH")
+for testing purposes.
+-}
+module Derived (
+      Nullary(..)
+    , PhantomNullary(..)
+    , MonomorphicUnary(..)
+    , PolymorphicUnary(..)
+    , MonomorphicProduct(..)
+    , PolymorphicProduct(..)
+    , MonomorphicRecord(..)
+    , PolymorphicRecord(..)
+    , MonomorphicInfix(..)
+    , PolymorphicInfix(..)
+    , MonomorphicForall(..)
+    , PolymorphicForall(..)
+    , AllAtOnce(..)
+    , GADT(..)
+    , PrimADT#(..)
+    , LeftAssocTree(..)
+    , RightAssocTree(..)
+    , (:?:)(..)
+    , HigherKindedTypeParams(..)
+    , Restriction(..)
+    , RestrictedContext(..)
+    , Fix(..)
+#if MIN_VERSION_template_haskell(2,7,0)
+    , AllShow(..)
+    , NotAllShow(..)
+    , OneDataInstance(..)
+    , AssocClass1(..)
+    , AssocData1(..)
+    , AssocClass2(..)
+    , AssocData2(..)
+    -- , AssocClass3(..)
+    -- , AssocData3(..)
+# if __GLASGOW_HASKELL__ >= 708
+    , NullaryClass(..)
+    , NullaryData(..)
+# endif
+    , GADTFam(..)
+#endif
+    ) where
+
+import           GHC.Generics (Generic)
+import           GHC.Prim (Char#, Double#, Float#, Int#, Word#)
+
+import           Prelude hiding (Show)
+
+import           Test.Tasty.QuickCheck (Arbitrary)
+
+import qualified Text.Show as S (Show)
+import qualified Text.Show.Text as T (Show)
+
+data Nullary = Nullary deriving (S.Show, Generic)
+
+data PhantomNullary a = PhantomNullary deriving (S.Show, Generic)
+
+newtype MonomorphicUnary = MonomorphicUnary Int deriving (S.Show, Generic)
+
+newtype PolymorphicUnary a b = PolymorphicUnary a deriving (S.Show, Generic)
+
+data MonomorphicProduct = MonomorphicProduct Char Double Int deriving (S.Show, Generic)
+
+data PolymorphicProduct a b c d = PolymorphicProduct a b c deriving (S.Show, Generic)
+
+data MonomorphicRecord = MonomorphicRecord {
+    monomorphicRecord1 :: Char
+  , monomorphicRecord2 :: Double
+  , monomorphicRecord3 :: Int
+} deriving (S.Show, Generic)
+
+data PolymorphicRecord a b c d = PolymorphicRecord {
+    polymorphicRecord1 :: a
+  , polymorphicRecord2 :: b
+  , polymorphicRecord3 :: c
+} deriving (S.Show, Generic)
+
+infix 7 :/:
+data MonomorphicInfix = Int :/: Double deriving (S.Show, Generic)
+
+infix 8 `PolyInf`
+data PolymorphicInfix a b c = a `PolyInf` b deriving (S.Show, Generic)
+
+-- TODO: Figure out how to create Generic instances for MonomorphicForall, PolymorphicForall,
+-- AllAtOnce, GADT, and PrimADT
+
+data MonomorphicForall = forall a. (Arbitrary a, S.Show a, T.Show a) => MonomorphicForall a
+deriving instance S.Show MonomorphicForall
+
+data PolymorphicForall a b = forall c. (Arbitrary c, S.Show c, T.Show c) => PolymorphicForall a c
+deriving instance S.Show a => S.Show (PolymorphicForall a b)
+
+infix 3 :/\:
+data AllAtOnce a b c d = AAONullary
+                       | AAOUnary a
+                       | AAOProduct a b c
+                       | AAORecord {
+                           aaoRecord1 :: a
+                         , aaoRecord2 :: b
+                         , aaoRecord3 :: c
+                       }
+                       | a :/\: b
+                       | forall e. (Arbitrary e, S.Show e, T.Show e) => AAOForall a c e
+deriving instance (S.Show a, S.Show b, S.Show c) => S.Show (AllAtOnce a b c d)
+
+data GADT a b c where
+    GADTCon1 ::           GADT Char   b      c
+    GADTCon2 :: Double -> GADT Double Double c
+    GADTCon3 :: Int    -> GADT Int    String c
+    GADTCon4 :: a      -> GADT a      b      c
+    GADTCon5 :: b      -> GADT b      b      c
+deriving instance (S.Show a, S.Show b) => S.Show (GADT a b c)
+
+infixr 5 `PrimInfixIntegral#`, `PrimInfixFloating#`, `PrimInfixChar#`
+data PrimADT# a = PrimNormal# Int# Float# Double# Char# Word#
+                | PrimRecord# {
+                    primRecordInt#    :: Int#
+                  , primRecordFloat#  :: Float#
+                  , primRecordDouble# :: Double#
+                  , primRecordChar#   :: Char#
+                  , primRecordWord#   :: Word#
+                }
+                | Int#   `PrimInfixIntegral#` Word#
+                | Float# `PrimInfixFloating#` Double#
+                | Char#  `PrimInfixChar#`     Char#
+                | forall b. (Arbitrary b, S.Show b, T.Show b)
+                    => PrimForall# b Int# Float# Double# Char# Word#
+deriving instance S.Show (PrimADT# a)
+
+infixl 5 :<:
+data LeftAssocTree a = LeftAssocLeaf a
+                     | LeftAssocTree a :<: LeftAssocTree a
+  deriving (S.Show, Generic)
+
+infixl 5 :>:
+data RightAssocTree a = RightAssocLeaf a
+                      | RightAssocTree a :>: RightAssocTree a
+  deriving (S.Show, Generic)
+
+infix 4 :?:
+data a :?: b = a :?: b deriving (S.Show, Generic)
+
+newtype HigherKindedTypeParams f a = HigherKindedTypeParams (f a) deriving (S.Show, Generic)
+
+newtype Restriction a = Restriction a deriving Generic
+deriving instance (Read a, S.Show a) => S.Show (Restriction a)
+
+newtype RestrictedContext a = RestrictedContext (Restriction a) deriving (S.Show, Generic)
+
+newtype Fix f = Fix (f (Fix f)) deriving Generic
+deriving instance S.Show (f (Fix f)) => S.Show (Fix f)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+infix 2 `ASInfix`
+data family AllShow a b c d :: *
+data instance AllShow () () c d = ASNullary
+  deriving ( S.Show
+# if __GLASGOW_HASKELL__ >= 706
+           {- Woraround for a bizarre bug in older GHCs -}
+           , Generic
+# endif
+           )
+newtype instance AllShow Int b c d = ASUnary Int
+  deriving ( S.Show
+# if __GLASGOW_HASKELL__ >= 706
+           {- Woraround for a bizarre bug in older GHCs -}
+           , Generic
+# endif
+           )
+data instance AllShow Bool Bool c d = ASProduct Bool Bool
+  deriving ( S.Show
+# if __GLASGOW_HASKELL__ >= 706
+           {- Woraround for a bizarre bug in older GHCs -}
+           , Generic
+# endif
+           )
+data instance AllShow Char Double c d = ASRecord {
+    asRecord1 :: Char
+  , asRecord2 :: Double
+  , asRecord3 :: c
+  } deriving ( S.Show
+# if __GLASGOW_HASKELL__ >= 706
+             {- Woraround for a bizarre bug in older GHCs -}
+             , Generic
+# endif
+             )
+data instance AllShow Float Ordering c d = Float `ASInfix` Ordering
+  deriving ( S.Show
+# if __GLASGOW_HASKELL__ >= 706
+           {- Woraround for a bizarre bug in older GHCs -}
+           , Generic
+# endif
+           )
+
+data family NotAllShow a b c d :: *
+data instance NotAllShow ()  ()  ()  d = NASNoShow
+data instance NotAllShow Int b   Int d = NASShow1 Int Int
+                                       | NASShow2 b
+  deriving ( S.Show
+# if __GLASGOW_HASKELL__ >= 706
+           {- Woraround for a bizarre bug in older GHCs -}
+           , Generic
+# endif
+           )
+
+infix 1 `ODIInfix`
+data family OneDataInstance a b c d :: *
+data instance OneDataInstance a b c d = ODINullary
+                                      | ODIUnary a
+                                      | ODIProduct a b
+                                      | ODIRecord {
+                                          odiRecord1 :: a
+                                        , odiRecord2 :: b
+                                        , odiRecord3 :: c
+                                      }
+                                      | a `ODIInfix` b
+  deriving ( S.Show
+# if __GLASGOW_HASKELL__ >= 706
+           {- Woraround for a bizarre bug in older GHCs -}
+           , Generic
+# endif
+           )
+
+class AssocClass1 a where
+    data AssocData1 a :: *
+instance AssocClass1 () where
+    newtype AssocData1 () = AssocCon1 Int deriving ( S.Show
+# if __GLASGOW_HASKELL__ >= 706
+                                                   {- Woraround for a bizarre bug in older GHCs -}
+                                                   , Generic
+# endif
+                                                   )
+
+class AssocClass2 a b c where
+    data AssocData2 a b c :: *
+instance AssocClass2 () Int Int where
+    newtype AssocData2 () Int Int = AssocCon2 Int deriving ( S.Show
+# if __GLASGOW_HASKELL__ >= 706
+                                                           {- Woraround for a bizarre bug in older GHCs -}
+                                                           , Generic
+# endif
+                                                           )
+
+-- class AssocClass3 a b c where
+--     data AssocData3 a b c :: *
+-- instance AssocClass3 () b c where
+--     newtype AssocData3 () b c = AssocCon3 Int deriving ( S.Show
+-- # if __GLASGOW_HASKELL__ >= 706
+--                                                        {- Woraround for a bizarre bug in older GHCs -}
+--                                                        , Generic
+-- # endif
+--                                                        )
+
+# if __GLASGOW_HASKELL__ >= 708
+class NullaryClass where
+    data NullaryData
+instance NullaryClass where
+    newtype NullaryData = NullaryCon Int deriving (S.Show, Generic)
+# endif
+
+data family GADTFam a b c :: *
+data instance GADTFam a b c where
+    GADTFamCon1 ::           GADTFam Char   b      c
+    GADTFamCon2 :: Double -> GADTFam Double Double c
+    GADTFamCon3 :: Int    -> GADTFam Int    String c
+    GADTFamCon4 :: a      -> GADTFam a      b      c
+    GADTFamCon5 :: b      -> GADTFam b      b      c
+deriving instance (S.Show a, S.Show b) => S.Show (GADTFam a b c)
+#endif
tests/Instances/BaseAndFriends.hs view
@@ -1,632 +1,632 @@-{-# LANGUAGE CPP                        #-}-{-# LANGUAGE FlexibleContexts           #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-{-# LANGUAGE TypeOperators              #-}-#if MIN_VERSION_base(4,7,0)-{-# LANGUAGE TypeFamilies               #-}-# if !(MIN_VERSION_base(4,8,0))-{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}-# endif-#endif-{-# OPTIONS_GHC -fno-warn-orphans               #-}-{-|-Module:      Instances.BaseAndFriends-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Provides 'Arbitrary' instances for data types located in @base@ and other-common libraries. This module also defines 'Show' instances for some data-types as well (e.g., those which do not derive 'Show' in older versions-of GHC).--}-module Instances.BaseAndFriends () where--import           Control.Applicative (Const(..), ZipList(..))-#if !(MIN_VERSION_base(4,8,0))-import           Control.Applicative ((<*>), pure)-#endif-import           Control.Exception-import           Control.Monad.ST (ST, fixST)--import           Data.ByteString.Short (ShortByteString, pack)-import           Data.Char (GeneralCategory(..))-import qualified Data.Data as D (Fixity(..))-import           Data.Data (Constr, ConstrRep(..), DataRep(..), DataType,-                            mkConstr, mkDataType)-import           Data.Dynamic (Dynamic, toDyn)-#if !(MIN_VERSION_base(4,8,0))-import           Data.Functor ((<$>))-#endif-#if defined(VERSION_transformers)-# if !(MIN_VERSION_transformers(0,4,0))-import           Data.Functor.Classes ()-# endif-#endif-import           Data.Functor.Identity (Identity(..))-import           Data.Monoid (All(..), Any(..), Dual(..), First(..),-                              Last(..), Product(..), Sum(..))-#if MIN_VERSION_base(4,8,0)-import           Data.Monoid (Alt(..))-#endif-#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-import qualified Data.OldTypeable.Internal as OldT (TyCon(..), TypeRep(..))-#endif-#if MIN_VERSION_base(4,6,0)-import           Data.Ord (Down(..))-#endif-import           Data.Proxy (Proxy(..))-import           Data.Text.Lazy.Builder (Builder, fromString)-#if MIN_VERSION_base(4,7,0)-import           Data.Coerce (Coercible)-import           Data.Type.Coercion (Coercion(..))-import           Data.Type.Equality ((:~:)(..))-#endif-import qualified Data.Typeable.Internal as NewT (TyCon(..), TypeRep(..))-import           Data.Version (Version(..))--import           Foreign.C.Types-import           Foreign.Ptr (FunPtr, IntPtr, Ptr, WordPtr,-                              castPtrToFunPtr, nullPtr, plusPtr,-                              ptrToIntPtr, ptrToWordPtr)--import           GHC.Conc (BlockReason(..), ThreadStatus(..))-#if !(defined(__GHCJS__))-# if defined(mingw32_HOST_OS)-import           GHC.Conc.Windows (ConsoleEvent(..))-# else-import           GHC.Event (Event, evtRead, evtWrite)-# endif-#endif-import           GHC.Fingerprint.Type (Fingerprint(..))-import           GHC.IO.Encoding.Failure (CodingFailureMode(..))-import           GHC.IO.Encoding.Types (CodingProgress(..))-import           GHC.IO.Exception (IOException(..), IOErrorType(..))-import           GHC.IO.Handle (HandlePosn(..))-import qualified GHC.Generics as G (Fixity(..))-import           GHC.Generics (U1(..), Par1(..), Rec1(..), K1(..),-                               M1(..), (:+:)(..), (:*:)(..), (:.:)(..),-                               Associativity(..), Arity(..))-#if MIN_VERSION_base(4,8,0)-import           GHC.RTS.Flags-import           GHC.StaticPtr (StaticPtrInfo(..))-#endif-#if !(MIN_VERSION_base(4,8,0))-import           GHC.Show (appPrec, appPrec1)-#endif-import           GHC.Stats (GCStats(..))-#if MIN_VERSION_base(4,7,0)-import           GHC.TypeLits (SomeNat, SomeSymbol, someNatVal, someSymbolVal)-#endif--import           Instances.Utils ((<@>))--import           Numeric (showHex)-#if !(MIN_VERSION_QuickCheck(2,8,0) && MIN_VERSION_base(4,8,0))-import           Numeric.Natural (Natural)-#endif--import           System.Exit (ExitCode(..))-import           System.IO (BufferMode(..), IOMode(..), Newline(..), NewlineMode(..),-                            SeekMode(..), Handle, stdin, stdout, stderr)-import           System.Posix.Types--import           Test.Tasty.QuickCheck (Arbitrary(arbitrary), Gen,-                                        arbitraryBoundedEnum, oneof, suchThat)--import           Text.Read.Lex as Lex (Lexeme(..))-#if MIN_VERSION_base(4,7,0)-import           Data.Fixed (Fixed, E12)-import           Text.Read.Lex (Number)-#endif-import           Text.Show.Text (FromStringShow(..), FromTextShow(..))-import           Text.Show.Text.Generic (ConType(..))--#if MIN_VERSION_base(4,7,0)-import           Numeric (showOct, showEFloat, showFFloat, showGFloat)-import           Test.Tasty.QuickCheck (getNonNegative)-# if !(MIN_VERSION_base(4,8,0))-import           Data.Word (Word)-# endif-#else-import           Data.Word (Word64)-#endif--#include "HsBaseConfig.h"--#if !(MIN_VERSION_QuickCheck(2,8,0) && MIN_VERSION_base(4,8,0))-instance Arbitrary Natural where-    arbitrary = fromInteger <$> arbitrary `suchThat` (>= 0)-#endif--instance Arbitrary Builder where-    arbitrary = fromString <$> arbitrary--instance Arbitrary ShortByteString where-    arbitrary = pack <$> arbitrary--instance Arbitrary (Ptr a) where-    arbitrary = plusPtr nullPtr <$> arbitrary--instance Arbitrary (FunPtr a) where-    arbitrary = castPtrToFunPtr <$> arbitrary--instance Arbitrary IntPtr where-    arbitrary = ptrToIntPtr <$> arbitrary--instance Arbitrary WordPtr where-    arbitrary = ptrToWordPtr <$> arbitrary--instance Arbitrary GeneralCategory where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary Version where-    arbitrary = Version <$> arbitrary <*> arbitrary--instance Arbitrary SomeException where-    arbitrary = SomeException <$> (arbitrary :: Gen AssertionFailed)--instance Arbitrary IOException where-    arbitrary = IOError <$> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary--deriving instance Bounded IOErrorType-deriving instance Enum IOErrorType-instance Arbitrary IOErrorType where-    arbitrary = arbitraryBoundedEnum--deriving instance Bounded ArithException-deriving instance Enum ArithException-instance Arbitrary ArithException where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary ArrayException where-    arbitrary = oneof [ IndexOutOfBounds <$> arbitrary-                      , UndefinedElement <$> arbitrary-                      ]--instance Arbitrary AssertionFailed where-    arbitrary = AssertionFailed <$> arbitrary--#if MIN_VERSION_base(4,7,0)-instance Arbitrary SomeAsyncException where-    arbitrary = SomeAsyncException <$> (arbitrary :: Gen AsyncException)-#endif--deriving instance Bounded AsyncException-deriving instance Enum AsyncException-instance Arbitrary AsyncException where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary NonTermination where-    arbitrary = pure NonTermination--instance Arbitrary NestedAtomically where-    arbitrary = pure NestedAtomically--instance Arbitrary BlockedIndefinitelyOnMVar where-    arbitrary = pure BlockedIndefinitelyOnMVar--instance Arbitrary BlockedIndefinitelyOnSTM where-    arbitrary = pure BlockedIndefinitelyOnSTM--#if MIN_VERSION_base(4,8,0)-instance Arbitrary AllocationLimitExceeded where-    arbitrary = pure AllocationLimitExceeded-#endif--instance Arbitrary Deadlock where-    arbitrary = pure Deadlock--instance Arbitrary NoMethodError where-    arbitrary = NoMethodError <$> arbitrary--instance Arbitrary PatternMatchFail where-    arbitrary = PatternMatchFail <$> arbitrary--instance Arbitrary RecConError where-    arbitrary = RecConError <$> arbitrary--instance Arbitrary RecSelError where-    arbitrary = RecSelError <$> arbitrary--instance Arbitrary RecUpdError where-    arbitrary = RecUpdError <$> arbitrary---- ErrorCall is a newtype starting with base-4.7.0.0, but we'll--- manually derive Arbitrary to support older versions of GHC.-instance Arbitrary ErrorCall where-    arbitrary = ErrorCall <$> arbitrary--deriving instance Bounded MaskingState-deriving instance Enum MaskingState-instance Arbitrary MaskingState where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary Lexeme where-    arbitrary = oneof [ Char   <$> arbitrary-                      , String <$> arbitrary-                      , Punc   <$> arbitrary-                      , Ident  <$> arbitrary-                      , Symbol <$> arbitrary-#if MIN_VERSION_base(4,7,0)-                      , Number <$> arbitrary-#elif !(MIN_VERSION_base(4,6,0))-                      , Int    <$> arbitrary-                      , Rat    <$> arbitrary-#endif-                      , pure Lex.EOF-                      ]-    -#if MIN_VERSION_base(4,7,0)-instance Arbitrary Number where-    arbitrary = do-        str <- oneof [ show <$> (nonneg :: Gen Double)-                     , fmap (\d -> showEFloat Nothing d "") (nonneg :: Gen Double)-                     , fmap (\d -> showFFloat Nothing d "") (nonneg :: Gen Double)-                     , fmap (\d -> showGFloat Nothing d "") (nonneg :: Gen Double)-                     , show <$> (nonneg :: Gen Float)-                     , show <$> (nonneg :: Gen Int)-                     , fmap (\i -> "0x" ++ showHex i "") (nonneg :: Gen Int)-                     , fmap (\i -> "0o" ++ showOct i "") (nonneg :: Gen Int)-                     , show <$> (nonneg :: Gen Integer)-                     , show <$> (nonneg :: Gen Word)-                     , show <$> (nonneg :: Gen (Fixed E12))-                     ]-        let Number num = read str-        pure num-      where-        nonneg :: (Arbitrary a, Num a, Ord a) => Gen a-        nonneg = getNonNegative <$> arbitrary-#endif--instance Arbitrary (Proxy s) where-    arbitrary = pure Proxy--#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-instance Arbitrary OldT.TypeRep where-    arbitrary = OldT.TypeRep <$> arbitrary <*> arbitrary <@> []---     arbitrary = OldT.TypeRep <$> arbitrary <*> arbitrary <*> arbitrary--instance Arbitrary OldT.TyCon where-    arbitrary = OldT.TyCon <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-#endif--instance Arbitrary NewT.TypeRep where-    arbitrary = NewT.TypeRep <$> arbitrary <*> arbitrary-#if MIN_VERSION_base(4,8,0)-                                                         <@> [] <@> []-#else-                                                         <@> []-#endif--instance Arbitrary NewT.TyCon where-    arbitrary = NewT.TyCon <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary--instance Arbitrary Fingerprint where-    arbitrary = Fingerprint <$> arbitrary <*> arbitrary--#if !(MIN_VERSION_base(4,7,0))-instance Show Fingerprint where-  show (Fingerprint w1 w2) = hex16 w1 ++ hex16 w2-    where-      -- Formats a 64 bit number as 16 digits hex.-      hex16 :: Word64 -> String-      hex16 i = let hex = showHex i ""-                 in replicate (16 - length hex) '0' ++ hex-#endif--instance Arbitrary Dynamic where-    arbitrary = toDyn <$> (arbitrary :: Gen Int)--instance Arbitrary Constr where-    arbitrary = mkConstr <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary--instance Arbitrary ConstrRep where-    arbitrary = oneof [ AlgConstr   <$> arbitrary-                      , IntConstr   <$> arbitrary-                      , FloatConstr <$> arbitrary-                      , CharConstr  <$> arbitrary-                      ]--instance Arbitrary DataRep where-    arbitrary = oneof [ AlgRep <$> arbitrary-                      , pure IntRep-                      , pure FloatRep-                      , pure CharRep-                      , pure NoRep-                      ]--instance Arbitrary DataType where-    arbitrary = mkDataType <$> arbitrary <*> arbitrary--deriving instance Bounded D.Fixity-deriving instance Enum D.Fixity-instance Arbitrary D.Fixity where-    arbitrary = arbitraryBoundedEnum--#if MIN_VERSION_base(4,7,0)-instance Coercible a b => Arbitrary (Coercion a b) where-    arbitrary = pure Coercion--instance a ~ b => Arbitrary (a :~: b) where-    arbitrary = pure Refl-#endif--deriving instance Bounded BlockReason-deriving instance Enum BlockReason-instance Arbitrary BlockReason where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary ThreadStatus where-    arbitrary = oneof [ pure ThreadRunning-                      , pure ThreadFinished-                      , ThreadBlocked <$> arbitrary-                      , pure ThreadDied-                      ]--#if !(defined(__GHCJS__))-# if defined(mingw32_HOST_OS)-deriving instance Bounded ConsoleEvent-instance Arbitrary ConsoleEvent where-    arbitrary = arbitraryBoundedEnum-# else-instance Arbitrary Event where-    arbitrary = oneof $ map pure [evtRead, evtWrite]---- TODO: instance Arbitrary FdKey-# endif-#endif--instance Arbitrary (ST s a) where-    arbitrary = pure $ fixST undefined--instance Arbitrary Handle where-    arbitrary = oneof $ map pure [stdin, stdout, stderr]--instance Arbitrary HandlePosn where-    arbitrary = HandlePosn <$> arbitrary <*> arbitrary--deriving instance Bounded IOMode-instance Arbitrary IOMode where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary BufferMode where-    arbitrary = oneof [ pure NoBuffering-                      , pure LineBuffering-                      , BlockBuffering <$> arbitrary-                      ]--deriving instance Bounded SeekMode-instance Arbitrary SeekMode where-    arbitrary = arbitraryBoundedEnum--deriving instance Bounded Newline-deriving instance Enum Newline-instance Arbitrary Newline where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary NewlineMode where-    arbitrary = NewlineMode <$> arbitrary <*> arbitrary--deriving instance Bounded CodingProgress-deriving instance Enum CodingProgress-instance Arbitrary CodingProgress where-    arbitrary = arbitraryBoundedEnum--deriving instance Bounded CodingFailureMode-deriving instance Enum CodingFailureMode-instance Arbitrary CodingFailureMode where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary GCStats where-    arbitrary = GCStats <$> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary--instance Arbitrary (U1 p) where-    arbitrary = pure U1--instance Arbitrary p => Arbitrary (Par1 p) where-    arbitrary = Par1 <$> arbitrary--instance Arbitrary (f p) => Arbitrary (Rec1 f p) where-    arbitrary = Rec1 <$> arbitrary--instance Arbitrary c => Arbitrary (K1 i c p) where-    arbitrary = K1 <$> arbitrary--instance Arbitrary (f p) => Arbitrary (M1 i c f p) where-    arbitrary = M1 <$> arbitrary--instance (Arbitrary (f p), Arbitrary (g p)) => Arbitrary ((f :+: g) p) where-    arbitrary = oneof [L1 <$> arbitrary, R1 <$> arbitrary]--instance (Arbitrary (f p), Arbitrary (g p)) => Arbitrary ((f :*: g) p) where-    arbitrary = (:*:) <$> arbitrary <*> arbitrary--instance Arbitrary (f (g p)) => Arbitrary ((f :.: g) p) where-    arbitrary = Comp1 <$> arbitrary--instance Arbitrary G.Fixity where-    arbitrary = oneof [pure G.Prefix, G.Infix <$> arbitrary <*> arbitrary]--deriving instance Bounded Associativity-deriving instance Enum Associativity-instance Arbitrary Associativity where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary Arity where-    arbitrary = oneof [pure NoArity, Arity <$> arbitrary]--#if !(MIN_VERSION_base(4,7,0))-deriving instance                             Show (U1 p)-deriving instance Show p                   => Show (Par1 p)-deriving instance Show (f p)               => Show (Rec1 f p)-deriving instance Show c                   => Show (K1 i c p)-deriving instance Show (f p)               => Show (M1 i c f p)-deriving instance (Show (f p), Show (g p)) => Show ((f :+: g) p)---- Due to a GHC bug (https://ghc.haskell.org/trac/ghc/ticket/9830), this Show--- instance produces output with the wrong precedence on older versions of GHC.--- I'll manually define the Show instance to get the correct behavior.-instance (Show (f p), Show (g p)) => Show ((f :*: g) p) where-    showsPrec p (l :*: r) = showParen (p > prec) $-          showsPrec (prec + 1) l-        . showString " :*: "-        . showsPrec (prec + 1) r-      where prec = 6--deriving instance Show (f (g p))           => Show ((f :.: g) p)-#endif--#if MIN_VERSION_base(4,8,0)-instance Arbitrary ConcFlags where-    arbitrary = ConcFlags <$> arbitrary <*> arbitrary--instance Arbitrary MiscFlags where-    arbitrary = MiscFlags <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary--instance Arbitrary DebugFlags where-    arbitrary = DebugFlags <$> arbitrary <*> arbitrary <*> arbitrary-                           <*> arbitrary <*> arbitrary <*> arbitrary-                           <*> arbitrary <*> arbitrary <*> arbitrary-                           <*> arbitrary <*> arbitrary <*> arbitrary-                           <*> arbitrary <*> arbitrary <*> arbitrary--instance Arbitrary TickyFlags where-    arbitrary = TickyFlags <$> arbitrary <*> arbitrary--instance Arbitrary StaticPtrInfo where-    arbitrary = StaticPtrInfo <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-#endif---- #if MIN_VERSION_base(4,6,0) && !(MIN_VERSION_base(4,7,0))--- TODO: instance Arbitrary (IsZero n)--- TODO: instance Arbitrary (IsEven n)--- #endif--#if MIN_VERSION_base(4,7,0)-instance Arbitrary SomeNat where-    arbitrary = do-        nat <- arbitrary `suchThat` (>= 0)-        case someNatVal nat of-             Just sn -> pure sn-             Nothing -> fail "Negative natural number"--instance Arbitrary SomeSymbol where-    arbitrary = someSymbolVal <$> arbitrary-#endif--instance Arbitrary ConType where-    arbitrary = oneof [pure Rec, pure Tup, pure Pref, Inf <$> arbitrary]--deriving instance Arbitrary CChar-deriving instance Arbitrary CSChar-deriving instance Arbitrary CUChar-deriving instance Arbitrary CShort-deriving instance Arbitrary CUShort-deriving instance Arbitrary CInt-deriving instance Arbitrary CUInt-deriving instance Arbitrary CLong-deriving instance Arbitrary CULong-deriving instance Arbitrary CLLong-deriving instance Arbitrary CULLong-deriving instance Arbitrary CFloat-deriving instance Arbitrary CDouble-deriving instance Arbitrary CPtrdiff-deriving instance Arbitrary CSize-deriving instance Arbitrary CWchar-deriving instance Arbitrary CSigAtomic-deriving instance Arbitrary CClock-deriving instance Arbitrary CTime-deriving instance Arbitrary CUSeconds-deriving instance Arbitrary CSUSeconds-deriving instance Arbitrary CIntPtr-deriving instance Arbitrary CUIntPtr-deriving instance Arbitrary CIntMax-deriving instance Arbitrary CUIntMax--instance Arbitrary ExitCode where-    arbitrary = oneof [pure ExitSuccess, ExitFailure <$> arbitrary]--#if defined(HTYPE_DEV_T)-deriving instance Arbitrary CDev-#endif-#if defined(HTYPE_INO_T)-deriving instance Arbitrary CIno-#endif-#if defined(HTYPE_MODE_T)-deriving instance Arbitrary CMode-#endif-#if defined(HTYPE_OFF_T)-deriving instance Arbitrary COff-#endif-#if defined(HTYPE_PID_T)-deriving instance Arbitrary CPid-#endif-#if defined(HTYPE_SSIZE_T)-deriving instance Arbitrary CSsize-#endif-#if defined(HTYPE_GID_T)-deriving instance Arbitrary CGid-#endif-#if defined(HTYPE_NLINK_T)-deriving instance Arbitrary CNlink-#endif-#if defined(HTYPE_UID_T)-deriving instance Arbitrary CUid-#endif-#if defined(HTYPE_CC_T)-deriving instance Arbitrary CCc-#endif-#if defined(HTYPE_SPEED_T)-deriving instance Arbitrary CSpeed-#endif-#if defined(HTYPE_TCFLAG_T)-deriving instance Arbitrary CTcflag-#endif-#if defined(HTYPE_RLIM_T)-deriving instance Arbitrary CRLim-#endif-deriving instance Arbitrary Fd--deriving instance Arbitrary All-deriving instance Arbitrary Any-deriving instance Arbitrary a => Arbitrary (Dual a)-deriving instance Arbitrary a => Arbitrary (First a)-deriving instance Arbitrary a => Arbitrary (Last a)-deriving instance Arbitrary a => Arbitrary (Product a)-deriving instance Arbitrary a => Arbitrary (Sum a)-#if MIN_VERSION_base(4,8,0)-deriving instance Arbitrary (f a) => Arbitrary (Alt f a)-#endif--deriving instance Arbitrary a => Arbitrary (Const a b)-#if !(MIN_VERSION_base(4,8,0))-instance Show a => Show (Const a b) where-    showsPrec p (Const x) = showParen (p > appPrec)-        $ showString "Const " . showsPrec appPrec1 x-#endif-deriving instance Arbitrary a => Arbitrary (ZipList a)-#if !(MIN_VERSION_base(4,7,0))-deriving instance Show a => Show (ZipList a)-#endif--#if MIN_VERSION_base(4,6,0)-deriving instance Arbitrary a => Arbitrary (Down a)-#if !(MIN_VERSION_base(4,7,0))-deriving instance Show a => Show (Down a)-#endif-#endif--deriving instance Arbitrary a => Arbitrary (Identity a)--deriving instance Arbitrary a => Arbitrary (FromStringShow a)-deriving instance Arbitrary a => Arbitrary (FromTextShow a)+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE FlexibleContexts           #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# LANGUAGE TypeOperators              #-}
+#if MIN_VERSION_base(4,7,0)
+{-# LANGUAGE TypeFamilies               #-}
+# if !(MIN_VERSION_base(4,8,0))
+{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
+# endif
+#endif
+{-# OPTIONS_GHC -fno-warn-orphans               #-}
+{-|
+Module:      Instances.BaseAndFriends
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Provides 'Arbitrary' instances for data types located in @base@ and other
+common libraries. This module also defines 'Show' instances for some data
+types as well (e.g., those which do not derive 'Show' in older versions
+of GHC).
+-}
+module Instances.BaseAndFriends () where
+
+import           Control.Applicative (Const(..), ZipList(..))
+#if !(MIN_VERSION_base(4,8,0))
+import           Control.Applicative ((<*>), pure)
+#endif
+import           Control.Exception
+import           Control.Monad.ST (ST, fixST)
+
+import           Data.ByteString.Short (ShortByteString, pack)
+import           Data.Char (GeneralCategory(..))
+import qualified Data.Data as D (Fixity(..))
+import           Data.Data (Constr, ConstrRep(..), DataRep(..), DataType,
+                            mkConstr, mkDataType)
+import           Data.Dynamic (Dynamic, toDyn)
+#if !(MIN_VERSION_base(4,8,0))
+import           Data.Functor ((<$>))
+#endif
+#if defined(VERSION_transformers)
+# if !(MIN_VERSION_transformers(0,4,0))
+import           Data.Functor.Classes ()
+# endif
+#endif
+import           Data.Functor.Identity (Identity(..))
+import           Data.Monoid (All(..), Any(..), Dual(..), First(..),
+                              Last(..), Product(..), Sum(..))
+#if MIN_VERSION_base(4,8,0)
+import           Data.Monoid (Alt(..))
+#endif
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+import qualified Data.OldTypeable.Internal as OldT (TyCon(..), TypeRep(..))
+#endif
+#if MIN_VERSION_base(4,6,0)
+import           Data.Ord (Down(..))
+#endif
+import           Data.Proxy (Proxy(..))
+import           Data.Text.Lazy.Builder (Builder, fromString)
+#if MIN_VERSION_base(4,7,0)
+import           Data.Coerce (Coercible)
+import           Data.Type.Coercion (Coercion(..))
+import           Data.Type.Equality ((:~:)(..))
+#endif
+import qualified Data.Typeable.Internal as NewT (TyCon(..), TypeRep(..))
+import           Data.Version (Version(..))
+
+import           Foreign.C.Types
+import           Foreign.Ptr (FunPtr, IntPtr, Ptr, WordPtr,
+                              castPtrToFunPtr, nullPtr, plusPtr,
+                              ptrToIntPtr, ptrToWordPtr)
+
+import           GHC.Conc (BlockReason(..), ThreadStatus(..))
+#if !(defined(__GHCJS__))
+# if defined(mingw32_HOST_OS)
+import           GHC.Conc.Windows (ConsoleEvent(..))
+# else
+import           GHC.Event (Event, evtRead, evtWrite)
+# endif
+#endif
+import           GHC.Fingerprint.Type (Fingerprint(..))
+import           GHC.IO.Encoding.Failure (CodingFailureMode(..))
+import           GHC.IO.Encoding.Types (CodingProgress(..))
+import           GHC.IO.Exception (IOException(..), IOErrorType(..))
+import           GHC.IO.Handle (HandlePosn(..))
+import qualified GHC.Generics as G (Fixity(..))
+import           GHC.Generics (U1(..), Par1(..), Rec1(..), K1(..),
+                               M1(..), (:+:)(..), (:*:)(..), (:.:)(..),
+                               Associativity(..), Arity(..))
+#if MIN_VERSION_base(4,8,0)
+import           GHC.RTS.Flags
+import           GHC.StaticPtr (StaticPtrInfo(..))
+#endif
+#if !(MIN_VERSION_base(4,8,0))
+import           GHC.Show (appPrec, appPrec1)
+#endif
+import           GHC.Stats (GCStats(..))
+#if MIN_VERSION_base(4,7,0)
+import           GHC.TypeLits (SomeNat, SomeSymbol, someNatVal, someSymbolVal)
+#endif
+
+import           Instances.Utils ((<@>))
+
+import           Numeric (showHex)
+#if !(MIN_VERSION_QuickCheck(2,8,0) && MIN_VERSION_base(4,8,0))
+import           Numeric.Natural (Natural)
+#endif
+
+import           System.Exit (ExitCode(..))
+import           System.IO (BufferMode(..), IOMode(..), Newline(..), NewlineMode(..),
+                            SeekMode(..), Handle, stdin, stdout, stderr)
+import           System.Posix.Types
+
+import           Test.Tasty.QuickCheck (Arbitrary(arbitrary), Gen,
+                                        arbitraryBoundedEnum, oneof, suchThat)
+
+import           Text.Read.Lex as Lex (Lexeme(..))
+#if MIN_VERSION_base(4,7,0)
+import           Data.Fixed (Fixed, E12)
+import           Text.Read.Lex (Number)
+#endif
+import           Text.Show.Text (FromStringShow(..), FromTextShow(..))
+import           Text.Show.Text.Generic (ConType(..))
+
+#if MIN_VERSION_base(4,7,0)
+import           Numeric (showOct, showEFloat, showFFloat, showGFloat)
+import           Test.Tasty.QuickCheck (getNonNegative)
+# if !(MIN_VERSION_base(4,8,0))
+import           Data.Word (Word)
+# endif
+#else
+import           Data.Word (Word64)
+#endif
+
+#include "HsBaseConfig.h"
+
+#if !(MIN_VERSION_QuickCheck(2,8,0) && MIN_VERSION_base(4,8,0))
+instance Arbitrary Natural where
+    arbitrary = fromInteger <$> arbitrary `suchThat` (>= 0)
+#endif
+
+instance Arbitrary Builder where
+    arbitrary = fromString <$> arbitrary
+
+instance Arbitrary ShortByteString where
+    arbitrary = pack <$> arbitrary
+
+instance Arbitrary (Ptr a) where
+    arbitrary = plusPtr nullPtr <$> arbitrary
+
+instance Arbitrary (FunPtr a) where
+    arbitrary = castPtrToFunPtr <$> arbitrary
+
+instance Arbitrary IntPtr where
+    arbitrary = ptrToIntPtr <$> arbitrary
+
+instance Arbitrary WordPtr where
+    arbitrary = ptrToWordPtr <$> arbitrary
+
+instance Arbitrary GeneralCategory where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary Version where
+    arbitrary = Version <$> arbitrary <*> arbitrary
+
+instance Arbitrary SomeException where
+    arbitrary = SomeException <$> (arbitrary :: Gen AssertionFailed)
+
+instance Arbitrary IOException where
+    arbitrary = IOError <$> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+
+deriving instance Bounded IOErrorType
+deriving instance Enum IOErrorType
+instance Arbitrary IOErrorType where
+    arbitrary = arbitraryBoundedEnum
+
+deriving instance Bounded ArithException
+deriving instance Enum ArithException
+instance Arbitrary ArithException where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary ArrayException where
+    arbitrary = oneof [ IndexOutOfBounds <$> arbitrary
+                      , UndefinedElement <$> arbitrary
+                      ]
+
+instance Arbitrary AssertionFailed where
+    arbitrary = AssertionFailed <$> arbitrary
+
+#if MIN_VERSION_base(4,7,0)
+instance Arbitrary SomeAsyncException where
+    arbitrary = SomeAsyncException <$> (arbitrary :: Gen AsyncException)
+#endif
+
+deriving instance Bounded AsyncException
+deriving instance Enum AsyncException
+instance Arbitrary AsyncException where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary NonTermination where
+    arbitrary = pure NonTermination
+
+instance Arbitrary NestedAtomically where
+    arbitrary = pure NestedAtomically
+
+instance Arbitrary BlockedIndefinitelyOnMVar where
+    arbitrary = pure BlockedIndefinitelyOnMVar
+
+instance Arbitrary BlockedIndefinitelyOnSTM where
+    arbitrary = pure BlockedIndefinitelyOnSTM
+
+#if MIN_VERSION_base(4,8,0)
+instance Arbitrary AllocationLimitExceeded where
+    arbitrary = pure AllocationLimitExceeded
+#endif
+
+instance Arbitrary Deadlock where
+    arbitrary = pure Deadlock
+
+instance Arbitrary NoMethodError where
+    arbitrary = NoMethodError <$> arbitrary
+
+instance Arbitrary PatternMatchFail where
+    arbitrary = PatternMatchFail <$> arbitrary
+
+instance Arbitrary RecConError where
+    arbitrary = RecConError <$> arbitrary
+
+instance Arbitrary RecSelError where
+    arbitrary = RecSelError <$> arbitrary
+
+instance Arbitrary RecUpdError where
+    arbitrary = RecUpdError <$> arbitrary
+
+-- ErrorCall is a newtype starting with base-4.7.0.0, but we'll
+-- manually derive Arbitrary to support older versions of GHC.
+instance Arbitrary ErrorCall where
+    arbitrary = ErrorCall <$> arbitrary
+
+deriving instance Bounded MaskingState
+deriving instance Enum MaskingState
+instance Arbitrary MaskingState where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary Lexeme where
+    arbitrary = oneof [ Char   <$> arbitrary
+                      , String <$> arbitrary
+                      , Punc   <$> arbitrary
+                      , Ident  <$> arbitrary
+                      , Symbol <$> arbitrary
+#if MIN_VERSION_base(4,7,0)
+                      , Number <$> arbitrary
+#elif !(MIN_VERSION_base(4,6,0))
+                      , Int    <$> arbitrary
+                      , Rat    <$> arbitrary
+#endif
+                      , pure Lex.EOF
+                      ]
+    
+#if MIN_VERSION_base(4,7,0)
+instance Arbitrary Number where
+    arbitrary = do
+        str <- oneof [ show <$> (nonneg :: Gen Double)
+                     , fmap (\d -> showEFloat Nothing d "") (nonneg :: Gen Double)
+                     , fmap (\d -> showFFloat Nothing d "") (nonneg :: Gen Double)
+                     , fmap (\d -> showGFloat Nothing d "") (nonneg :: Gen Double)
+                     , show <$> (nonneg :: Gen Float)
+                     , show <$> (nonneg :: Gen Int)
+                     , fmap (\i -> "0x" ++ showHex i "") (nonneg :: Gen Int)
+                     , fmap (\i -> "0o" ++ showOct i "") (nonneg :: Gen Int)
+                     , show <$> (nonneg :: Gen Integer)
+                     , show <$> (nonneg :: Gen Word)
+                     , show <$> (nonneg :: Gen (Fixed E12))
+                     ]
+        let Number num = read str
+        pure num
+      where
+        nonneg :: (Arbitrary a, Num a, Ord a) => Gen a
+        nonneg = getNonNegative <$> arbitrary
+#endif
+
+instance Arbitrary (Proxy s) where
+    arbitrary = pure Proxy
+
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+instance Arbitrary OldT.TypeRep where
+    arbitrary = OldT.TypeRep <$> arbitrary <*> arbitrary <@> []
+--     arbitrary = OldT.TypeRep <$> arbitrary <*> arbitrary <*> arbitrary
+
+instance Arbitrary OldT.TyCon where
+    arbitrary = OldT.TyCon <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+#endif
+
+instance Arbitrary NewT.TypeRep where
+    arbitrary = NewT.TypeRep <$> arbitrary <*> arbitrary
+#if MIN_VERSION_base(4,8,0)
+                                                         <@> [] <@> []
+#else
+                                                         <@> []
+#endif
+
+instance Arbitrary NewT.TyCon where
+    arbitrary = NewT.TyCon <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+
+instance Arbitrary Fingerprint where
+    arbitrary = Fingerprint <$> arbitrary <*> arbitrary
+
+#if !(MIN_VERSION_base(4,7,0))
+instance Show Fingerprint where
+  show (Fingerprint w1 w2) = hex16 w1 ++ hex16 w2
+    where
+      -- Formats a 64 bit number as 16 digits hex.
+      hex16 :: Word64 -> String
+      hex16 i = let hex = showHex i ""
+                 in replicate (16 - length hex) '0' ++ hex
+#endif
+
+instance Arbitrary Dynamic where
+    arbitrary = toDyn <$> (arbitrary :: Gen Int)
+
+instance Arbitrary Constr where
+    arbitrary = mkConstr <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+
+instance Arbitrary ConstrRep where
+    arbitrary = oneof [ AlgConstr   <$> arbitrary
+                      , IntConstr   <$> arbitrary
+                      , FloatConstr <$> arbitrary
+                      , CharConstr  <$> arbitrary
+                      ]
+
+instance Arbitrary DataRep where
+    arbitrary = oneof [ AlgRep <$> arbitrary
+                      , pure IntRep
+                      , pure FloatRep
+                      , pure CharRep
+                      , pure NoRep
+                      ]
+
+instance Arbitrary DataType where
+    arbitrary = mkDataType <$> arbitrary <*> arbitrary
+
+deriving instance Bounded D.Fixity
+deriving instance Enum D.Fixity
+instance Arbitrary D.Fixity where
+    arbitrary = arbitraryBoundedEnum
+
+#if MIN_VERSION_base(4,7,0)
+instance Coercible a b => Arbitrary (Coercion a b) where
+    arbitrary = pure Coercion
+
+instance a ~ b => Arbitrary (a :~: b) where
+    arbitrary = pure Refl
+#endif
+
+deriving instance Bounded BlockReason
+deriving instance Enum BlockReason
+instance Arbitrary BlockReason where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary ThreadStatus where
+    arbitrary = oneof [ pure ThreadRunning
+                      , pure ThreadFinished
+                      , ThreadBlocked <$> arbitrary
+                      , pure ThreadDied
+                      ]
+
+#if !(defined(__GHCJS__))
+# if defined(mingw32_HOST_OS)
+deriving instance Bounded ConsoleEvent
+instance Arbitrary ConsoleEvent where
+    arbitrary = arbitraryBoundedEnum
+# else
+instance Arbitrary Event where
+    arbitrary = oneof $ map pure [evtRead, evtWrite]
+
+-- TODO: instance Arbitrary FdKey
+# endif
+#endif
+
+instance Arbitrary (ST s a) where
+    arbitrary = pure $ fixST undefined
+
+instance Arbitrary Handle where
+    arbitrary = oneof $ map pure [stdin, stdout, stderr]
+
+instance Arbitrary HandlePosn where
+    arbitrary = HandlePosn <$> arbitrary <*> arbitrary
+
+deriving instance Bounded IOMode
+instance Arbitrary IOMode where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary BufferMode where
+    arbitrary = oneof [ pure NoBuffering
+                      , pure LineBuffering
+                      , BlockBuffering <$> arbitrary
+                      ]
+
+deriving instance Bounded SeekMode
+instance Arbitrary SeekMode where
+    arbitrary = arbitraryBoundedEnum
+
+deriving instance Bounded Newline
+deriving instance Enum Newline
+instance Arbitrary Newline where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary NewlineMode where
+    arbitrary = NewlineMode <$> arbitrary <*> arbitrary
+
+deriving instance Bounded CodingProgress
+deriving instance Enum CodingProgress
+instance Arbitrary CodingProgress where
+    arbitrary = arbitraryBoundedEnum
+
+deriving instance Bounded CodingFailureMode
+deriving instance Enum CodingFailureMode
+instance Arbitrary CodingFailureMode where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary GCStats where
+    arbitrary = GCStats <$> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+
+instance Arbitrary (U1 p) where
+    arbitrary = pure U1
+
+instance Arbitrary p => Arbitrary (Par1 p) where
+    arbitrary = Par1 <$> arbitrary
+
+instance Arbitrary (f p) => Arbitrary (Rec1 f p) where
+    arbitrary = Rec1 <$> arbitrary
+
+instance Arbitrary c => Arbitrary (K1 i c p) where
+    arbitrary = K1 <$> arbitrary
+
+instance Arbitrary (f p) => Arbitrary (M1 i c f p) where
+    arbitrary = M1 <$> arbitrary
+
+instance (Arbitrary (f p), Arbitrary (g p)) => Arbitrary ((f :+: g) p) where
+    arbitrary = oneof [L1 <$> arbitrary, R1 <$> arbitrary]
+
+instance (Arbitrary (f p), Arbitrary (g p)) => Arbitrary ((f :*: g) p) where
+    arbitrary = (:*:) <$> arbitrary <*> arbitrary
+
+instance Arbitrary (f (g p)) => Arbitrary ((f :.: g) p) where
+    arbitrary = Comp1 <$> arbitrary
+
+instance Arbitrary G.Fixity where
+    arbitrary = oneof [pure G.Prefix, G.Infix <$> arbitrary <*> arbitrary]
+
+deriving instance Bounded Associativity
+deriving instance Enum Associativity
+instance Arbitrary Associativity where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary Arity where
+    arbitrary = oneof [pure NoArity, Arity <$> arbitrary]
+
+#if !(MIN_VERSION_base(4,7,0))
+deriving instance                             Show (U1 p)
+deriving instance Show p                   => Show (Par1 p)
+deriving instance Show (f p)               => Show (Rec1 f p)
+deriving instance Show c                   => Show (K1 i c p)
+deriving instance Show (f p)               => Show (M1 i c f p)
+deriving instance (Show (f p), Show (g p)) => Show ((f :+: g) p)
+
+-- Due to a GHC bug (https://ghc.haskell.org/trac/ghc/ticket/9830), this Show
+-- instance produces output with the wrong precedence on older versions of GHC.
+-- I'll manually define the Show instance to get the correct behavior.
+instance (Show (f p), Show (g p)) => Show ((f :*: g) p) where
+    showsPrec p (l :*: r) = showParen (p > prec) $
+          showsPrec (prec + 1) l
+        . showString " :*: "
+        . showsPrec (prec + 1) r
+      where prec = 6
+
+deriving instance Show (f (g p))           => Show ((f :.: g) p)
+#endif
+
+#if MIN_VERSION_base(4,8,0)
+instance Arbitrary ConcFlags where
+    arbitrary = ConcFlags <$> arbitrary <*> arbitrary
+
+instance Arbitrary MiscFlags where
+    arbitrary = MiscFlags <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+
+instance Arbitrary DebugFlags where
+    arbitrary = DebugFlags <$> arbitrary <*> arbitrary <*> arbitrary
+                           <*> arbitrary <*> arbitrary <*> arbitrary
+                           <*> arbitrary <*> arbitrary <*> arbitrary
+                           <*> arbitrary <*> arbitrary <*> arbitrary
+                           <*> arbitrary <*> arbitrary <*> arbitrary
+
+instance Arbitrary TickyFlags where
+    arbitrary = TickyFlags <$> arbitrary <*> arbitrary
+
+instance Arbitrary StaticPtrInfo where
+    arbitrary = StaticPtrInfo <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+#endif
+
+-- #if MIN_VERSION_base(4,6,0) && !(MIN_VERSION_base(4,7,0))
+-- TODO: instance Arbitrary (IsZero n)
+-- TODO: instance Arbitrary (IsEven n)
+-- #endif
+
+#if MIN_VERSION_base(4,7,0)
+instance Arbitrary SomeNat where
+    arbitrary = do
+        nat <- arbitrary `suchThat` (>= 0)
+        case someNatVal nat of
+             Just sn -> pure sn
+             Nothing -> fail "Negative natural number"
+
+instance Arbitrary SomeSymbol where
+    arbitrary = someSymbolVal <$> arbitrary
+#endif
+
+instance Arbitrary ConType where
+    arbitrary = oneof [pure Rec, pure Tup, pure Pref, Inf <$> arbitrary]
+
+deriving instance Arbitrary CChar
+deriving instance Arbitrary CSChar
+deriving instance Arbitrary CUChar
+deriving instance Arbitrary CShort
+deriving instance Arbitrary CUShort
+deriving instance Arbitrary CInt
+deriving instance Arbitrary CUInt
+deriving instance Arbitrary CLong
+deriving instance Arbitrary CULong
+deriving instance Arbitrary CLLong
+deriving instance Arbitrary CULLong
+deriving instance Arbitrary CFloat
+deriving instance Arbitrary CDouble
+deriving instance Arbitrary CPtrdiff
+deriving instance Arbitrary CSize
+deriving instance Arbitrary CWchar
+deriving instance Arbitrary CSigAtomic
+deriving instance Arbitrary CClock
+deriving instance Arbitrary CTime
+deriving instance Arbitrary CUSeconds
+deriving instance Arbitrary CSUSeconds
+deriving instance Arbitrary CIntPtr
+deriving instance Arbitrary CUIntPtr
+deriving instance Arbitrary CIntMax
+deriving instance Arbitrary CUIntMax
+
+instance Arbitrary ExitCode where
+    arbitrary = oneof [pure ExitSuccess, ExitFailure <$> arbitrary]
+
+#if defined(HTYPE_DEV_T)
+deriving instance Arbitrary CDev
+#endif
+#if defined(HTYPE_INO_T)
+deriving instance Arbitrary CIno
+#endif
+#if defined(HTYPE_MODE_T)
+deriving instance Arbitrary CMode
+#endif
+#if defined(HTYPE_OFF_T)
+deriving instance Arbitrary COff
+#endif
+#if defined(HTYPE_PID_T)
+deriving instance Arbitrary CPid
+#endif
+#if defined(HTYPE_SSIZE_T)
+deriving instance Arbitrary CSsize
+#endif
+#if defined(HTYPE_GID_T)
+deriving instance Arbitrary CGid
+#endif
+#if defined(HTYPE_NLINK_T)
+deriving instance Arbitrary CNlink
+#endif
+#if defined(HTYPE_UID_T)
+deriving instance Arbitrary CUid
+#endif
+#if defined(HTYPE_CC_T)
+deriving instance Arbitrary CCc
+#endif
+#if defined(HTYPE_SPEED_T)
+deriving instance Arbitrary CSpeed
+#endif
+#if defined(HTYPE_TCFLAG_T)
+deriving instance Arbitrary CTcflag
+#endif
+#if defined(HTYPE_RLIM_T)
+deriving instance Arbitrary CRLim
+#endif
+deriving instance Arbitrary Fd
+
+deriving instance Arbitrary All
+deriving instance Arbitrary Any
+deriving instance Arbitrary a => Arbitrary (Dual a)
+deriving instance Arbitrary a => Arbitrary (First a)
+deriving instance Arbitrary a => Arbitrary (Last a)
+deriving instance Arbitrary a => Arbitrary (Product a)
+deriving instance Arbitrary a => Arbitrary (Sum a)
+#if MIN_VERSION_base(4,8,0)
+deriving instance Arbitrary (f a) => Arbitrary (Alt f a)
+#endif
+
+deriving instance Arbitrary a => Arbitrary (Const a b)
+#if !(MIN_VERSION_base(4,8,0))
+instance Show a => Show (Const a b) where
+    showsPrec p (Const x) = showParen (p > appPrec)
+        $ showString "Const " . showsPrec appPrec1 x
+#endif
+deriving instance Arbitrary a => Arbitrary (ZipList a)
+#if !(MIN_VERSION_base(4,7,0))
+deriving instance Show a => Show (ZipList a)
+#endif
+
+#if MIN_VERSION_base(4,6,0)
+deriving instance Arbitrary a => Arbitrary (Down a)
+#if !(MIN_VERSION_base(4,7,0))
+deriving instance Show a => Show (Down a)
+#endif
+#endif
+
+deriving instance Arbitrary a => Arbitrary (Identity a)
+
+deriving instance Arbitrary a => Arbitrary (FromStringShow a)
+deriving instance Arbitrary a => Arbitrary (FromTextShow a)
tests/Instances/Derived.hs view
@@ -1,367 +1,367 @@-{-# LANGUAGE CPP                        #-}-{-# LANGUAGE FlexibleContexts           #-}-{-# LANGUAGE FlexibleInstances          #-}-{-# LANGUAGE GADTs                      #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE MagicHash                  #-}-{-# LANGUAGE StandaloneDeriving         #-}-{-# LANGUAGE TemplateHaskell            #-}-{-# LANGUAGE TypeOperators              #-}-{-# LANGUAGE UndecidableInstances       #-}-#include "overlap.h"-__LANGUAGE_OVERLAPPING_INSTANCES__-#if __GLASGOW_HASKELL__ >= 706--- GHC 7.4 also supports PolyKinds, but Template Haskell doesn't seem to play--- -- nicely with it for some reason.-{-# LANGUAGE PolyKinds                  #-}-#endif-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-|-Module:      Instances.Derived-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Defines data types with derived 'Show' instances (using "Text.Show.Text.TH")-for testing purposes, including 'Arbitrary' instances.--}-module Instances.Derived (-      showbNullary-    , showbPhantomNullary-    , showbMonomorphicUnaryPrec-    , showbPolymorphicUnaryPrec-    , showbMonomorphicProductPrec-    , showbPolymorphicProductPrec-    , showbMonomorphicRecordPrec-    , showbPolymorphicRecordPrec-    , showbMonomorphicInfixPrec-    , showbPolymorphicInfixPrec-    , showbMonomorphicForallPrec-    , showbPolymorphicForallPrec-    , showbAllAtOncePrec-    , showbGADTPrec-    , showbPrimADTPrec#-    , showbLeftAssocTreePrec-    , showbRightAssocTreePrec-    , showbQuestionMarkPrec---     , showbHigherKindedTypeParamsPrec---     , showbRestrictionPrec---     , showbRestrictedContextPrec---     , showbFixPrec-#if MIN_VERSION_template_haskell(2,7,0)-    , showbASNullary-    , showbASUnaryPrec-    , showbASProductPrec-    , showbASRecordPrec-    , showbASInfixPrec-    , showbNASShowPrec-    , showbOneDataInstancePrec-    , showbAssocData1Prec-    , showbAssocData2Prec-    -- , showbAssocData3Prec-# if __GLASGOW_HASKELL__ >= 708-    , showbNullaryDataPrec-# endif-    , showbGADTFamPrec-#endif-    ) where--#if !(MIN_VERSION_base(4,8,0))-import Control.Applicative ((<*>), pure)--import Data.Functor ((<$>))-#endif--import Derived--import GHC.Exts (Char(..), Double(..), Float(..), Int(..), Word(..))--import Prelude hiding (Show)--import Test.Tasty.QuickCheck (Arbitrary(..), Gen, oneof)--import Text.Show.Text (Show(showb, showbPrec), Builder)-import Text.Show.Text.TH (deriveShow, mkShowbPrec)--showbNullary :: Nullary -> Builder-showbNullary = showb--showbPhantomNullary :: Show a => PhantomNullary a -> Builder-showbPhantomNullary = showb--showbMonomorphicUnaryPrec :: Int -> MonomorphicUnary -> Builder-showbMonomorphicUnaryPrec = showbPrec--showbPolymorphicUnaryPrec :: (Show a, Show b) => Int -> PolymorphicUnary a b -> Builder-showbPolymorphicUnaryPrec = showbPrec--showbMonomorphicProductPrec :: Int -> MonomorphicProduct -> Builder-showbMonomorphicProductPrec = showbPrec--showbPolymorphicProductPrec :: (Show a, Show b, Show c, Show d)-                            => Int -> PolymorphicProduct a b c d -> Builder-showbPolymorphicProductPrec = showbPrec--showbMonomorphicRecordPrec :: Int -> MonomorphicRecord -> Builder-showbMonomorphicRecordPrec = showbPrec--showbPolymorphicRecordPrec :: (Show a, Show b, Show c, Show d)-                           => Int -> PolymorphicRecord a b c d -> Builder-showbPolymorphicRecordPrec = showbPrec--showbMonomorphicInfixPrec :: Int -> MonomorphicInfix -> Builder-showbMonomorphicInfixPrec = showbPrec--showbPolymorphicInfixPrec :: (Show a, Show b, Show c)-                          => Int -> PolymorphicInfix a b c -> Builder-showbPolymorphicInfixPrec = showbPrec--showbMonomorphicForallPrec :: Int -> MonomorphicForall -> Builder-showbMonomorphicForallPrec = showbPrec--showbPolymorphicForallPrec :: (Show a, Show b) => Int -> PolymorphicForall a b -> Builder-showbPolymorphicForallPrec = showbPrec--showbAllAtOncePrec :: (Show a, Show b, Show c, Show d)-                   => Int -> AllAtOnce a b c d -> Builder-showbAllAtOncePrec = showbPrec--showbGADTPrec :: (Show a, Show b, Show c) => Int -> GADT a b c -> Builder-showbGADTPrec = showbPrec--showbPrimADTPrec# :: Show a => Int -> PrimADT# a -> Builder-showbPrimADTPrec# = showbPrec--showbLeftAssocTreePrec :: Show a => Int -> LeftAssocTree a -> Builder-showbLeftAssocTreePrec = showbPrec--showbRightAssocTreePrec :: Show a => Int -> RightAssocTree a -> Builder-showbRightAssocTreePrec = showbPrec--showbQuestionMarkPrec :: (Show a, Show b) => Int -> a :?: b -> Builder-showbQuestionMarkPrec = showbPrec---- showbHigherKindedTypeParamsPrec :: Show (f a)---                                 => Int -> HigherKindedTypeParams f a -> Builder--- showbHigherKindedTypeParamsPrec = showbPrec--- --- showbRestrictionPrec :: (Read a, Show a) => Int -> Restriction a -> Builder--- showbRestrictionPrec = showbPrec--- --- showbRestrictedContextPrec :: (Read a, Show a) => Int -> RestrictedContext a -> Builder--- showbRestrictedContextPrec = showbPrec--- --- showbFixPrec :: Show (f (Fix f)) => Int -> Fix f -> Builder--- showbFixPrec = showbPrec--#if MIN_VERSION_template_haskell(2,7,0)-showbASNullary :: (Show c, Show d) => AllShow () () c d -> Builder-showbASNullary = showb--showbASUnaryPrec :: (Show b, Show c, Show d) => Int -> AllShow Int b c d -> Builder-showbASUnaryPrec = showbPrec--showbASProductPrec :: (Show c, Show d) => Int -> AllShow Bool Bool c d -> Builder-showbASProductPrec = showbPrec--showbASRecordPrec :: (Show c, Show d) => Int -> AllShow Char Double c d -> Builder-showbASRecordPrec = showbPrec--showbASInfixPrec :: (Show c, Show d) => Int -> AllShow Float Ordering c d -> Builder-showbASInfixPrec = showbPrec--showbNASShowPrec :: (Show b, Show d) => Int -> NotAllShow Int b Int d -> Builder-showbNASShowPrec = showbPrec--showbOneDataInstancePrec :: (Show a, Show b, Show c, Show d)-                         => Int -> OneDataInstance a b c d -> Builder-showbOneDataInstancePrec = showbPrec--showbAssocData1Prec :: Int -> AssocData1 () -> Builder-showbAssocData1Prec = showbPrec--showbAssocData2Prec :: Int -> AssocData2 () Int Int -> Builder-showbAssocData2Prec = showbPrec---- showbAssocData3Prec :: Int -> AssocData3 () b c -> Builder--- showbAssocData3Prec = showbPrec--# if __GLASGOW_HASKELL__ >= 708-showbNullaryDataPrec :: Int -> NullaryData -> Builder-showbNullaryDataPrec = showbPrec-# endif--showbGADTFamPrec :: (Show a, Show b, Show c) => Int -> GADTFam a b c -> Builder-showbGADTFamPrec = showbPrec-#endif-----------------------------------------------------------------------------------$(deriveShow ''Nullary)-instance Arbitrary Nullary where-    arbitrary = pure Nullary--$(deriveShow ''PhantomNullary)-instance Arbitrary (PhantomNullary a) where-    arbitrary = pure PhantomNullary--$(deriveShow ''MonomorphicUnary)-deriving instance Arbitrary MonomorphicUnary--$(deriveShow ''PolymorphicUnary)-deriving instance Arbitrary a => Arbitrary (PolymorphicUnary a b)--$(deriveShow ''MonomorphicProduct)-instance Arbitrary MonomorphicProduct where-    arbitrary = MonomorphicProduct <$> arbitrary <*> arbitrary <*> arbitrary--$(deriveShow ''PolymorphicProduct)-instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (PolymorphicProduct a b c d) where-    arbitrary = PolymorphicProduct <$> arbitrary <*> arbitrary <*> arbitrary--$(deriveShow ''MonomorphicRecord)-instance Arbitrary MonomorphicRecord where-    arbitrary = MonomorphicRecord <$> arbitrary <*> arbitrary <*> arbitrary--$(deriveShow ''PolymorphicRecord)-instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (PolymorphicRecord a b c d) where-    arbitrary = PolymorphicRecord <$> arbitrary <*> arbitrary <*> arbitrary--$(deriveShow ''MonomorphicInfix)-instance Arbitrary MonomorphicInfix where-    arbitrary = (:/:) <$> arbitrary <*> arbitrary--$(deriveShow ''PolymorphicInfix)-instance (Arbitrary a, Arbitrary b) => Arbitrary (PolymorphicInfix a b c) where-    arbitrary = PolyInf <$> arbitrary <*> arbitrary--$(deriveShow ''MonomorphicForall)-instance Arbitrary MonomorphicForall where-    arbitrary = MonomorphicForall <$> (arbitrary :: Gen Int)--$(deriveShow ''PolymorphicForall)-instance Arbitrary a => Arbitrary (PolymorphicForall a b) where-    arbitrary = PolymorphicForall <$> arbitrary <*> (arbitrary :: Gen Int)--$(deriveShow ''AllAtOnce)-instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (AllAtOnce a b c d) where-    arbitrary = oneof [ pure AAONullary-                      , AAOUnary   <$> arbitrary-                      , AAOProduct <$> arbitrary <*> arbitrary <*> arbitrary-                      , AAORecord  <$> arbitrary <*> arbitrary <*> arbitrary-                      , (:/\:)     <$> arbitrary <*> arbitrary-                      , AAOForall  <$> arbitrary <*> arbitrary <*> (arbitrary :: Gen Int)-                      ]--$(deriveShow ''GADT)-instance __OVERLAPPING__  Arbitrary (GADT Char b c) where-    arbitrary = pure GADTCon1-instance __OVERLAPPING__  Arbitrary (GADT Double Double c) where-    arbitrary = GADTCon2 <$> arbitrary-instance __OVERLAPPING__  Arbitrary (GADT Int String c) where-    arbitrary = GADTCon3 <$> arbitrary-instance __OVERLAPPABLE__ Arbitrary a => Arbitrary (GADT a b c) where-    arbitrary = GADTCon4 <$> arbitrary-instance __OVERLAPPING__  Arbitrary b => Arbitrary (GADT b b c) where-    arbitrary = GADTCon5 <$> arbitrary--$(deriveShow ''PrimADT#)-instance Arbitrary (PrimADT# a) where-    arbitrary = do-        i@(I# i#) <- arbitrary-        F# f#     <- arbitrary-        D# d#     <- arbitrary-        C# c#     <- arbitrary-        W# w#     <- arbitrary-        oneof $ map pure [ PrimNormal# i# f# d# c# w#-                         , PrimRecord# i# f# d# c# w#-                         , i# `PrimInfixIntegral#` w#-                         , f# `PrimInfixFloating#` d#-                         , c# `PrimInfixChar#` c#-                         , PrimForall# i i# f# d# c# w#-                         ]--$(deriveShow ''LeftAssocTree)-instance Arbitrary a => Arbitrary (LeftAssocTree a) where-    arbitrary = oneof [ LeftAssocLeaf <$> arbitrary-                      , (:<:) <$> (LeftAssocLeaf <$> arbitrary)-                              <*> (LeftAssocLeaf <$> arbitrary)-                      ]--$(deriveShow ''RightAssocTree)-instance Arbitrary a => Arbitrary (RightAssocTree a) where-    arbitrary = oneof [ RightAssocLeaf <$> arbitrary-                      , (:>:) <$> (RightAssocLeaf <$> arbitrary)-                              <*> (RightAssocLeaf <$> arbitrary)-                      ]--$(deriveShow ''(:?:))-instance (Arbitrary a, Arbitrary b) => Arbitrary (a :?: b) where-    arbitrary = (:?:) <$> arbitrary <*> arbitrary--instance Show (f a) => Show (HigherKindedTypeParams f a) where-    showbPrec = $(mkShowbPrec ''HigherKindedTypeParams)-deriving instance Arbitrary (f a) => Arbitrary (HigherKindedTypeParams f a)--instance (Read a, Show a) => Show (Restriction a) where-    showbPrec = $(mkShowbPrec ''Restriction)-deriving instance Arbitrary a => Arbitrary (Restriction a)--instance (Read a, Show a) => Show (RestrictedContext a) where-    showbPrec = $(mkShowbPrec ''RestrictedContext)-deriving instance Arbitrary a => Arbitrary (RestrictedContext a)--instance Show (f (Fix f)) => Show (Fix f) where-    showbPrec = $(mkShowbPrec ''Fix)-deriving instance Arbitrary (f (Fix f)) => Arbitrary (Fix f)--#if MIN_VERSION_template_haskell(2,7,0)-$(deriveShow ''AllShow)-instance Arbitrary (AllShow () () c d) where-    arbitrary = pure ASNullary-deriving instance Arbitrary (AllShow Int b c d)-instance Arbitrary (AllShow Bool Bool c d) where-    arbitrary = ASProduct <$> arbitrary <*> arbitrary-instance Arbitrary c => Arbitrary (AllShow Char Double c d) where-    arbitrary = ASRecord <$> arbitrary <*> arbitrary <*> arbitrary-instance Arbitrary (AllShow Float Ordering c d) where-    arbitrary = ASInfix <$> arbitrary <*> arbitrary--$(deriveShow 'NASShow1)-instance Arbitrary b => Arbitrary (NotAllShow Int b Int d) where-    arbitrary = oneof [NASShow1 <$> arbitrary <*> arbitrary, NASShow2 <$> arbitrary]--$(deriveShow ''OneDataInstance)-instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (OneDataInstance a b c d) where-    arbitrary = oneof [ pure ODINullary-                      , ODIUnary   <$> arbitrary-                      , ODIProduct <$> arbitrary <*> arbitrary-                      , ODIRecord  <$> arbitrary <*> arbitrary <*> arbitrary-                      , ODIInfix   <$> arbitrary <*> arbitrary-                      ]--$(deriveShow ''AssocData1)-deriving instance Arbitrary (AssocData1 ())--$(deriveShow 'AssocCon2)-deriving instance Arbitrary (AssocData2 () Int Int)--#if __GLASGOW_HASKELL__ >= 708-$(deriveShow 'NullaryCon)-deriving instance Arbitrary NullaryData-#endif--$(deriveShow 'GADTFamCon1)-instance __OVERLAPPING__  Arbitrary (GADTFam Char b c) where-    arbitrary = pure GADTFamCon1-instance __OVERLAPPING__  Arbitrary (GADTFam Double Double c) where-    arbitrary = GADTFamCon2 <$> arbitrary-instance __OVERLAPPING__  Arbitrary (GADTFam Int String c) where-    arbitrary = GADTFamCon3 <$> arbitrary-instance __OVERLAPPABLE__ Arbitrary a => Arbitrary (GADTFam a b c) where-    arbitrary = GADTFamCon4 <$> arbitrary-instance __OVERLAPPING__  Arbitrary b => Arbitrary (GADTFam b b c) where-    arbitrary = GADTFamCon5 <$> arbitrary-#endif+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE FlexibleContexts           #-}
+{-# LANGUAGE FlexibleInstances          #-}
+{-# LANGUAGE GADTs                      #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MagicHash                  #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# LANGUAGE TemplateHaskell            #-}
+{-# LANGUAGE TypeOperators              #-}
+{-# LANGUAGE UndecidableInstances       #-}
+#include "overlap.h"
+__LANGUAGE_OVERLAPPING_INSTANCES__
+#if __GLASGOW_HASKELL__ >= 706
+-- GHC 7.4 also supports PolyKinds, but Template Haskell doesn't seem to play
+-- -- nicely with it for some reason.
+{-# LANGUAGE PolyKinds                  #-}
+#endif
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-|
+Module:      Instances.Derived
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+Defines data types with derived 'Show' instances (using "Text.Show.Text.TH")
+for testing purposes, including 'Arbitrary' instances.
+-}
+module Instances.Derived (
+      showbNullary
+    , showbPhantomNullary
+    , showbMonomorphicUnaryPrec
+    , showbPolymorphicUnaryPrec
+    , showbMonomorphicProductPrec
+    , showbPolymorphicProductPrec
+    , showbMonomorphicRecordPrec
+    , showbPolymorphicRecordPrec
+    , showbMonomorphicInfixPrec
+    , showbPolymorphicInfixPrec
+    , showbMonomorphicForallPrec
+    , showbPolymorphicForallPrec
+    , showbAllAtOncePrec
+    , showbGADTPrec
+    , showbPrimADTPrec#
+    , showbLeftAssocTreePrec
+    , showbRightAssocTreePrec
+    , showbQuestionMarkPrec
+--     , showbHigherKindedTypeParamsPrec
+--     , showbRestrictionPrec
+--     , showbRestrictedContextPrec
+--     , showbFixPrec
+#if MIN_VERSION_template_haskell(2,7,0)
+    , showbASNullary
+    , showbASUnaryPrec
+    , showbASProductPrec
+    , showbASRecordPrec
+    , showbASInfixPrec
+    , showbNASShowPrec
+    , showbOneDataInstancePrec
+    , showbAssocData1Prec
+    , showbAssocData2Prec
+    -- , showbAssocData3Prec
+# if __GLASGOW_HASKELL__ >= 708
+    , showbNullaryDataPrec
+# endif
+    , showbGADTFamPrec
+#endif
+    ) where
+
+#if !(MIN_VERSION_base(4,8,0))
+import Control.Applicative ((<*>), pure)
+
+import Data.Functor ((<$>))
+#endif
+
+import Derived
+
+import GHC.Exts (Char(..), Double(..), Float(..), Int(..), Word(..))
+
+import Prelude hiding (Show)
+
+import Test.Tasty.QuickCheck (Arbitrary(..), Gen, oneof)
+
+import Text.Show.Text (Show(showb, showbPrec), Builder)
+import Text.Show.Text.TH (deriveShow, mkShowbPrec)
+
+showbNullary :: Nullary -> Builder
+showbNullary = showb
+
+showbPhantomNullary :: Show a => PhantomNullary a -> Builder
+showbPhantomNullary = showb
+
+showbMonomorphicUnaryPrec :: Int -> MonomorphicUnary -> Builder
+showbMonomorphicUnaryPrec = showbPrec
+
+showbPolymorphicUnaryPrec :: (Show a, Show b) => Int -> PolymorphicUnary a b -> Builder
+showbPolymorphicUnaryPrec = showbPrec
+
+showbMonomorphicProductPrec :: Int -> MonomorphicProduct -> Builder
+showbMonomorphicProductPrec = showbPrec
+
+showbPolymorphicProductPrec :: (Show a, Show b, Show c, Show d)
+                            => Int -> PolymorphicProduct a b c d -> Builder
+showbPolymorphicProductPrec = showbPrec
+
+showbMonomorphicRecordPrec :: Int -> MonomorphicRecord -> Builder
+showbMonomorphicRecordPrec = showbPrec
+
+showbPolymorphicRecordPrec :: (Show a, Show b, Show c, Show d)
+                           => Int -> PolymorphicRecord a b c d -> Builder
+showbPolymorphicRecordPrec = showbPrec
+
+showbMonomorphicInfixPrec :: Int -> MonomorphicInfix -> Builder
+showbMonomorphicInfixPrec = showbPrec
+
+showbPolymorphicInfixPrec :: (Show a, Show b, Show c)
+                          => Int -> PolymorphicInfix a b c -> Builder
+showbPolymorphicInfixPrec = showbPrec
+
+showbMonomorphicForallPrec :: Int -> MonomorphicForall -> Builder
+showbMonomorphicForallPrec = showbPrec
+
+showbPolymorphicForallPrec :: (Show a, Show b) => Int -> PolymorphicForall a b -> Builder
+showbPolymorphicForallPrec = showbPrec
+
+showbAllAtOncePrec :: (Show a, Show b, Show c, Show d)
+                   => Int -> AllAtOnce a b c d -> Builder
+showbAllAtOncePrec = showbPrec
+
+showbGADTPrec :: (Show a, Show b, Show c) => Int -> GADT a b c -> Builder
+showbGADTPrec = showbPrec
+
+showbPrimADTPrec# :: Show a => Int -> PrimADT# a -> Builder
+showbPrimADTPrec# = showbPrec
+
+showbLeftAssocTreePrec :: Show a => Int -> LeftAssocTree a -> Builder
+showbLeftAssocTreePrec = showbPrec
+
+showbRightAssocTreePrec :: Show a => Int -> RightAssocTree a -> Builder
+showbRightAssocTreePrec = showbPrec
+
+showbQuestionMarkPrec :: (Show a, Show b) => Int -> a :?: b -> Builder
+showbQuestionMarkPrec = showbPrec
+
+-- showbHigherKindedTypeParamsPrec :: Show (f a)
+--                                 => Int -> HigherKindedTypeParams f a -> Builder
+-- showbHigherKindedTypeParamsPrec = showbPrec
+-- 
+-- showbRestrictionPrec :: (Read a, Show a) => Int -> Restriction a -> Builder
+-- showbRestrictionPrec = showbPrec
+-- 
+-- showbRestrictedContextPrec :: (Read a, Show a) => Int -> RestrictedContext a -> Builder
+-- showbRestrictedContextPrec = showbPrec
+-- 
+-- showbFixPrec :: Show (f (Fix f)) => Int -> Fix f -> Builder
+-- showbFixPrec = showbPrec
+
+#if MIN_VERSION_template_haskell(2,7,0)
+showbASNullary :: (Show c, Show d) => AllShow () () c d -> Builder
+showbASNullary = showb
+
+showbASUnaryPrec :: (Show b, Show c, Show d) => Int -> AllShow Int b c d -> Builder
+showbASUnaryPrec = showbPrec
+
+showbASProductPrec :: (Show c, Show d) => Int -> AllShow Bool Bool c d -> Builder
+showbASProductPrec = showbPrec
+
+showbASRecordPrec :: (Show c, Show d) => Int -> AllShow Char Double c d -> Builder
+showbASRecordPrec = showbPrec
+
+showbASInfixPrec :: (Show c, Show d) => Int -> AllShow Float Ordering c d -> Builder
+showbASInfixPrec = showbPrec
+
+showbNASShowPrec :: (Show b, Show d) => Int -> NotAllShow Int b Int d -> Builder
+showbNASShowPrec = showbPrec
+
+showbOneDataInstancePrec :: (Show a, Show b, Show c, Show d)
+                         => Int -> OneDataInstance a b c d -> Builder
+showbOneDataInstancePrec = showbPrec
+
+showbAssocData1Prec :: Int -> AssocData1 () -> Builder
+showbAssocData1Prec = showbPrec
+
+showbAssocData2Prec :: Int -> AssocData2 () Int Int -> Builder
+showbAssocData2Prec = showbPrec
+
+-- showbAssocData3Prec :: Int -> AssocData3 () b c -> Builder
+-- showbAssocData3Prec = showbPrec
+
+# if __GLASGOW_HASKELL__ >= 708
+showbNullaryDataPrec :: Int -> NullaryData -> Builder
+showbNullaryDataPrec = showbPrec
+# endif
+
+showbGADTFamPrec :: (Show a, Show b, Show c) => Int -> GADTFam a b c -> Builder
+showbGADTFamPrec = showbPrec
+#endif
+
+-------------------------------------------------------------------------------
+
+$(deriveShow ''Nullary)
+instance Arbitrary Nullary where
+    arbitrary = pure Nullary
+
+$(deriveShow ''PhantomNullary)
+instance Arbitrary (PhantomNullary a) where
+    arbitrary = pure PhantomNullary
+
+$(deriveShow ''MonomorphicUnary)
+deriving instance Arbitrary MonomorphicUnary
+
+$(deriveShow ''PolymorphicUnary)
+deriving instance Arbitrary a => Arbitrary (PolymorphicUnary a b)
+
+$(deriveShow ''MonomorphicProduct)
+instance Arbitrary MonomorphicProduct where
+    arbitrary = MonomorphicProduct <$> arbitrary <*> arbitrary <*> arbitrary
+
+$(deriveShow ''PolymorphicProduct)
+instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (PolymorphicProduct a b c d) where
+    arbitrary = PolymorphicProduct <$> arbitrary <*> arbitrary <*> arbitrary
+
+$(deriveShow ''MonomorphicRecord)
+instance Arbitrary MonomorphicRecord where
+    arbitrary = MonomorphicRecord <$> arbitrary <*> arbitrary <*> arbitrary
+
+$(deriveShow ''PolymorphicRecord)
+instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (PolymorphicRecord a b c d) where
+    arbitrary = PolymorphicRecord <$> arbitrary <*> arbitrary <*> arbitrary
+
+$(deriveShow ''MonomorphicInfix)
+instance Arbitrary MonomorphicInfix where
+    arbitrary = (:/:) <$> arbitrary <*> arbitrary
+
+$(deriveShow ''PolymorphicInfix)
+instance (Arbitrary a, Arbitrary b) => Arbitrary (PolymorphicInfix a b c) where
+    arbitrary = PolyInf <$> arbitrary <*> arbitrary
+
+$(deriveShow ''MonomorphicForall)
+instance Arbitrary MonomorphicForall where
+    arbitrary = MonomorphicForall <$> (arbitrary :: Gen Int)
+
+$(deriveShow ''PolymorphicForall)
+instance Arbitrary a => Arbitrary (PolymorphicForall a b) where
+    arbitrary = PolymorphicForall <$> arbitrary <*> (arbitrary :: Gen Int)
+
+$(deriveShow ''AllAtOnce)
+instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (AllAtOnce a b c d) where
+    arbitrary = oneof [ pure AAONullary
+                      , AAOUnary   <$> arbitrary
+                      , AAOProduct <$> arbitrary <*> arbitrary <*> arbitrary
+                      , AAORecord  <$> arbitrary <*> arbitrary <*> arbitrary
+                      , (:/\:)     <$> arbitrary <*> arbitrary
+                      , AAOForall  <$> arbitrary <*> arbitrary <*> (arbitrary :: Gen Int)
+                      ]
+
+$(deriveShow ''GADT)
+instance __OVERLAPPING__  Arbitrary (GADT Char b c) where
+    arbitrary = pure GADTCon1
+instance __OVERLAPPING__  Arbitrary (GADT Double Double c) where
+    arbitrary = GADTCon2 <$> arbitrary
+instance __OVERLAPPING__  Arbitrary (GADT Int String c) where
+    arbitrary = GADTCon3 <$> arbitrary
+instance __OVERLAPPABLE__ Arbitrary a => Arbitrary (GADT a b c) where
+    arbitrary = GADTCon4 <$> arbitrary
+instance __OVERLAPPING__  Arbitrary b => Arbitrary (GADT b b c) where
+    arbitrary = GADTCon5 <$> arbitrary
+
+$(deriveShow ''PrimADT#)
+instance Arbitrary (PrimADT# a) where
+    arbitrary = do
+        i@(I# i#) <- arbitrary
+        F# f#     <- arbitrary
+        D# d#     <- arbitrary
+        C# c#     <- arbitrary
+        W# w#     <- arbitrary
+        oneof $ map pure [ PrimNormal# i# f# d# c# w#
+                         , PrimRecord# i# f# d# c# w#
+                         , i# `PrimInfixIntegral#` w#
+                         , f# `PrimInfixFloating#` d#
+                         , c# `PrimInfixChar#` c#
+                         , PrimForall# i i# f# d# c# w#
+                         ]
+
+$(deriveShow ''LeftAssocTree)
+instance Arbitrary a => Arbitrary (LeftAssocTree a) where
+    arbitrary = oneof [ LeftAssocLeaf <$> arbitrary
+                      , (:<:) <$> (LeftAssocLeaf <$> arbitrary)
+                              <*> (LeftAssocLeaf <$> arbitrary)
+                      ]
+
+$(deriveShow ''RightAssocTree)
+instance Arbitrary a => Arbitrary (RightAssocTree a) where
+    arbitrary = oneof [ RightAssocLeaf <$> arbitrary
+                      , (:>:) <$> (RightAssocLeaf <$> arbitrary)
+                              <*> (RightAssocLeaf <$> arbitrary)
+                      ]
+
+$(deriveShow ''(:?:))
+instance (Arbitrary a, Arbitrary b) => Arbitrary (a :?: b) where
+    arbitrary = (:?:) <$> arbitrary <*> arbitrary
+
+instance Show (f a) => Show (HigherKindedTypeParams f a) where
+    showbPrec = $(mkShowbPrec ''HigherKindedTypeParams)
+deriving instance Arbitrary (f a) => Arbitrary (HigherKindedTypeParams f a)
+
+instance (Read a, Show a) => Show (Restriction a) where
+    showbPrec = $(mkShowbPrec ''Restriction)
+deriving instance Arbitrary a => Arbitrary (Restriction a)
+
+instance (Read a, Show a) => Show (RestrictedContext a) where
+    showbPrec = $(mkShowbPrec ''RestrictedContext)
+deriving instance Arbitrary a => Arbitrary (RestrictedContext a)
+
+instance Show (f (Fix f)) => Show (Fix f) where
+    showbPrec = $(mkShowbPrec ''Fix)
+deriving instance Arbitrary (f (Fix f)) => Arbitrary (Fix f)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+$(deriveShow ''AllShow)
+instance Arbitrary (AllShow () () c d) where
+    arbitrary = pure ASNullary
+deriving instance Arbitrary (AllShow Int b c d)
+instance Arbitrary (AllShow Bool Bool c d) where
+    arbitrary = ASProduct <$> arbitrary <*> arbitrary
+instance Arbitrary c => Arbitrary (AllShow Char Double c d) where
+    arbitrary = ASRecord <$> arbitrary <*> arbitrary <*> arbitrary
+instance Arbitrary (AllShow Float Ordering c d) where
+    arbitrary = ASInfix <$> arbitrary <*> arbitrary
+
+$(deriveShow 'NASShow1)
+instance Arbitrary b => Arbitrary (NotAllShow Int b Int d) where
+    arbitrary = oneof [NASShow1 <$> arbitrary <*> arbitrary, NASShow2 <$> arbitrary]
+
+$(deriveShow ''OneDataInstance)
+instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (OneDataInstance a b c d) where
+    arbitrary = oneof [ pure ODINullary
+                      , ODIUnary   <$> arbitrary
+                      , ODIProduct <$> arbitrary <*> arbitrary
+                      , ODIRecord  <$> arbitrary <*> arbitrary <*> arbitrary
+                      , ODIInfix   <$> arbitrary <*> arbitrary
+                      ]
+
+$(deriveShow ''AssocData1)
+deriving instance Arbitrary (AssocData1 ())
+
+$(deriveShow 'AssocCon2)
+deriving instance Arbitrary (AssocData2 () Int Int)
+
+#if __GLASGOW_HASKELL__ >= 708
+$(deriveShow 'NullaryCon)
+deriving instance Arbitrary NullaryData
+#endif
+
+$(deriveShow 'GADTFamCon1)
+instance __OVERLAPPING__  Arbitrary (GADTFam Char b c) where
+    arbitrary = pure GADTFamCon1
+instance __OVERLAPPING__  Arbitrary (GADTFam Double Double c) where
+    arbitrary = GADTFamCon2 <$> arbitrary
+instance __OVERLAPPING__  Arbitrary (GADTFam Int String c) where
+    arbitrary = GADTFamCon3 <$> arbitrary
+instance __OVERLAPPABLE__ Arbitrary a => Arbitrary (GADTFam a b c) where
+    arbitrary = GADTFamCon4 <$> arbitrary
+instance __OVERLAPPING__  Arbitrary b => Arbitrary (GADTFam b b c) where
+    arbitrary = GADTFamCon5 <$> arbitrary
+#endif
tests/Instances/Utils.hs view
@@ -1,16 +1,16 @@-{-|-Module:      Properties.Instances-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--A collection of utility functions.--}-module Instances.Utils ((<@>)) where--infixl 4 <@>--- | A useful way to escape a 'Functor' context.-(<@>) :: Functor f => f (a -> b) -> a -> f b+{-|
+Module:      Properties.Instances
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+A collection of utility functions.
+-}
+module Instances.Utils ((<@>)) where
+
+infixl 4 <@>
+-- | A useful way to escape a 'Functor' context.
+(<@>) :: Functor f => f (a -> b) -> a -> f b
 f <@> x = fmap ($ x) f
tests/Properties.hs view
@@ -1,31 +1,31 @@-{-|-Module:      Properties-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@QuickCheck@ tests for @text-show@.--}-module Main (main) where--import Properties.BaseAndFriends (baseAndFriendsTests)-import Properties.Builder        (builderTests)-import Properties.Derived        (derivedTests)-import Properties.MkShow         (mkShowTests)--import Test.Tasty (TestTree, defaultMain, testGroup)--main :: IO ()-main = defaultMain testTree--allTests :: [TestTree]-allTests = concat [ baseAndFriendsTests-                  , builderTests-                  , derivedTests-                  , mkShowTests-                  ]--testTree :: TestTree+{-|
+Module:      Properties
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+@QuickCheck@ tests for @text-show@.
+-}
+module Main (main) where
+
+import Properties.BaseAndFriends (baseAndFriendsTests)
+import Properties.Builder        (builderTests)
+import Properties.Derived        (derivedTests)
+import Properties.MkShow         (mkShowTests)
+
+import Test.Tasty (TestTree, defaultMain, testGroup)
+
+main :: IO ()
+main = defaultMain testTree
+
+allTests :: [TestTree]
+allTests = concat [ baseAndFriendsTests
+                  , builderTests
+                  , derivedTests
+                  , mkShowTests
+                  ]
+
+testTree :: TestTree
 testTree = testGroup "QuickCheck properties" allTests
tests/Properties/BaseAndFriends.hs view
@@ -1,623 +1,623 @@-{-# LANGUAGE CPP              #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE TypeOperators    #-}-#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}-#endif-{-|-Module:      Properties.BaseAndFriends-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@QuickCheck@ properties for data types located in @base@ and other-common libraries.--}-module Properties.BaseAndFriends (baseAndFriendsTests) where--import           Control.Applicative (Const, ZipList, liftA2)-#if !(MIN_VERSION_base(4,8,0))-import           Control.Applicative ((*>), pure)-#endif-import           Control.Concurrent (myThreadId)-import           Control.Exception-import           Control.Monad.ST--#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)-import           Data.Array (Array)-import           Data.Array.Unboxed (UArray)-#endif-import           Data.Array (elems)-import qualified Data.ByteString      as BS (ByteString)-import qualified Data.ByteString.Lazy as BL (ByteString)-import           Data.ByteString.Short (ShortByteString)-import           Data.Char (GeneralCategory, intToDigit)-import           Data.Complex (Complex)-import qualified Data.Data as D (Fixity)-import           Data.Data (Constr, ConstrRep, DataRep, DataType)-import           Data.Dynamic (Dynamic)-import           Data.Fixed (Fixed, E0, E1, E2, E3, E6, E9, E12, showFixed)-import           Data.Functor.Identity (Identity)-import           Data.Int (Int8, Int16, Int32, Int64)-import           Data.Monoid (All(..), Any(..), Dual(..), First(..),-                              Last(..), Product(..), Sum(..))-#if MIN_VERSION_base(4,8,0)-import           Data.Monoid (Alt(..))-#endif-#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-import qualified Data.OldTypeable as OldT (TyCon, TypeRep)-#endif-#if MIN_VERSION_base(4,6,0)-import           Data.Ord (Down(..))-#endif-import           Data.Proxy (Proxy)-import           Data.Ratio (Ratio)-import qualified Data.Text as TS-import qualified Data.Text as TL-#if MIN_VERSION_base(4,7,0)-import           Data.Type.Coercion (Coercion)-import           Data.Type.Equality ((:~:))-#endif-import qualified Data.Typeable as NewT (TyCon, TypeRep)-import           Data.Word (Word8, Word16, Word32, Word64)-#if !(MIN_VERSION_base(4,8,0))-import           Data.Word (Word)-#endif-import           Data.Version (Version, showVersion)--import qualified Debug.Trace as S (traceShow)--import           Foreign.C.Types-import           Foreign.ForeignPtr (newForeignPtr_)-import           Foreign.Ptr (FunPtr, IntPtr, Ptr, WordPtr)--import           GHC.Conc (BlockReason, ThreadStatus)-#if !(defined(__GHCJS__))-# if defined(mingw32_HOST_OS)-import           GHC.Conc.Windows (ConsoleEvent)-# else-import           GHC.Event (Event)-# endif-#endif-import           GHC.Fingerprint.Type (Fingerprint)-import qualified GHC.Generics as G (Fixity)-import           GHC.Generics (U1, Par1, Rec1, K1, M1, (:+:), (:*:), (:.:),-                               Associativity, Arity)-import           GHC.IO.Encoding.Failure (CodingFailureMode)-import           GHC.IO.Encoding.Types (CodingProgress)-#if MIN_VERSION_base(4,8,0)-import           GHC.RTS.Flags-import           GHC.StaticPtr (StaticPtrInfo)-#endif-import           GHC.Stats (GCStats)-import           GHC.Show (asciiTab)-#if MIN_VERSION_base(4,7,0)-import           GHC.TypeLits (SomeNat, SomeSymbol)-#endif--import           Instances.BaseAndFriends ()--import           Numeric (showIntAtBase, showEFloat, showFFloat, showGFloat)-#if MIN_VERSION_base(4,7,0)-import           Numeric (showFFloatAlt, showGFloatAlt)-#endif-import           Numeric.Natural (Natural)--import           Prelude hiding (Show)--import           Properties.Utils--import           System.Exit (ExitCode)-import qualified System.IO as S (print)-import           System.IO (BufferMode, IOMode, HandlePosn, Newline,-                            NewlineMode, SeekMode, Handle,-                            hFlush, mkTextEncoding, stdout, stderr)-import           System.IO.Silently (capture_, hCapture_)-import           System.Posix.Types--import           Test.QuickCheck.Instances ()-import           Test.Tasty (TestTree, testGroup)-import           Test.Tasty.HUnit ((@=?), testCase)-import           Test.Tasty.QuickCheck (Gen, Property, arbitrary, generate,-                                        oneof, suchThat, testProperty)--import           Text.Read.Lex (Lexeme)-#if MIN_VERSION_base(4,7,0)-import           Text.Read.Lex (Number)-#endif-import           Text.Show (showListWith)-import           Text.Show.Functions ()-import qualified Text.Show.Text as T (print)-import           Text.Show.Text hiding (Show, print)-import           Text.Show.Text.Data.Char (asciiTabB)-import           Text.Show.Text.Data.Fixed (showbFixed)-import           Text.Show.Text.Data.Floating (showbEFloat, showbFFloat, showbGFloat)-#if MIN_VERSION_base(4,7,0)-import           Text.Show.Text.Data.Floating (showbFFloatAlt, showbGFloatAlt)-#endif-import           Text.Show.Text.Data.Integral (showbIntAtBase)-import           Text.Show.Text.Data.List (showbListWith)-import           Text.Show.Text.Data.Version (showbVersionConcrete)-import qualified Text.Show.Text.Debug.Trace as T (traceShow)-import           Text.Show.Text.Functions ()-import           Text.Show.Text.Generic (ConType)--#include "HsBaseConfig.h"---- | Verifies the 'print' functions for 'String' and 'TS.Text' @Show@ display--- the same output.-prop_print :: String -> Property-prop_print str = ioProperty $ do-    sRes <- capture_ $ S.print str *> hFlush stdout-    tRes <- capture_ $ T.print str *> hFlush stdout-    pure $ sRes == tRes---- | Verifies 'showFixed' and 'showbFixed' generate the same output.-prop_showFixed :: Bool -> Fixed E12 -> Bool-prop_showFixed b f = fromString (showFixed b f) == showbFixed b f---- | Verifies the 'Show' instance for 'ForeignPtr' is accurate.-prop_showForeignPtr :: Int -> Ptr Int -> Property-prop_showForeignPtr p ptr = ioProperty $ do-    fptr <- newForeignPtr_ ptr-    pure $ prop_matchesShow p fptr---- | Verifies 'showIntAtBase' and 'showbIntAtBase' generate the same output.-#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)-prop_showIntAtBase :: Gen Bool-prop_showIntAtBase = do-    base <- arbitrary `suchThat` (liftA2 (&&) (> 1) (<= 16))-    i    <- arbitrary `suchThat` (>= 0) :: Gen Int-    pure $ fromString (showIntAtBase base intToDigit i "") == showbIntAtBase base intToDigit i-#endif---- | Verifies 'showListWith' and 'showbListWith' generate the same output.-prop_showListWith :: [Char] -> Bool-prop_showListWith str = fromString (showListWith shows str "") == showbListWith showb str---- | Verifies the 'Show' instance for 'TextEncoding' is accurate.-prop_showTextEncoding :: Int -> Property-prop_showTextEncoding p = ioProperty $ do-    -- Based on this description:-    -- http://hackage.haskell.org/package/base-4.7.0.2/docs/System-IO.html#v:mkTextEncoding-    utf <- generate . oneof $ map pure [ "UTF-8"-                                       , "UTF-16", "UTF-16BE", "UTF-16LE"-                                       , "UTF-32", "UTF-32BE", "UTF-32LE"-                                       ]-    tenc <- mkTextEncoding utf-    pure $ prop_matchesShow p tenc---- | Verifies the 'Show' instance for 'ThreadId' is accurate.-prop_showThreadId :: Int -> Property-prop_showThreadId p = ioProperty $ do-    tid <- myThreadId-    pure $ prop_matchesShow p tid---- | Verifies @showXFloat@ and @showbXFloat@ generate the same output (where @X@--- is one of E, F, or G).-prop_showXFloat :: (Maybe Int -> Double -> ShowS) -> (Maybe Int -> Double -> Builder) -> Double -> Gen Bool-prop_showXFloat f1 f2 val = do-    digs <- arbitrary `suchThat` (<= 10)-    pure $ fromString (f1 (Just digs) val "") == f2 (Just digs) val---- | Verifies 'showVersion' and 'showbVersion' generate the same output.-prop_showVersion :: Version -> Bool-prop_showVersion v = fromString (showVersion v) == showbVersionConcrete v--#if MIN_VERSION_base(4,8,0)--- | Verifies that the 'Show' instance for 'RTSFlags' is accurate.-prop_showRTSFlags :: Int -> Property-prop_showRTSFlags p = ioProperty $ do-    rtsflags <- getRTSFlags-    pure $ prop_matchesShow p rtsflags---- | Verifies that the 'Show' instance for 'GCFlags' is accurate.-prop_showGCFlags :: Int -> Property-prop_showGCFlags p = ioProperty $ do-    gcflags <- getGCFlags-    pure $ prop_matchesShow p gcflags---- | Verifies that the 'Show' instance for 'CCFlags' is accurate.-prop_showCCFlags :: Int -> Property-prop_showCCFlags p = ioProperty $ do-    ccflags <- getCCFlags-    pure $ prop_matchesShow p ccflags---- | Verifies that the 'Show' instance for 'ProfFlags' is accurate.-prop_showProfFlags :: Int -> Property-prop_showProfFlags p = ioProperty $ do-    profflags <- getProfFlags-    pure $ prop_matchesShow p profflags---- | Verifies that the 'Show' instance for 'TraceFlags' is accurate.-prop_showTraceFlags :: Int -> Property-prop_showTraceFlags p = ioProperty $ do-    traceflags <- getTraceFlags-    pure $ prop_matchesShow p traceflags-#endif---- | Verifies the 'traceShow' functions for 'String' and 'TS.Text' @Show@ display--- the same output.-prop_traceShow :: String -> Property-prop_traceShow str = ioProperty $ do-    let handles = [stdout, stderr]-    sRes <- hCapture_ handles $ S.traceShow str (pure ()) *> mapM_ hFlush handles-    tRes <- hCapture_ handles $ T.traceShow str (pure ()) *> mapM_ hFlush handles-    pure $ sRes == tRes--baseAndFriendsTests :: [TestTree]-baseAndFriendsTests =-    [ testGroup "Text.Show.Text"-        [ testProperty "FromStringShow Int instance"             (prop_matchesShow :: Int -> FromStringShow Int -> Bool)-        , testProperty "FromStringShow Int: read . show = id"    (prop_readShow :: Int -> FromStringShow Int -> Bool)-        , testProperty "FromStringShow Int = Int" $              prop_showEq (FromStringShow :: Int -> FromStringShow Int)-        , testProperty "FromStringShow [Char] instance"          (prop_matchesShow :: Int -> FromStringShow [Char] -> Bool)-        , testProperty "FromStringShow [Char]: read . show = id" (prop_readShow :: Int -> FromStringShow [Char] -> Bool)-        , testProperty "FromStringShow [Char] = String" $        prop_showEq (FromStringShow :: String -> FromStringShow [Char])-        , testProperty "FromTextShow Int instance"               (prop_matchesShow :: Int -> FromTextShow Int -> Bool)-        , testProperty "FromTextShow Int: read . show = id"      (prop_readShow :: Int -> FromTextShow Int -> Bool)-        , testProperty "FromTextShow Int = Int" $                prop_showEq (FromTextShow :: Int -> FromTextShow Int)-        , testProperty "FromTextShow [Char] instance"            (prop_matchesShow :: Int -> FromTextShow [Char] -> Bool)-        , testProperty "FromTextShow [Char]: read . show = id"   (prop_readShow :: Int -> FromTextShow [Char] -> Bool)-        , testProperty "FromTextShow [Char] = String" $          prop_showEq (FromTextShow :: String -> FromTextShow [Char])-        , testProperty "print behavior"                          prop_print-        , testProperty "traceShow behavior"                      prop_traceShow-        ]-    , testGroup "Text.Show.Text.Control.Applicative"-        [ testProperty "Const Int Int instance"                  (prop_matchesShow :: Int -> Const Int Int -> Bool)-        , testProperty "ZipList Int instance"                    (prop_matchesShow :: Int -> ZipList Int -> Bool)-        ]-    , testGroup "Text.Show.Text.Control.Concurrent"-        [ testProperty "BlockReason instance"                    (prop_matchesShow :: Int -> BlockReason -> Bool)-        , testProperty "ThreadId instance"                       prop_showThreadId-        , testProperty "ThreadStatus instance"                   (prop_matchesShow :: Int -> ThreadStatus -> Bool)-        ]-    , testGroup "Text.Show.Text.Control.Exception"-        [ testProperty "SomeException instance"                  (prop_matchesShow :: Int -> SomeException -> Bool)-        , testProperty "IOException instance"                    (prop_matchesShow :: Int -> IOException -> Bool)-        , testProperty "ArithException instance"                 (prop_matchesShow :: Int -> ArithException -> Bool)-        , testProperty "ArrayException instance"                 (prop_matchesShow :: Int -> ArrayException -> Bool)-        , testProperty "AssertionFailed instance"                (prop_matchesShow :: Int -> AssertionFailed -> Bool)-#if MIN_VERSION_base(4,7,0)-        , testProperty "SomeAsyncException instance"             (prop_matchesShow :: Int -> SomeAsyncException -> Bool)-#endif-        , testProperty "AsyncException instance"                 (prop_matchesShow :: Int -> AsyncException -> Bool)-        , testProperty "NonTermination instance"                 (prop_matchesShow :: Int -> NonTermination -> Bool)-        , testProperty "NestedAtomically instance"               (prop_matchesShow :: Int -> NestedAtomically -> Bool)-        , testProperty "BlockedIndefinitelyOnMVar instance"      (prop_matchesShow :: Int -> BlockedIndefinitelyOnMVar -> Bool)-        , testProperty "BlockedIndefinitelyOnSTM instance"       (prop_matchesShow :: Int -> BlockedIndefinitelyOnSTM -> Bool)-#if MIN_VERSION_base(4,8,0)-        , testProperty "AllocationLimitExceeded instance"        (prop_matchesShow :: Int -> AllocationLimitExceeded -> Bool)-#endif-        , testProperty "Deadlock instance"                       (prop_matchesShow :: Int -> Deadlock -> Bool)-        , testProperty "NoMethodError instance"                  (prop_matchesShow :: Int -> NoMethodError -> Bool)-        , testProperty "PatternMatchFail instance"               (prop_matchesShow :: Int -> PatternMatchFail -> Bool)-        , testProperty "RecConError instance"                    (prop_matchesShow :: Int -> RecConError -> Bool)-        , testProperty "RecSelError instance"                    (prop_matchesShow :: Int -> RecSelError -> Bool)-        , testProperty "RecUpdError instance"                    (prop_matchesShow :: Int -> RecUpdError -> Bool)-        , testProperty "ErrorCall instance"                      (prop_matchesShow :: Int -> ErrorCall -> Bool)-        , testProperty "MaskingState instance"                   (prop_matchesShow :: Int -> MaskingState -> Bool)-        ]-    , testGroup "Text.Show.Text.Control.Monad.ST"-        [ testProperty "ST instance"                             (prop_matchesShow :: Int -> ST Int Int -> Bool)-        ]-#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)--- TODO: Figure out why this test diverges on Windows-    , testGroup "Text.Show.Text.Data.Array"-        [ testProperty "Array Int Int instance"                  (prop_matchesShow :: Int -> Array Int Int -> Bool)-        , testProperty "UArray Int Int instance"                 (prop_matchesShow :: Int -> UArray Int Int -> Bool)-        ]-#endif-    , testGroup "Text.Show.Text.Data.Bool"-        [ testProperty "Bool instance"                           (prop_matchesShow :: Int -> Bool -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.ByteString"-        [ testProperty "strict ByteString instance"              (prop_matchesShow :: Int -> BS.ByteString -> Bool)-        , testProperty "lazy ByteString instance"                (prop_matchesShow :: Int -> BL.ByteString -> Bool)-        , testProperty "ShortByteString instance"                (prop_matchesShow :: Int -> ShortByteString -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Char"-        [ testProperty "Char instance"                           (prop_matchesShow :: Int -> Char -> Bool)-        , testProperty "GeneralCategory instance"                (prop_matchesShow :: Int -> GeneralCategory -> Bool)-        , testCase "asciiTab = asciiTabB" $                      map fromString asciiTab @=? elems (asciiTabB)-        ]-    , testGroup "Text.Show.Text.Data.Complex"-        [ testProperty "Complex Double instance"                 (prop_matchesShow :: Int -> Complex Double -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Data"-        [ testProperty "Constr instance"                         (prop_matchesShow :: Int -> Constr -> Bool)-        , testProperty "ConstrRep instance"                      (prop_matchesShow :: Int -> ConstrRep -> Bool)-        , testProperty "DataRep instance"                        (prop_matchesShow :: Int -> DataRep -> Bool)-        , testProperty "DataType instance"                       (prop_matchesShow :: Int -> DataType -> Bool)-        , testProperty "Fixity instance"                         (prop_matchesShow :: Int -> D.Fixity -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Dynamic"-        [ testProperty "Dynamic instance"                        (prop_matchesShow :: Int -> Dynamic -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Either"-        [ testProperty "Either Int Int instance"                 (prop_matchesShow :: Int -> Either Int Int -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Fixed"-        [ testProperty "Fixed E0 instance"                       (prop_matchesShow :: Int -> Fixed E0 -> Bool)-        , testProperty "Fixed E1 instance"                       (prop_matchesShow :: Int -> Fixed E1 -> Bool)-        , testProperty "Fixed E2 instance"                       (prop_matchesShow :: Int -> Fixed E2 -> Bool)-        , testProperty "Fixed E3 instance"                       (prop_matchesShow :: Int -> Fixed E3 -> Bool)-        , testProperty "Fixed E6 instance"                       (prop_matchesShow :: Int -> Fixed E6 -> Bool)-        , testProperty "Fixed E9 instance"                       (prop_matchesShow :: Int -> Fixed E9 -> Bool)-        , testProperty "Fixed E12 instance"                      (prop_matchesShow :: Int -> Fixed E12 -> Bool)-        , testProperty "showFixed output"                        prop_showFixed-        ]-    , testGroup "Text.Show.Text.Data.Floating"-        [ testProperty "Float instance"                          (prop_matchesShow :: Int -> Float -> Bool)-        , testProperty "Double instance"                         (prop_matchesShow :: Int -> Double -> Bool)-        , testProperty "showbEFloat output" $                    prop_showXFloat showEFloat showbEFloat-        , testProperty "showbFFloat output" $                    prop_showXFloat showFFloat showbFFloat-        , testProperty "showbGFloat output" $                    prop_showXFloat showGFloat showbGFloat-#if MIN_VERSION_base(4,7,0)-        , testProperty "showbFFloatAlt output" $                 prop_showXFloat showFFloatAlt showbFFloatAlt-        , testProperty "showbGFloatAlt output" $                 prop_showXFloat showGFloatAlt showbGFloatAlt-#endif-        ]-    , testGroup "Text.Show.Text.Data.Functions"-        [ testProperty "Int -> Int instance"                     (prop_matchesShow :: Int -> (Int -> Int) -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Functor.Identity"-        [ testProperty "Identity Int instance"                   (prop_matchesShow :: Int -> Identity Int -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Integral"-        [ testProperty "Int instance"                            (prop_matchesShow :: Int -> Int -> Bool)-        , testProperty "Int8 instance"                           (prop_matchesShow :: Int -> Int8 -> Bool)-        , testProperty "Int16 instance"                          (prop_matchesShow :: Int -> Int16 -> Bool)-        , testProperty "Int32 instance"                          (prop_matchesShow :: Int -> Int32 -> Bool)-        , testProperty "Int64 instance"                          (prop_matchesShow :: Int -> Int64 -> Bool)-        , testProperty "Integer instance"                        (prop_matchesShow :: Int -> Integer -> Bool)-        , testProperty "Word instance"                           (prop_matchesShow :: Int -> Word -> Bool)-        , testProperty "Word8 instance"                          (prop_matchesShow :: Int -> Word8 -> Bool)-        , testProperty "Word16 instance"                         (prop_matchesShow :: Int -> Word16 -> Bool)-        , testProperty "Word32 instance"                         (prop_matchesShow :: Int -> Word32 -> Bool)-        , testProperty "Word64 instance"                         (prop_matchesShow :: Int -> Word64 -> Bool)-#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)--- TODO: Figure out why this diverges on Windows-        , testProperty "showbIntAtBase output"                   prop_showIntAtBase-#endif-        ]-    , testGroup "Text.Show.Text.Data.List"-        [ testProperty "String instance"                         (prop_matchesShow :: Int -> String -> Bool)-        , testProperty "[String] instance"                       (prop_matchesShow :: Int -> [String] -> Bool)-        , testProperty "[Int] instance"                          (prop_matchesShow :: Int -> [Int] -> Bool)-        , testProperty "showbListWith output"                    prop_showListWith-        ]-    , testGroup "Text.Show.Text.Data.Maybe"-        [ testProperty "Maybe Int instance"                      (prop_matchesShow :: Int -> Maybe Int -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Monoid"-        [ testProperty "All instance"                            (prop_matchesShow :: Int -> All -> Bool)-        , testProperty "Any instance"                            (prop_matchesShow :: Int -> Any -> Bool)-        , testProperty "Dual Int instance"                       (prop_matchesShow :: Int -> Dual Int -> Bool)-        , testProperty "First (Maybe Int) instance"              (prop_matchesShow :: Int -> First (Maybe Int) -> Bool)-        , testProperty "Last (Maybe Int) instance"               (prop_matchesShow :: Int -> Last (Maybe Int) -> Bool)-        , testProperty "Product Int instance"                    (prop_matchesShow :: Int -> Product Int -> Bool)-        , testProperty "Sum Int instance"                        (prop_matchesShow :: Int -> Sum Int -> Bool)-#if MIN_VERSION_base(4,8,0)-        , testProperty "Alt Maybe Int instance"                  (prop_matchesShow :: Int -> Alt Maybe Int -> Bool)-#endif-        ]-#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-    , testGroup "Text.Show.Text.Data.OldTypeable"-        [ testProperty "TypeRep instance"                        (prop_matchesShow :: Int -> OldT.TypeRep -> Bool)-        , testProperty "TyCon instance"                          (prop_matchesShow :: Int -> OldT.TyCon -> Bool)-        ]-#endif-    , testGroup "Text.Show.Text.Data.Ord"-        [ testProperty "Ordering instance"                       (prop_matchesShow :: Int -> Ordering -> Bool)-#if MIN_VERSION_base(4,6,0)-        , testProperty "Down Int instance"                       (prop_matchesShow :: Int -> Down Int -> Bool)-#endif-        ]-    , testGroup "Text.Show.Text.Data.Proxy"-        [ testProperty "Proxy Int instance"                      (prop_matchesShow :: Int -> Proxy Int -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Ratio"-        [ testProperty "Ratio Int instance"                      (prop_matchesShow :: Int -> Ratio Int -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Text"-        [ testProperty "Builder instance"                        (prop_matchesShow :: Int -> Builder -> Bool)-        , testProperty "strict Text instance"                    (prop_matchesShow :: Int -> TS.Text -> Bool)-        , testProperty "lazy Text instance"                      (prop_matchesShow :: Int -> TL.Text -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Tuple"-        [ testProperty "() instance"                             (prop_matchesShow :: Int -> () -> Bool)-        , testProperty "(Int, Int) instance"                     (prop_matchesShow :: Int -> (Int, Int) -> Bool)-        , testProperty "(Int, Int, Int) instance"                (prop_matchesShow :: Int -> (Int, Int, Int) -> Bool)-        , testProperty "(Int, Int, Int, Int) instance"           (prop_matchesShow :: Int -> (Int, Int, Int, Int) -> Bool)-        , testProperty "(Int, Int, Int, Int, Int) instance"      (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int) -> Bool)-        , testProperty "() generic show"                         (prop_genericShow :: Int -> () -> Bool)-        , testProperty "(Int, Int) generic show"                 (prop_genericShow :: Int -> (Int, Int) -> Bool)-        , testProperty "(Int, Int, Int) generic show"            (prop_genericShow :: Int -> (Int, Int, Int) -> Bool)-        , testProperty "(Int, Int, Int, Int) generic show"       (prop_genericShow :: Int -> (Int, Int, Int, Int) -> Bool)-        , testProperty "(Int, Int, Int, Int, Int) generic show"  (prop_genericShow :: Int -> (Int, Int, Int, Int, Int) -> Bool)-        ]-#if MIN_VERSION_base(4,7,0)-    , testGroup "Text.Show.Text.Data.Type.Coercion"-        [ testProperty "Coercion instance"                       (prop_matchesShow :: Int -> Coercion All Bool -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Type.Equality"-        [ testProperty "(:~:) instance"                          (prop_matchesShow :: Int -> Int :~: Int -> Bool)-        ]-#endif-    , testGroup "Text.Show.Text.Data.Typeable"-        [ testProperty "TypeRep instance"                        (prop_matchesShow :: Int -> NewT.TypeRep -> Bool)-        , testProperty "TyCon instance"                          (prop_matchesShow :: Int -> NewT.TyCon -> Bool)-        ]-    , testGroup "Text.Show.Text.Data.Version"-        [ testProperty "Version instance"                        (prop_matchesShow :: Int -> Version -> Bool)-        , testProperty "showbVersionConcrete output"             prop_showVersion-        ]-    , testGroup "Text.Show.Text.Foreign.C.Types"-        [ testProperty "CChar"                                   (prop_matchesShow :: Int -> CChar -> Bool)-        , testProperty "CSChar instance"                         (prop_matchesShow :: Int -> CSChar -> Bool)-        , testProperty "CUChar instance"                         (prop_matchesShow :: Int -> CUChar -> Bool)-        , testProperty "CShort instance"                         (prop_matchesShow :: Int -> CShort -> Bool)-        , testProperty "CUShort instance"                        (prop_matchesShow :: Int -> CUShort -> Bool)-        , testProperty "CInt instance"                           (prop_matchesShow :: Int -> CInt -> Bool)-        , testProperty "CUInt instance"                          (prop_matchesShow :: Int -> CUInt -> Bool)-        , testProperty "CLong instance"                          (prop_matchesShow :: Int -> CLong -> Bool)-        , testProperty "CULong instance"                         (prop_matchesShow :: Int -> CULong -> Bool)-        , testProperty "CPtrdiff instance"                       (prop_matchesShow :: Int -> CPtrdiff -> Bool)-        , testProperty "CSize instance"                          (prop_matchesShow :: Int -> CSize -> Bool)-        , testProperty "CWchar instance"                         (prop_matchesShow :: Int -> CWchar -> Bool)-        , testProperty "CSigAtomic instance"                     (prop_matchesShow :: Int -> CSigAtomic -> Bool)-        , testProperty "CLLong instance"                         (prop_matchesShow :: Int -> CLLong -> Bool)-        , testProperty "CULLong instance"                        (prop_matchesShow :: Int -> CULLong -> Bool)-        , testProperty "CIntPtr instance"                        (prop_matchesShow :: Int -> CIntPtr -> Bool)-        , testProperty "CUIntPtr instance"                       (prop_matchesShow :: Int -> CUIntPtr -> Bool)-        , testProperty "CIntMax instance"                        (prop_matchesShow :: Int -> CIntMax -> Bool)-        , testProperty "CUIntPtr instance"                       (prop_matchesShow :: Int -> CUIntPtr -> Bool)-        , testProperty "CIntMax instance"                        (prop_matchesShow :: Int -> CIntMax -> Bool)-        , testProperty "CUIntMax instance"                       (prop_matchesShow :: Int -> CUIntMax -> Bool)-        , testProperty "CClock instance"                         (prop_matchesShow :: Int -> CClock -> Bool)-        , testProperty "CTime instance"                          (prop_matchesShow :: Int -> CTime -> Bool)-        , testProperty "CUSeconds instance"                      (prop_matchesShow :: Int -> CUSeconds -> Bool)-        , testProperty "CSUSeconds instance"                     (prop_matchesShow :: Int -> CSUSeconds -> Bool)-        , testProperty "CFloat instance"                         (prop_matchesShow :: Int -> CFloat -> Bool)-        , testProperty "CDouble instance"                        (prop_matchesShow :: Int -> CUChar -> Bool)-        ]-    , testGroup "Text.Show.Text.Foreign.Ptr"-        [ testProperty "Ptr Int instance"                        (prop_matchesShow :: Int -> Ptr Int -> Bool)-        , testProperty "FunPtr Int instance"                     (prop_matchesShow :: Int -> FunPtr Int -> Bool)-        , testProperty "IntPtr instance"                         (prop_matchesShow :: Int -> IntPtr -> Bool)-        , testProperty "WordPtr instance"                        (prop_matchesShow :: Int -> WordPtr -> Bool)-        , testProperty "ForeignPtr instance"                     prop_showForeignPtr-        ]-#if !(defined(mingw32_HOST_OS) || defined(__GHCJS__))-    , testGroup "Text.Show.Text.GHC.Event"-        [ testProperty "Event instance"                          (prop_matchesShow :: Int -> Event -> Bool)---         , testProperty "FdKey instance"                          (prop_matchesShow :: Int -> FdKey -> Bool)-        ]-#endif-    , testGroup "Text.Show.Text.Generic"-        [ testProperty "ConType instance"                        (prop_matchesShow :: Int -> ConType -> Bool)-        , testProperty "ConType generic show"                    (prop_genericShow :: Int -> ConType -> Bool)-        ]-#if defined(mingw32_HOST_OS) && !(defined(__GHCJS__))-    , testGroup "Text.Show.Text.GHC.Conc.Windows"-        [ testProperty "ConsoleEvent instance"                   (prop_matchesShow :: Int -> ConsoleEvent -> Bool)-        ]-#endif-    , testGroup "Text.Show.Text.GHC.Fingerprint"-        [ testProperty "Fingerprint instance"                    (prop_matchesShow :: Int -> Fingerprint -> Bool)-        ]-    , testGroup "Text.Show.Text.GHC.Generics"-        [ testProperty "U1 Int instance"                         (prop_matchesShow :: Int -> U1 Int -> Bool)-        , testProperty "Par1 Int instance"                       (prop_matchesShow :: Int -> Par1 Int -> Bool)-        , testProperty "Rec1 Maybe Int instance"                 (prop_matchesShow :: Int -> Rec1 Maybe Int -> Bool)-        , testProperty "K1 () Int () instance"                   (prop_matchesShow :: Int -> K1 () Int () -> Bool)-        , testProperty "M1 () () Maybe Int instance"             (prop_matchesShow :: Int -> M1 () () Maybe Int -> Bool)-        , testProperty "(Maybe :+: Maybe) Int instance"          (prop_matchesShow :: Int -> (Maybe :+: Maybe) Int -> Bool)-        , testProperty "(Maybe :*: Maybe) Int instance"          (prop_matchesShow :: Int -> (Maybe :*: Maybe) Int -> Bool)-        , testProperty "(Maybe :.: Maybe) Int instance"          (prop_matchesShow :: Int -> (Maybe :.: Maybe) Int -> Bool)-        , testProperty "Fixity instance"                         (prop_matchesShow :: Int -> G.Fixity -> Bool)-        , testProperty "Associativity instance"                  (prop_matchesShow :: Int -> Associativity -> Bool)-        , testProperty "Arity instance"                          (prop_matchesShow :: Int -> Arity -> Bool)-        ]-#if MIN_VERSION_base(4,8,0)-    , testGroup "Text.Show.Text.GHC.RTS.Flags"-        [ testProperty "RTSFlags instance"                       prop_showRTSFlags-        , testProperty "GCFlags instance"                        prop_showGCFlags-        , testProperty "ConcFlags instance"                      (prop_matchesShow :: Int -> ConcFlags -> Bool)-        , testProperty "MiscFlags instance"                      (prop_matchesShow :: Int -> MiscFlags -> Bool)-        , testProperty "DebugFlags instance"                     (prop_matchesShow :: Int -> DebugFlags -> Bool)-        , testProperty "CCFlags instance"                        prop_showCCFlags-        , testProperty "ProfFlags instance"                      prop_showProfFlags-        , testProperty "TraceFlags instance"                     prop_showTraceFlags-        , testProperty "TickyFlags instance"                     (prop_matchesShow :: Int -> TickyFlags -> Bool)-        ]-    , testGroup "Text.Show.Text.GHC.StaticPtr"-        [ testProperty "StaticPtrInfo instance"                  (prop_matchesShow :: Int -> StaticPtrInfo -> Bool)-        ]-#endif-    , testGroup "Text.Show.Text.GHC.Stats"-        [ testProperty "GCStats instance"                        (prop_matchesShow :: Int -> GCStats -> Bool)-        ]-#if MIN_VERSION_base(4,6,0)-    , testGroup "Text.Show.Text.GHC.TypeLits"-        [-# if MIN_VERSION_base(4,7,0)-          testProperty "SomeNat instance"                        (prop_matchesShow :: Int -> SomeNat -> Bool)-        , testProperty "SomeSymbol instance"                     (prop_matchesShow :: Int -> SomeSymbol -> Bool)--- # else---           testProperty "IsEven instance"                         (prop_matchesShow :: Int -> IsEven -> Bool)---         , testProperty "IsZero instance"                         (prop_matchesShow :: Int -> IsZero -> Bool)-# endif-        ]-#endif-    , testGroup "Text.Show.Text.Numeric.Natural"-        [ testProperty "Natural instance"                        (prop_matchesShow :: Int -> Natural -> Bool)-        ]-    , testGroup "Text.Show.Text.System.Exit"-        [ testProperty "ExitCode instance"                       (prop_matchesShow :: Int -> ExitCode -> Bool)-        ]-    , testGroup "Text.Show.Text.System.IO"-        [ testProperty "Handle instance"                         (prop_matchesShow :: Int -> Handle -> Bool)-        , testProperty "IOMode instance"                         (prop_matchesShow :: Int -> IOMode -> Bool)-        , testProperty "BufferMode instance"                     (prop_matchesShow :: Int -> BufferMode -> Bool)-        , testProperty "HandlePosn instance"                     (prop_matchesShow :: Int -> HandlePosn -> Bool)-        , testProperty "SeekMode instance"                       (prop_matchesShow :: Int -> SeekMode -> Bool)-        , testProperty "TextEncoding"                            prop_showTextEncoding-        , testProperty "CodingProgress instance"                 (prop_matchesShow :: Int -> CodingProgress -> Bool)-        , testProperty "CodingFailureMode instance"              (prop_matchesShow :: Int -> CodingFailureMode -> Bool)-        , testProperty "Newline instance"                        (prop_matchesShow :: Int -> Newline -> Bool)-        , testProperty "NewlineMode instance"                    (prop_matchesShow :: Int -> NewlineMode -> Bool)-        ]-    , testGroup "Text.Show.Text.System.Posix.Types"-        [ -#if defined(HTYPE_DEV_T)-          testProperty "CDev instance"                           (prop_matchesShow :: Int -> CDev -> Bool)-#endif-#if defined(HTYPE_INO_T)-        , testProperty "CIno instance"                           (prop_matchesShow :: Int -> CIno -> Bool)-#endif-#if defined(HTYPE_MODE_T)-        , testProperty "CMode instance"                          (prop_matchesShow :: Int -> CMode -> Bool)-#endif-#if defined(HTYPE_OFF_T)-        , testProperty "COff instance"                           (prop_matchesShow :: Int -> COff -> Bool)-#endif-#if defined(HTYPE_PID_T)-        , testProperty "CPid instance"                           (prop_matchesShow :: Int -> CPid -> Bool)-#endif-#if defined(HTYPE_SSIZE_T)-        , testProperty "CSsize instance"                         (prop_matchesShow :: Int -> CSsize -> Bool)-#endif-#if defined(HTYPE_GID_T)-        , testProperty "CGid instance"                           (prop_matchesShow :: Int -> CGid -> Bool)-#endif-#if defined(HTYPE_NLINK_T)-        , testProperty "CNlink instance"                         (prop_matchesShow :: Int -> CNlink -> Bool)-#endif-#if defined(HTYPE_UID_T)-        , testProperty "CUid instance"                           (prop_matchesShow :: Int -> CUid -> Bool)-#endif-#if defined(HTYPE_CC_T)-        , testProperty "CCc instance"                            (prop_matchesShow :: Int -> CCc -> Bool)-#endif-#if defined(HTYPE_SPEED_T)-        , testProperty "CSpeed instance"                         (prop_matchesShow :: Int -> CSpeed -> Bool)-#endif-#if defined(HTYPE_TCFLAG_T)-        , testProperty "CTcflag instance"                        (prop_matchesShow :: Int -> CTcflag -> Bool)-#endif-#if defined(HTYPE_RLIM_T)-        , testProperty "CRLim instance"                          (prop_matchesShow :: Int -> CRLim -> Bool)-#endif-        , testProperty "Fd instance"                             (prop_matchesShow :: Int -> Fd -> Bool)-        ]-    , testGroup "Text.Show.Text.Text.Read.Lex"-        [ testProperty "Lexeme instance"                         (prop_matchesShow :: Int -> Lexeme -> Bool)-#if MIN_VERSION_base(4,7,0)-        , testProperty "Number instance"                         (prop_matchesShow :: Int -> Number -> Bool)-#endif-        ]-    ]+{-# LANGUAGE CPP              #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE TypeOperators    #-}
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
+#endif
+{-|
+Module:      Properties.BaseAndFriends
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+@QuickCheck@ properties for data types located in @base@ and other
+common libraries.
+-}
+module Properties.BaseAndFriends (baseAndFriendsTests) where
+
+import           Control.Applicative (Const, ZipList, liftA2)
+#if !(MIN_VERSION_base(4,8,0))
+import           Control.Applicative (pure)
+#endif
+import           Control.Concurrent (myThreadId)
+import           Control.Exception
+import           Control.Monad.ST
+
+#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)
+import           Data.Array (Array)
+import           Data.Array.Unboxed (UArray)
+#endif
+import           Data.Array (elems)
+import qualified Data.ByteString      as BS (ByteString)
+import qualified Data.ByteString.Lazy as BL (ByteString)
+import           Data.ByteString.Short (ShortByteString)
+import           Data.Char (GeneralCategory, intToDigit)
+import           Data.Complex (Complex)
+import qualified Data.Data as D (Fixity)
+import           Data.Data (Constr, ConstrRep, DataRep, DataType)
+import           Data.Dynamic (Dynamic)
+import           Data.Fixed (Fixed, E0, E1, E2, E3, E6, E9, E12, showFixed)
+import           Data.Functor.Identity (Identity)
+import           Data.Int (Int8, Int16, Int32, Int64)
+import           Data.Monoid (All(..), Any(..), Dual(..), First(..),
+                              Last(..), Product(..), Sum(..))
+#if MIN_VERSION_base(4,8,0)
+import           Data.Monoid (Alt(..))
+#endif
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+import qualified Data.OldTypeable as OldT (TyCon, TypeRep)
+#endif
+#if MIN_VERSION_base(4,6,0)
+import           Data.Ord (Down(..))
+#endif
+import           Data.Proxy (Proxy)
+import           Data.Ratio (Ratio)
+import qualified Data.Text as TS
+import qualified Data.Text as TL
+#if MIN_VERSION_base(4,7,0)
+import           Data.Type.Coercion (Coercion)
+import           Data.Type.Equality ((:~:))
+#endif
+import qualified Data.Typeable as NewT (TyCon, TypeRep)
+import           Data.Word (Word8, Word16, Word32, Word64)
+#if !(MIN_VERSION_base(4,8,0))
+import           Data.Word (Word)
+#endif
+import           Data.Version (Version, showVersion)
+
+-- import qualified Debug.Trace as S (traceShow)
+
+import           Foreign.C.Types
+import           Foreign.ForeignPtr (newForeignPtr_)
+import           Foreign.Ptr (FunPtr, IntPtr, Ptr, WordPtr)
+
+import           GHC.Conc (BlockReason, ThreadStatus)
+#if !(defined(__GHCJS__))
+# if defined(mingw32_HOST_OS)
+import           GHC.Conc.Windows (ConsoleEvent)
+# else
+import           GHC.Event (Event)
+# endif
+#endif
+import           GHC.Fingerprint.Type (Fingerprint)
+import qualified GHC.Generics as G (Fixity)
+import           GHC.Generics (U1, Par1, Rec1, K1, M1, (:+:), (:*:), (:.:),
+                               Associativity, Arity)
+import           GHC.IO.Encoding.Failure (CodingFailureMode)
+import           GHC.IO.Encoding.Types (CodingProgress)
+#if MIN_VERSION_base(4,8,0)
+import           GHC.RTS.Flags
+import           GHC.StaticPtr (StaticPtrInfo)
+#endif
+import           GHC.Stats (GCStats)
+import           GHC.Show (asciiTab)
+#if MIN_VERSION_base(4,7,0)
+import           GHC.TypeLits (SomeNat, SomeSymbol)
+#endif
+
+import           Instances.BaseAndFriends ()
+
+import           Numeric (showIntAtBase, showEFloat, showFFloat, showGFloat)
+#if MIN_VERSION_base(4,7,0)
+import           Numeric (showFFloatAlt, showGFloatAlt)
+#endif
+import           Numeric.Natural (Natural)
+
+import           Prelude hiding (Show)
+
+import           Properties.Utils
+
+import           System.Exit (ExitCode)
+-- import qualified System.IO as S (print)
+import           System.IO (BufferMode, IOMode, HandlePosn, Newline,
+                            NewlineMode, SeekMode, Handle, mkTextEncoding)
+-- import           System.IO.Silently (capture_, hCapture_)
+import           System.Posix.Types
+
+import           Test.QuickCheck.Instances ()
+import           Test.Tasty (TestTree, testGroup)
+import           Test.Tasty.HUnit ((@=?), testCase)
+import           Test.Tasty.QuickCheck (Gen, Property, arbitrary, generate,
+                                        oneof, suchThat, testProperty)
+
+import           Text.Read.Lex (Lexeme)
+#if MIN_VERSION_base(4,7,0)
+import           Text.Read.Lex (Number)
+#endif
+import           Text.Show (showListWith)
+import           Text.Show.Functions ()
+-- import qualified Text.Show.Text as T (print)
+import           Text.Show.Text hiding (Show, print)
+import           Text.Show.Text.Data.Char (asciiTabB)
+import           Text.Show.Text.Data.Fixed (showbFixed)
+import           Text.Show.Text.Data.Floating (showbEFloat, showbFFloat, showbGFloat)
+#if MIN_VERSION_base(4,7,0)
+import           Text.Show.Text.Data.Floating (showbFFloatAlt, showbGFloatAlt)
+#endif
+import           Text.Show.Text.Data.Integral (showbIntAtBase)
+import           Text.Show.Text.Data.List (showbListWith)
+import           Text.Show.Text.Data.Version (showbVersionConcrete)
+-- import qualified Text.Show.Text.Debug.Trace as T (traceShow)
+import           Text.Show.Text.Functions ()
+import           Text.Show.Text.Generic (ConType)
+
+#include "HsBaseConfig.h"
+
+-- -- | Verifies the 'print' functions for 'String' and 'TS.Text' @Show@ display
+-- -- the same output.
+-- prop_print :: String -> Property
+-- prop_print str = ioProperty $ do
+--     sRes <- capture_ $ S.print str *> hFlush stdout
+--     tRes <- capture_ $ T.print str *> hFlush stdout
+--     pure $ sRes == tRes
+
+-- | Verifies 'showFixed' and 'showbFixed' generate the same output.
+prop_showFixed :: Bool -> Fixed E12 -> Bool
+prop_showFixed b f = fromString (showFixed b f) == showbFixed b f
+
+-- | Verifies the 'Show' instance for 'ForeignPtr' is accurate.
+prop_showForeignPtr :: Int -> Ptr Int -> Property
+prop_showForeignPtr p ptr = ioProperty $ do
+    fptr <- newForeignPtr_ ptr
+    pure $ prop_matchesShow p fptr
+
+-- | Verifies 'showIntAtBase' and 'showbIntAtBase' generate the same output.
+#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)
+prop_showIntAtBase :: Gen Bool
+prop_showIntAtBase = do
+    base <- arbitrary `suchThat` (liftA2 (&&) (> 1) (<= 16))
+    i    <- arbitrary `suchThat` (>= 0) :: Gen Int
+    pure $ fromString (showIntAtBase base intToDigit i "") == showbIntAtBase base intToDigit i
+#endif
+
+-- | Verifies 'showListWith' and 'showbListWith' generate the same output.
+prop_showListWith :: [Char] -> Bool
+prop_showListWith str = fromString (showListWith shows str "") == showbListWith showb str
+
+-- | Verifies the 'Show' instance for 'TextEncoding' is accurate.
+prop_showTextEncoding :: Int -> Property
+prop_showTextEncoding p = ioProperty $ do
+    -- Based on this description:
+    -- http://hackage.haskell.org/package/base-4.7.0.2/docs/System-IO.html#v:mkTextEncoding
+    utf <- generate . oneof $ map pure [ "UTF-8"
+                                       , "UTF-16", "UTF-16BE", "UTF-16LE"
+                                       , "UTF-32", "UTF-32BE", "UTF-32LE"
+                                       ]
+    tenc <- mkTextEncoding utf
+    pure $ prop_matchesShow p tenc
+
+-- | Verifies the 'Show' instance for 'ThreadId' is accurate.
+prop_showThreadId :: Int -> Property
+prop_showThreadId p = ioProperty $ do
+    tid <- myThreadId
+    pure $ prop_matchesShow p tid
+
+-- | Verifies @showXFloat@ and @showbXFloat@ generate the same output (where @X@
+-- is one of E, F, or G).
+prop_showXFloat :: (Maybe Int -> Double -> ShowS) -> (Maybe Int -> Double -> Builder) -> Double -> Gen Bool
+prop_showXFloat f1 f2 val = do
+    digs <- arbitrary `suchThat` (<= 10)
+    pure $ fromString (f1 (Just digs) val "") == f2 (Just digs) val
+
+-- | Verifies 'showVersion' and 'showbVersion' generate the same output.
+prop_showVersion :: Version -> Bool
+prop_showVersion v = fromString (showVersion v) == showbVersionConcrete v
+
+#if MIN_VERSION_base(4,8,0)
+-- | Verifies that the 'Show' instance for 'RTSFlags' is accurate.
+prop_showRTSFlags :: Int -> Property
+prop_showRTSFlags p = ioProperty $ do
+    rtsflags <- getRTSFlags
+    pure $ prop_matchesShow p rtsflags
+
+-- | Verifies that the 'Show' instance for 'GCFlags' is accurate.
+prop_showGCFlags :: Int -> Property
+prop_showGCFlags p = ioProperty $ do
+    gcflags <- getGCFlags
+    pure $ prop_matchesShow p gcflags
+
+-- | Verifies that the 'Show' instance for 'CCFlags' is accurate.
+prop_showCCFlags :: Int -> Property
+prop_showCCFlags p = ioProperty $ do
+    ccflags <- getCCFlags
+    pure $ prop_matchesShow p ccflags
+
+-- | Verifies that the 'Show' instance for 'ProfFlags' is accurate.
+prop_showProfFlags :: Int -> Property
+prop_showProfFlags p = ioProperty $ do
+    profflags <- getProfFlags
+    pure $ prop_matchesShow p profflags
+
+-- | Verifies that the 'Show' instance for 'TraceFlags' is accurate.
+prop_showTraceFlags :: Int -> Property
+prop_showTraceFlags p = ioProperty $ do
+    traceflags <- getTraceFlags
+    pure $ prop_matchesShow p traceflags
+#endif
+
+-- -- | Verifies the 'traceShow' functions for 'String' and 'TS.Text' @Show@ display
+-- -- the same output.
+-- prop_traceShow :: String -> Property
+-- prop_traceShow str = ioProperty $ do
+--     let handles = [stdout, stderr]
+--     sRes <- hCapture_ handles $ S.traceShow str (pure ()) *> mapM_ hFlush handles
+--     tRes <- hCapture_ handles $ T.traceShow str (pure ()) *> mapM_ hFlush handles
+--     pure $ sRes == tRes
+
+baseAndFriendsTests :: [TestTree]
+baseAndFriendsTests =
+    [ testGroup "Text.Show.Text"
+        [ testProperty "FromStringShow Int instance"             (prop_matchesShow :: Int -> FromStringShow Int -> Bool)
+        , testProperty "FromStringShow Int: read . show = id"    (prop_readShow :: Int -> FromStringShow Int -> Bool)
+        , testProperty "FromStringShow Int = Int" $              prop_showEq (FromStringShow :: Int -> FromStringShow Int)
+        , testProperty "FromStringShow [Char] instance"          (prop_matchesShow :: Int -> FromStringShow [Char] -> Bool)
+        , testProperty "FromStringShow [Char]: read . show = id" (prop_readShow :: Int -> FromStringShow [Char] -> Bool)
+        , testProperty "FromStringShow [Char] = String" $        prop_showEq (FromStringShow :: String -> FromStringShow [Char])
+        , testProperty "FromTextShow Int instance"               (prop_matchesShow :: Int -> FromTextShow Int -> Bool)
+        , testProperty "FromTextShow Int: read . show = id"      (prop_readShow :: Int -> FromTextShow Int -> Bool)
+        , testProperty "FromTextShow Int = Int" $                prop_showEq (FromTextShow :: Int -> FromTextShow Int)
+        , testProperty "FromTextShow [Char] instance"            (prop_matchesShow :: Int -> FromTextShow [Char] -> Bool)
+        , testProperty "FromTextShow [Char]: read . show = id"   (prop_readShow :: Int -> FromTextShow [Char] -> Bool)
+        , testProperty "FromTextShow [Char] = String" $          prop_showEq (FromTextShow :: String -> FromTextShow [Char])
+        -- TODO: Figure out why these fail on NixOS
+--         , testProperty "print behavior"                          prop_print
+--         , testProperty "traceShow behavior"                      prop_traceShow
+        ]
+    , testGroup "Text.Show.Text.Control.Applicative"
+        [ testProperty "Const Int Int instance"                  (prop_matchesShow :: Int -> Const Int Int -> Bool)
+        , testProperty "ZipList Int instance"                    (prop_matchesShow :: Int -> ZipList Int -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Control.Concurrent"
+        [ testProperty "BlockReason instance"                    (prop_matchesShow :: Int -> BlockReason -> Bool)
+        , testProperty "ThreadId instance"                       prop_showThreadId
+        , testProperty "ThreadStatus instance"                   (prop_matchesShow :: Int -> ThreadStatus -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Control.Exception"
+        [ testProperty "SomeException instance"                  (prop_matchesShow :: Int -> SomeException -> Bool)
+        , testProperty "IOException instance"                    (prop_matchesShow :: Int -> IOException -> Bool)
+        , testProperty "ArithException instance"                 (prop_matchesShow :: Int -> ArithException -> Bool)
+        , testProperty "ArrayException instance"                 (prop_matchesShow :: Int -> ArrayException -> Bool)
+        , testProperty "AssertionFailed instance"                (prop_matchesShow :: Int -> AssertionFailed -> Bool)
+#if MIN_VERSION_base(4,7,0)
+        , testProperty "SomeAsyncException instance"             (prop_matchesShow :: Int -> SomeAsyncException -> Bool)
+#endif
+        , testProperty "AsyncException instance"                 (prop_matchesShow :: Int -> AsyncException -> Bool)
+        , testProperty "NonTermination instance"                 (prop_matchesShow :: Int -> NonTermination -> Bool)
+        , testProperty "NestedAtomically instance"               (prop_matchesShow :: Int -> NestedAtomically -> Bool)
+        , testProperty "BlockedIndefinitelyOnMVar instance"      (prop_matchesShow :: Int -> BlockedIndefinitelyOnMVar -> Bool)
+        , testProperty "BlockedIndefinitelyOnSTM instance"       (prop_matchesShow :: Int -> BlockedIndefinitelyOnSTM -> Bool)
+#if MIN_VERSION_base(4,8,0)
+        , testProperty "AllocationLimitExceeded instance"        (prop_matchesShow :: Int -> AllocationLimitExceeded -> Bool)
+#endif
+        , testProperty "Deadlock instance"                       (prop_matchesShow :: Int -> Deadlock -> Bool)
+        , testProperty "NoMethodError instance"                  (prop_matchesShow :: Int -> NoMethodError -> Bool)
+        , testProperty "PatternMatchFail instance"               (prop_matchesShow :: Int -> PatternMatchFail -> Bool)
+        , testProperty "RecConError instance"                    (prop_matchesShow :: Int -> RecConError -> Bool)
+        , testProperty "RecSelError instance"                    (prop_matchesShow :: Int -> RecSelError -> Bool)
+        , testProperty "RecUpdError instance"                    (prop_matchesShow :: Int -> RecUpdError -> Bool)
+        , testProperty "ErrorCall instance"                      (prop_matchesShow :: Int -> ErrorCall -> Bool)
+        , testProperty "MaskingState instance"                   (prop_matchesShow :: Int -> MaskingState -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Control.Monad.ST"
+        [ testProperty "ST instance"                             (prop_matchesShow :: Int -> ST Int Int -> Bool)
+        ]
+#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)
+-- TODO: Figure out why this test diverges on Windows
+    , testGroup "Text.Show.Text.Data.Array"
+        [ testProperty "Array Int Int instance"                  (prop_matchesShow :: Int -> Array Int Int -> Bool)
+        , testProperty "UArray Int Int instance"                 (prop_matchesShow :: Int -> UArray Int Int -> Bool)
+        ]
+#endif
+    , testGroup "Text.Show.Text.Data.Bool"
+        [ testProperty "Bool instance"                           (prop_matchesShow :: Int -> Bool -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.ByteString"
+        [ testProperty "strict ByteString instance"              (prop_matchesShow :: Int -> BS.ByteString -> Bool)
+        , testProperty "lazy ByteString instance"                (prop_matchesShow :: Int -> BL.ByteString -> Bool)
+        , testProperty "ShortByteString instance"                (prop_matchesShow :: Int -> ShortByteString -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Char"
+        [ testProperty "Char instance"                           (prop_matchesShow :: Int -> Char -> Bool)
+        , testProperty "GeneralCategory instance"                (prop_matchesShow :: Int -> GeneralCategory -> Bool)
+        , testCase "asciiTab = asciiTabB" $                      map fromString asciiTab @=? elems (asciiTabB)
+        ]
+    , testGroup "Text.Show.Text.Data.Complex"
+        [ testProperty "Complex Double instance"                 (prop_matchesShow :: Int -> Complex Double -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Data"
+        [ testProperty "Constr instance"                         (prop_matchesShow :: Int -> Constr -> Bool)
+        , testProperty "ConstrRep instance"                      (prop_matchesShow :: Int -> ConstrRep -> Bool)
+        , testProperty "DataRep instance"                        (prop_matchesShow :: Int -> DataRep -> Bool)
+        , testProperty "DataType instance"                       (prop_matchesShow :: Int -> DataType -> Bool)
+        , testProperty "Fixity instance"                         (prop_matchesShow :: Int -> D.Fixity -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Dynamic"
+        [ testProperty "Dynamic instance"                        (prop_matchesShow :: Int -> Dynamic -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Either"
+        [ testProperty "Either Int Int instance"                 (prop_matchesShow :: Int -> Either Int Int -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Fixed"
+        [ testProperty "Fixed E0 instance"                       (prop_matchesShow :: Int -> Fixed E0 -> Bool)
+        , testProperty "Fixed E1 instance"                       (prop_matchesShow :: Int -> Fixed E1 -> Bool)
+        , testProperty "Fixed E2 instance"                       (prop_matchesShow :: Int -> Fixed E2 -> Bool)
+        , testProperty "Fixed E3 instance"                       (prop_matchesShow :: Int -> Fixed E3 -> Bool)
+        , testProperty "Fixed E6 instance"                       (prop_matchesShow :: Int -> Fixed E6 -> Bool)
+        , testProperty "Fixed E9 instance"                       (prop_matchesShow :: Int -> Fixed E9 -> Bool)
+        , testProperty "Fixed E12 instance"                      (prop_matchesShow :: Int -> Fixed E12 -> Bool)
+        , testProperty "showFixed output"                        prop_showFixed
+        ]
+    , testGroup "Text.Show.Text.Data.Floating"
+        [ testProperty "Float instance"                          (prop_matchesShow :: Int -> Float -> Bool)
+        , testProperty "Double instance"                         (prop_matchesShow :: Int -> Double -> Bool)
+        , testProperty "showbEFloat output" $                    prop_showXFloat showEFloat showbEFloat
+        , testProperty "showbFFloat output" $                    prop_showXFloat showFFloat showbFFloat
+        , testProperty "showbGFloat output" $                    prop_showXFloat showGFloat showbGFloat
+#if MIN_VERSION_base(4,7,0)
+        , testProperty "showbFFloatAlt output" $                 prop_showXFloat showFFloatAlt showbFFloatAlt
+        , testProperty "showbGFloatAlt output" $                 prop_showXFloat showGFloatAlt showbGFloatAlt
+#endif
+        ]
+    , testGroup "Text.Show.Text.Data.Functions"
+        [ testProperty "Int -> Int instance"                     (prop_matchesShow :: Int -> (Int -> Int) -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Functor.Identity"
+        [ testProperty "Identity Int instance"                   (prop_matchesShow :: Int -> Identity Int -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Integral"
+        [ testProperty "Int instance"                            (prop_matchesShow :: Int -> Int -> Bool)
+        , testProperty "Int8 instance"                           (prop_matchesShow :: Int -> Int8 -> Bool)
+        , testProperty "Int16 instance"                          (prop_matchesShow :: Int -> Int16 -> Bool)
+        , testProperty "Int32 instance"                          (prop_matchesShow :: Int -> Int32 -> Bool)
+        , testProperty "Int64 instance"                          (prop_matchesShow :: Int -> Int64 -> Bool)
+        , testProperty "Integer instance"                        (prop_matchesShow :: Int -> Integer -> Bool)
+        , testProperty "Word instance"                           (prop_matchesShow :: Int -> Word -> Bool)
+        , testProperty "Word8 instance"                          (prop_matchesShow :: Int -> Word8 -> Bool)
+        , testProperty "Word16 instance"                         (prop_matchesShow :: Int -> Word16 -> Bool)
+        , testProperty "Word32 instance"                         (prop_matchesShow :: Int -> Word32 -> Bool)
+        , testProperty "Word64 instance"                         (prop_matchesShow :: Int -> Word64 -> Bool)
+#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)
+-- TODO: Figure out why this diverges on Windows
+        , testProperty "showbIntAtBase output"                   prop_showIntAtBase
+#endif
+        ]
+    , testGroup "Text.Show.Text.Data.List"
+        [ testProperty "String instance"                         (prop_matchesShow :: Int -> String -> Bool)
+        , testProperty "[String] instance"                       (prop_matchesShow :: Int -> [String] -> Bool)
+        , testProperty "[Int] instance"                          (prop_matchesShow :: Int -> [Int] -> Bool)
+        , testProperty "showbListWith output"                    prop_showListWith
+        ]
+    , testGroup "Text.Show.Text.Data.Maybe"
+        [ testProperty "Maybe Int instance"                      (prop_matchesShow :: Int -> Maybe Int -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Monoid"
+        [ testProperty "All instance"                            (prop_matchesShow :: Int -> All -> Bool)
+        , testProperty "Any instance"                            (prop_matchesShow :: Int -> Any -> Bool)
+        , testProperty "Dual Int instance"                       (prop_matchesShow :: Int -> Dual Int -> Bool)
+        , testProperty "First (Maybe Int) instance"              (prop_matchesShow :: Int -> First (Maybe Int) -> Bool)
+        , testProperty "Last (Maybe Int) instance"               (prop_matchesShow :: Int -> Last (Maybe Int) -> Bool)
+        , testProperty "Product Int instance"                    (prop_matchesShow :: Int -> Product Int -> Bool)
+        , testProperty "Sum Int instance"                        (prop_matchesShow :: Int -> Sum Int -> Bool)
+#if MIN_VERSION_base(4,8,0)
+        , testProperty "Alt Maybe Int instance"                  (prop_matchesShow :: Int -> Alt Maybe Int -> Bool)
+#endif
+        ]
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+    , testGroup "Text.Show.Text.Data.OldTypeable"
+        [ testProperty "TypeRep instance"                        (prop_matchesShow :: Int -> OldT.TypeRep -> Bool)
+        , testProperty "TyCon instance"                          (prop_matchesShow :: Int -> OldT.TyCon -> Bool)
+        ]
+#endif
+    , testGroup "Text.Show.Text.Data.Ord"
+        [ testProperty "Ordering instance"                       (prop_matchesShow :: Int -> Ordering -> Bool)
+#if MIN_VERSION_base(4,6,0)
+        , testProperty "Down Int instance"                       (prop_matchesShow :: Int -> Down Int -> Bool)
+#endif
+        ]
+    , testGroup "Text.Show.Text.Data.Proxy"
+        [ testProperty "Proxy Int instance"                      (prop_matchesShow :: Int -> Proxy Int -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Ratio"
+        [ testProperty "Ratio Int instance"                      (prop_matchesShow :: Int -> Ratio Int -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Text"
+        [ testProperty "Builder instance"                        (prop_matchesShow :: Int -> Builder -> Bool)
+        , testProperty "strict Text instance"                    (prop_matchesShow :: Int -> TS.Text -> Bool)
+        , testProperty "lazy Text instance"                      (prop_matchesShow :: Int -> TL.Text -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Tuple"
+        [ testProperty "() instance"                             (prop_matchesShow :: Int -> () -> Bool)
+        , testProperty "(Int, Int) instance"                     (prop_matchesShow :: Int -> (Int, Int) -> Bool)
+        , testProperty "(Int, Int, Int) instance"                (prop_matchesShow :: Int -> (Int, Int, Int) -> Bool)
+        , testProperty "(Int, Int, Int, Int) instance"           (prop_matchesShow :: Int -> (Int, Int, Int, Int) -> Bool)
+        , testProperty "(Int, Int, Int, Int, Int) instance"      (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int) -> Bool)
+        , testProperty "() generic show"                         (prop_genericShow :: Int -> () -> Bool)
+        , testProperty "(Int, Int) generic show"                 (prop_genericShow :: Int -> (Int, Int) -> Bool)
+        , testProperty "(Int, Int, Int) generic show"            (prop_genericShow :: Int -> (Int, Int, Int) -> Bool)
+        , testProperty "(Int, Int, Int, Int) generic show"       (prop_genericShow :: Int -> (Int, Int, Int, Int) -> Bool)
+        , testProperty "(Int, Int, Int, Int, Int) generic show"  (prop_genericShow :: Int -> (Int, Int, Int, Int, Int) -> Bool)
+        ]
+#if MIN_VERSION_base(4,7,0)
+    , testGroup "Text.Show.Text.Data.Type.Coercion"
+        [ testProperty "Coercion instance"                       (prop_matchesShow :: Int -> Coercion All Bool -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Type.Equality"
+        [ testProperty "(:~:) instance"                          (prop_matchesShow :: Int -> Int :~: Int -> Bool)
+        ]
+#endif
+    , testGroup "Text.Show.Text.Data.Typeable"
+        [ testProperty "TypeRep instance"                        (prop_matchesShow :: Int -> NewT.TypeRep -> Bool)
+        , testProperty "TyCon instance"                          (prop_matchesShow :: Int -> NewT.TyCon -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Data.Version"
+        [ testProperty "Version instance"                        (prop_matchesShow :: Int -> Version -> Bool)
+        , testProperty "showbVersionConcrete output"             prop_showVersion
+        ]
+    , testGroup "Text.Show.Text.Foreign.C.Types"
+        [ testProperty "CChar"                                   (prop_matchesShow :: Int -> CChar -> Bool)
+        , testProperty "CSChar instance"                         (prop_matchesShow :: Int -> CSChar -> Bool)
+        , testProperty "CUChar instance"                         (prop_matchesShow :: Int -> CUChar -> Bool)
+        , testProperty "CShort instance"                         (prop_matchesShow :: Int -> CShort -> Bool)
+        , testProperty "CUShort instance"                        (prop_matchesShow :: Int -> CUShort -> Bool)
+        , testProperty "CInt instance"                           (prop_matchesShow :: Int -> CInt -> Bool)
+        , testProperty "CUInt instance"                          (prop_matchesShow :: Int -> CUInt -> Bool)
+        , testProperty "CLong instance"                          (prop_matchesShow :: Int -> CLong -> Bool)
+        , testProperty "CULong instance"                         (prop_matchesShow :: Int -> CULong -> Bool)
+        , testProperty "CPtrdiff instance"                       (prop_matchesShow :: Int -> CPtrdiff -> Bool)
+        , testProperty "CSize instance"                          (prop_matchesShow :: Int -> CSize -> Bool)
+        , testProperty "CWchar instance"                         (prop_matchesShow :: Int -> CWchar -> Bool)
+        , testProperty "CSigAtomic instance"                     (prop_matchesShow :: Int -> CSigAtomic -> Bool)
+        , testProperty "CLLong instance"                         (prop_matchesShow :: Int -> CLLong -> Bool)
+        , testProperty "CULLong instance"                        (prop_matchesShow :: Int -> CULLong -> Bool)
+        , testProperty "CIntPtr instance"                        (prop_matchesShow :: Int -> CIntPtr -> Bool)
+        , testProperty "CUIntPtr instance"                       (prop_matchesShow :: Int -> CUIntPtr -> Bool)
+        , testProperty "CIntMax instance"                        (prop_matchesShow :: Int -> CIntMax -> Bool)
+        , testProperty "CUIntPtr instance"                       (prop_matchesShow :: Int -> CUIntPtr -> Bool)
+        , testProperty "CIntMax instance"                        (prop_matchesShow :: Int -> CIntMax -> Bool)
+        , testProperty "CUIntMax instance"                       (prop_matchesShow :: Int -> CUIntMax -> Bool)
+        , testProperty "CClock instance"                         (prop_matchesShow :: Int -> CClock -> Bool)
+        , testProperty "CTime instance"                          (prop_matchesShow :: Int -> CTime -> Bool)
+        , testProperty "CUSeconds instance"                      (prop_matchesShow :: Int -> CUSeconds -> Bool)
+        , testProperty "CSUSeconds instance"                     (prop_matchesShow :: Int -> CSUSeconds -> Bool)
+        , testProperty "CFloat instance"                         (prop_matchesShow :: Int -> CFloat -> Bool)
+        , testProperty "CDouble instance"                        (prop_matchesShow :: Int -> CUChar -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Foreign.Ptr"
+        [ testProperty "Ptr Int instance"                        (prop_matchesShow :: Int -> Ptr Int -> Bool)
+        , testProperty "FunPtr Int instance"                     (prop_matchesShow :: Int -> FunPtr Int -> Bool)
+        , testProperty "IntPtr instance"                         (prop_matchesShow :: Int -> IntPtr -> Bool)
+        , testProperty "WordPtr instance"                        (prop_matchesShow :: Int -> WordPtr -> Bool)
+        , testProperty "ForeignPtr instance"                     prop_showForeignPtr
+        ]
+#if !(defined(mingw32_HOST_OS) || defined(__GHCJS__))
+    , testGroup "Text.Show.Text.GHC.Event"
+        [ testProperty "Event instance"                          (prop_matchesShow :: Int -> Event -> Bool)
+--         , testProperty "FdKey instance"                          (prop_matchesShow :: Int -> FdKey -> Bool)
+        ]
+#endif
+    , testGroup "Text.Show.Text.Generic"
+        [ testProperty "ConType instance"                        (prop_matchesShow :: Int -> ConType -> Bool)
+        , testProperty "ConType generic show"                    (prop_genericShow :: Int -> ConType -> Bool)
+        ]
+#if defined(mingw32_HOST_OS) && !(defined(__GHCJS__))
+    , testGroup "Text.Show.Text.GHC.Conc.Windows"
+        [ testProperty "ConsoleEvent instance"                   (prop_matchesShow :: Int -> ConsoleEvent -> Bool)
+        ]
+#endif
+    , testGroup "Text.Show.Text.GHC.Fingerprint"
+        [ testProperty "Fingerprint instance"                    (prop_matchesShow :: Int -> Fingerprint -> Bool)
+        ]
+    , testGroup "Text.Show.Text.GHC.Generics"
+        [ testProperty "U1 Int instance"                         (prop_matchesShow :: Int -> U1 Int -> Bool)
+        , testProperty "Par1 Int instance"                       (prop_matchesShow :: Int -> Par1 Int -> Bool)
+        , testProperty "Rec1 Maybe Int instance"                 (prop_matchesShow :: Int -> Rec1 Maybe Int -> Bool)
+        , testProperty "K1 () Int () instance"                   (prop_matchesShow :: Int -> K1 () Int () -> Bool)
+        , testProperty "M1 () () Maybe Int instance"             (prop_matchesShow :: Int -> M1 () () Maybe Int -> Bool)
+        , testProperty "(Maybe :+: Maybe) Int instance"          (prop_matchesShow :: Int -> (Maybe :+: Maybe) Int -> Bool)
+        , testProperty "(Maybe :*: Maybe) Int instance"          (prop_matchesShow :: Int -> (Maybe :*: Maybe) Int -> Bool)
+        , testProperty "(Maybe :.: Maybe) Int instance"          (prop_matchesShow :: Int -> (Maybe :.: Maybe) Int -> Bool)
+        , testProperty "Fixity instance"                         (prop_matchesShow :: Int -> G.Fixity -> Bool)
+        , testProperty "Associativity instance"                  (prop_matchesShow :: Int -> Associativity -> Bool)
+        , testProperty "Arity instance"                          (prop_matchesShow :: Int -> Arity -> Bool)
+        ]
+#if MIN_VERSION_base(4,8,0)
+    , testGroup "Text.Show.Text.GHC.RTS.Flags"
+        [ testProperty "RTSFlags instance"                       prop_showRTSFlags
+        , testProperty "GCFlags instance"                        prop_showGCFlags
+        , testProperty "ConcFlags instance"                      (prop_matchesShow :: Int -> ConcFlags -> Bool)
+        , testProperty "MiscFlags instance"                      (prop_matchesShow :: Int -> MiscFlags -> Bool)
+        , testProperty "DebugFlags instance"                     (prop_matchesShow :: Int -> DebugFlags -> Bool)
+        , testProperty "CCFlags instance"                        prop_showCCFlags
+        , testProperty "ProfFlags instance"                      prop_showProfFlags
+        , testProperty "TraceFlags instance"                     prop_showTraceFlags
+        , testProperty "TickyFlags instance"                     (prop_matchesShow :: Int -> TickyFlags -> Bool)
+        ]
+    , testGroup "Text.Show.Text.GHC.StaticPtr"
+        [ testProperty "StaticPtrInfo instance"                  (prop_matchesShow :: Int -> StaticPtrInfo -> Bool)
+        ]
+#endif
+    , testGroup "Text.Show.Text.GHC.Stats"
+        [ testProperty "GCStats instance"                        (prop_matchesShow :: Int -> GCStats -> Bool)
+        ]
+#if MIN_VERSION_base(4,6,0)
+    , testGroup "Text.Show.Text.GHC.TypeLits"
+        [
+# if MIN_VERSION_base(4,7,0)
+          testProperty "SomeNat instance"                        (prop_matchesShow :: Int -> SomeNat -> Bool)
+        , testProperty "SomeSymbol instance"                     (prop_matchesShow :: Int -> SomeSymbol -> Bool)
+-- # else
+--           testProperty "IsEven instance"                         (prop_matchesShow :: Int -> IsEven -> Bool)
+--         , testProperty "IsZero instance"                         (prop_matchesShow :: Int -> IsZero -> Bool)
+# endif
+        ]
+#endif
+    , testGroup "Text.Show.Text.Numeric.Natural"
+        [ testProperty "Natural instance"                        (prop_matchesShow :: Int -> Natural -> Bool)
+        ]
+    , testGroup "Text.Show.Text.System.Exit"
+        [ testProperty "ExitCode instance"                       (prop_matchesShow :: Int -> ExitCode -> Bool)
+        ]
+    , testGroup "Text.Show.Text.System.IO"
+        [ testProperty "Handle instance"                         (prop_matchesShow :: Int -> Handle -> Bool)
+        , testProperty "IOMode instance"                         (prop_matchesShow :: Int -> IOMode -> Bool)
+        , testProperty "BufferMode instance"                     (prop_matchesShow :: Int -> BufferMode -> Bool)
+        , testProperty "HandlePosn instance"                     (prop_matchesShow :: Int -> HandlePosn -> Bool)
+        , testProperty "SeekMode instance"                       (prop_matchesShow :: Int -> SeekMode -> Bool)
+        , testProperty "TextEncoding"                            prop_showTextEncoding
+        , testProperty "CodingProgress instance"                 (prop_matchesShow :: Int -> CodingProgress -> Bool)
+        , testProperty "CodingFailureMode instance"              (prop_matchesShow :: Int -> CodingFailureMode -> Bool)
+        , testProperty "Newline instance"                        (prop_matchesShow :: Int -> Newline -> Bool)
+        , testProperty "NewlineMode instance"                    (prop_matchesShow :: Int -> NewlineMode -> Bool)
+        ]
+    , testGroup "Text.Show.Text.System.Posix.Types"
+        [ 
+#if defined(HTYPE_DEV_T)
+          testProperty "CDev instance"                           (prop_matchesShow :: Int -> CDev -> Bool)
+#endif
+#if defined(HTYPE_INO_T)
+        , testProperty "CIno instance"                           (prop_matchesShow :: Int -> CIno -> Bool)
+#endif
+#if defined(HTYPE_MODE_T)
+        , testProperty "CMode instance"                          (prop_matchesShow :: Int -> CMode -> Bool)
+#endif
+#if defined(HTYPE_OFF_T)
+        , testProperty "COff instance"                           (prop_matchesShow :: Int -> COff -> Bool)
+#endif
+#if defined(HTYPE_PID_T)
+        , testProperty "CPid instance"                           (prop_matchesShow :: Int -> CPid -> Bool)
+#endif
+#if defined(HTYPE_SSIZE_T)
+        , testProperty "CSsize instance"                         (prop_matchesShow :: Int -> CSsize -> Bool)
+#endif
+#if defined(HTYPE_GID_T)
+        , testProperty "CGid instance"                           (prop_matchesShow :: Int -> CGid -> Bool)
+#endif
+#if defined(HTYPE_NLINK_T)
+        , testProperty "CNlink instance"                         (prop_matchesShow :: Int -> CNlink -> Bool)
+#endif
+#if defined(HTYPE_UID_T)
+        , testProperty "CUid instance"                           (prop_matchesShow :: Int -> CUid -> Bool)
+#endif
+#if defined(HTYPE_CC_T)
+        , testProperty "CCc instance"                            (prop_matchesShow :: Int -> CCc -> Bool)
+#endif
+#if defined(HTYPE_SPEED_T)
+        , testProperty "CSpeed instance"                         (prop_matchesShow :: Int -> CSpeed -> Bool)
+#endif
+#if defined(HTYPE_TCFLAG_T)
+        , testProperty "CTcflag instance"                        (prop_matchesShow :: Int -> CTcflag -> Bool)
+#endif
+#if defined(HTYPE_RLIM_T)
+        , testProperty "CRLim instance"                          (prop_matchesShow :: Int -> CRLim -> Bool)
+#endif
+        , testProperty "Fd instance"                             (prop_matchesShow :: Int -> Fd -> Bool)
+        ]
+    , testGroup "Text.Show.Text.Text.Read.Lex"
+        [ testProperty "Lexeme instance"                         (prop_matchesShow :: Int -> Lexeme -> Bool)
+#if MIN_VERSION_base(4,7,0)
+        , testProperty "Number instance"                         (prop_matchesShow :: Int -> Number -> Bool)
+#endif
+        ]
+    ]
tests/Properties/Builder.hs view
@@ -1,50 +1,50 @@-{-|-Module:      Properties.Builder-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@QuickCheck@ properties for functions that manipulate 'Builder's.--}-module Properties.Builder (builderTests) where--import Instances.BaseAndFriends ()--import Test.Tasty (TestTree, testGroup)-import Test.Tasty.QuickCheck (testProperty)--import Text.Show.Text (Builder, fromString, fromText, lengthB,-                       toString, toText, unlinesB, unwordsB)---- | Verifies 'lengthB' and 'length' produce the same output.-prop_lengthB :: String -> Bool-prop_lengthB s = fromIntegral (lengthB $ fromString s) == length s---- | Verifies @fromText . toText = id@.-prop_toText :: Builder -> Bool-prop_toText b = fromText (toText b) == b---- | Verifies @fromString . toString = id@.-prop_toString :: Builder -> Bool-prop_toString b = fromString (toString b) == b---- | Verifies 'unlinesB' and 'unlines' produce the same output.-prop_unlinesB :: [String] -> Bool-prop_unlinesB strs = unlinesB (map fromString strs) == fromString (unlines strs)---- | Verifies 'unwordsB' and 'unwords' produce the same output.-prop_unwordsB :: [String] -> Bool-prop_unwordsB strs = unwordsB (map fromString strs) == fromString (unwords strs)--builderTests :: [TestTree]-builderTests =-    [ testGroup "Builder-related functions"-        [ testProperty "lengthB output"             prop_lengthB-        , testProperty "fromString . toString = id" prop_toString-        , testProperty "fromText . toText = id"     prop_toText-        , testProperty "unlinesB output"            prop_unlinesB-        , testProperty "unwordsB output"            prop_unwordsB-        ]+{-|
+Module:      Properties.Builder
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+@QuickCheck@ properties for functions that manipulate 'Builder's.
+-}
+module Properties.Builder (builderTests) where
+
+import Instances.BaseAndFriends ()
+
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.QuickCheck (testProperty)
+
+import Text.Show.Text (Builder, fromString, fromText, lengthB,
+                       toString, toText, unlinesB, unwordsB)
+
+-- | Verifies 'lengthB' and 'length' produce the same output.
+prop_lengthB :: String -> Bool
+prop_lengthB s = fromIntegral (lengthB $ fromString s) == length s
+
+-- | Verifies @fromText . toText = id@.
+prop_toText :: Builder -> Bool
+prop_toText b = fromText (toText b) == b
+
+-- | Verifies @fromString . toString = id@.
+prop_toString :: Builder -> Bool
+prop_toString b = fromString (toString b) == b
+
+-- | Verifies 'unlinesB' and 'unlines' produce the same output.
+prop_unlinesB :: [String] -> Bool
+prop_unlinesB strs = unlinesB (map fromString strs) == fromString (unlines strs)
+
+-- | Verifies 'unwordsB' and 'unwords' produce the same output.
+prop_unwordsB :: [String] -> Bool
+prop_unwordsB strs = unwordsB (map fromString strs) == fromString (unwords strs)
+
+builderTests :: [TestTree]
+builderTests =
+    [ testGroup "Builder-related functions"
+        [ testProperty "lengthB output"             prop_lengthB
+        , testProperty "fromString . toString = id" prop_toString
+        , testProperty "fromText . toText = id"     prop_toText
+        , testProperty "unlinesB output"            prop_unlinesB
+        , testProperty "unwordsB output"            prop_unwordsB
+        ]
     ]
tests/Properties/Derived.hs view
@@ -1,112 +1,112 @@-{-# LANGUAGE CPP           #-}-{-# LANGUAGE MagicHash     #-}-{-# LANGUAGE TypeOperators #-}-{-|-Module:      Properties.BaseAndFriends-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@QuickCheck@ properties for data types that have derived 'Show' instances-(using "Text.Show.Text.TH").--}-module Properties.Derived (derivedTests) where--import Derived--import Instances.Derived ()--import Properties.Utils (prop_matchesShow, prop_genericShow)--import Test.Tasty (TestTree, testGroup)-import Test.Tasty.QuickCheck (testProperty)--derivedTests :: [TestTree]-derivedTests =-    [ testGroup "Template Haskell-derived data types"-        [ testProperty "Nullary instance"                                (prop_matchesShow :: Int -> Nullary -> Bool)-        , testProperty "PhantomNullary Int instance"                     (prop_matchesShow :: Int -> PhantomNullary Int -> Bool)-        , testProperty "MonomorphicUnary instance"                       (prop_matchesShow :: Int -> MonomorphicUnary -> Bool)-        , testProperty "PolymorphicUnary Int Int instance"               (prop_matchesShow :: Int -> PolymorphicUnary Int Int -> Bool)-        , testProperty "MonomorphicProduct instance"                     (prop_matchesShow :: Int -> MonomorphicProduct -> Bool)-        , testProperty "PolymorphicProduct Int Int Int Int instance"     (prop_matchesShow :: Int -> PolymorphicProduct Int Int Int Int -> Bool)-        , testProperty "MonomorphicRecord instance"                      (prop_matchesShow :: Int -> MonomorphicRecord -> Bool)-        , testProperty "PolymorphicRecord Int Int Int Int instance"      (prop_matchesShow :: Int -> PolymorphicRecord Int Int Int Int -> Bool)-        , testProperty "MonomorphicInfix instance"                       (prop_matchesShow :: Int -> MonomorphicInfix -> Bool)-        , testProperty "PolymorphicInfix Int Int Int instance"           (prop_matchesShow :: Int -> PolymorphicInfix Int Int Int -> Bool)-        , testProperty "MonomorphicForall instance"                      (prop_matchesShow :: Int -> MonomorphicForall -> Bool)-        , testProperty "PolymorphicForall Int Int instance"              (prop_matchesShow :: Int -> PolymorphicForall Int Int -> Bool)-        , testProperty "AllAtOnce Int Int Int Int instance"              (prop_matchesShow :: Int -> AllAtOnce Int Int Int Int -> Bool)-        , testProperty "GADT Char Int Int instance"                      (prop_matchesShow :: Int -> GADT Char Int Int -> Bool)-        , testProperty "GADT Double Double Int instance"                 (prop_matchesShow :: Int -> GADT Double Double Int -> Bool)-        , testProperty "GADT Int String Int instance"                    (prop_matchesShow :: Int -> GADT Int String Int -> Bool)-        , testProperty "GADT Ordering Int Int instance"                  (prop_matchesShow :: Int -> GADT Ordering Int Int -> Bool)-        , testProperty "GADT Int Int Int instance"                       (prop_matchesShow :: Int -> GADT Int Int Int -> Bool)-        , testProperty "PrimADT# Int instance"                           (prop_matchesShow :: Int -> PrimADT# Int -> Bool)-        , testProperty "LeftAssocTree Int instance"                      (prop_matchesShow :: Int -> LeftAssocTree Int -> Bool)-        , testProperty "RightAssocTree Int instance"                     (prop_matchesShow :: Int -> RightAssocTree Int -> Bool)-        , testProperty "Int :?: Int instance"                            (prop_matchesShow :: Int -> Int :?: Int -> Bool)-        , testProperty "HigherKindedTypeParams Maybe Int instance"       (prop_matchesShow :: Int -> HigherKindedTypeParams Maybe Int -> Bool)-        , testProperty "RestrictedContext Int instance"                  (prop_matchesShow :: Int -> RestrictedContext Int -> Bool)-        , testProperty "Fix Maybe instance"                              (prop_matchesShow :: Int -> Fix Maybe -> Bool)-#if MIN_VERSION_template_haskell(2,7,0)                                  -        , testProperty "AllShow () () Int Int instance"                  (prop_matchesShow :: Int -> AllShow () () Int Int -> Bool)-        , testProperty "AllShow Int Int Int Int instance"                (prop_matchesShow :: Int -> AllShow Int Int Int Int -> Bool)-        , testProperty "AllShow Bool Bool Int Int instance"              (prop_matchesShow :: Int -> AllShow Bool Bool Int Int -> Bool)-        , testProperty "AllShow Char Double Int Int instance"            (prop_matchesShow :: Int -> AllShow Char Double Int Int -> Bool)-        , testProperty "AllShow Float Ordering Int Int instance"         (prop_matchesShow :: Int -> AllShow Float Ordering Int Int -> Bool)-        , testProperty "NotAllShow Int Int Int Int instance"             (prop_matchesShow :: Int -> NotAllShow Int Int Int Int -> Bool)-        , testProperty "OneDataInstance Int Int Int Int instance"        (prop_matchesShow :: Int -> OneDataInstance Int Int Int Int -> Bool)-        , testProperty "AssocData1 () instance"                          (prop_matchesShow :: Int -> AssocData1 () -> Bool)-        , testProperty "AssocData2 () instance"                          (prop_matchesShow :: Int -> AssocData2 () Int Int -> Bool)-# if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710-        , testProperty "NullaryData instance"                            (prop_matchesShow :: Int -> NullaryData -> Bool)-# endif-        , testProperty "GADTFam Char Int Int instance"                   (prop_matchesShow :: Int -> GADTFam Char Int Int -> Bool)-        , testProperty "GADTFam Double Double Int instance"              (prop_matchesShow :: Int -> GADTFam Double Double Int -> Bool)-        , testProperty "GADTFam Int String Int instance"                 (prop_matchesShow :: Int -> GADTFam Int String Int -> Bool)-        , testProperty "GADTFam Ordering Int Int instance"               (prop_matchesShow :: Int -> GADTFam Ordering Int Int -> Bool)-        , testProperty "GADTFam Int Int Int instance"                    (prop_matchesShow :: Int -> GADTFam Int Int Int -> Bool)-#endif-        , testProperty "Nullary generic show"                            (prop_genericShow :: Int -> Nullary -> Bool)-        , testProperty "PhantomNullary Int generic show"                 (prop_genericShow :: Int -> PhantomNullary Int -> Bool)-        , testProperty "MonomorphicUnary generic show"                   (prop_genericShow :: Int -> MonomorphicUnary -> Bool)-        , testProperty "PolymorphicUnary Int Int generic show"           (prop_genericShow :: Int -> PolymorphicUnary Int Int -> Bool)-        , testProperty "MonomorphicProduct generic show"                 (prop_genericShow :: Int -> MonomorphicProduct -> Bool)-        , testProperty "PolymorphicProduct Int Int Int Int generic show" (prop_genericShow :: Int -> PolymorphicProduct Int Int Int Int -> Bool)-        , testProperty "MonomorphicRecord generic show"                  (prop_genericShow :: Int -> MonomorphicRecord -> Bool)-        , testProperty "PolymorphicRecord Int Int Int Int generic show"  (prop_genericShow :: Int -> PolymorphicRecord Int Int Int Int -> Bool)-        , testProperty "MonomorphicInfix generic show"                   (prop_genericShow :: Int -> MonomorphicInfix -> Bool)-        , testProperty "PolymorphicInfix Int Int Int generic show"       (prop_genericShow :: Int -> PolymorphicInfix Int Int Int -> Bool)---         , testProperty "MonomorphicForall generic show"                  (prop_genericShow :: Int -> MonomorphicForall -> Bool)---         , testProperty "PolymorphicForall Int Int generic show"          (prop_genericShow :: Int -> PolymorphicForall Int Int -> Bool)---         , testProperty "AllAtOnce Int Int Int Int generic show"          (prop_genericShow :: Int -> AllAtOnce Int Int Int Int -> Bool)---         , testProperty "GADT Char Int Int generic show"                  (prop_genericShow :: Int -> GADT Char Int Int -> Bool)---         , testProperty "GADT Double Double Int generic show"             (prop_genericShow :: Int -> GADT Double Double Int -> Bool)---         , testProperty "GADT Int String Int generic show"                (prop_genericShow :: Int -> GADT Int String Int -> Bool)---         , testProperty "GADT Ordering Int Int generic show"              (prop_genericShow :: Int -> GADT Ordering Int Int -> Bool)---         , testProperty "GADT Int Int Int generic show"                   (prop_genericShow :: Int -> GADT Int Int Int -> Bool)-        , testProperty "LeftAssocTree Int generic show"                  (prop_genericShow :: Int -> LeftAssocTree Int -> Bool)-        , testProperty "RightAssocTree Int generic show"                 (prop_genericShow :: Int -> RightAssocTree Int -> Bool)-        , testProperty "Int :?: Int generic show"                        (prop_genericShow :: Int -> Int :?: Int -> Bool)-        , testProperty "HigherKindedTypeParams Maybe Int generic show"   (prop_genericShow :: Int -> HigherKindedTypeParams Maybe Int -> Bool)-        , testProperty "RestrictedContext Int generic show"              (prop_genericShow :: Int -> RestrictedContext Int -> Bool)-        , testProperty "Fix Maybe generic show"                          (prop_genericShow :: Int -> Fix Maybe -> Bool)-#if MIN_VERSION_template_haskell(2,7,0) && __GLASGOW_HASKELL__ >= 706-        , testProperty "AllShow () () Int Int generic show"              (prop_matchesShow :: Int -> AllShow () () Int Int -> Bool)-        , testProperty "AllShow Int Int Int Int generic show"            (prop_matchesShow :: Int -> AllShow Int Int Int Int -> Bool)-        , testProperty "AllShow Bool Bool Int Int generic show"          (prop_matchesShow :: Int -> AllShow Bool Bool Int Int -> Bool)-        , testProperty "AllShow Char Double Int Int generic show"        (prop_matchesShow :: Int -> AllShow Char Double Int Int -> Bool)-        , testProperty "AllShow Float Ordering Int Int generic show"     (prop_matchesShow :: Int -> AllShow Float Ordering Int Int -> Bool)-        , testProperty "NotAllShow Int Int Int Int generic show"         (prop_genericShow :: Int -> NotAllShow Int Int Int Int -> Bool)-        , testProperty "OneDataInstance Int Int Int Int generic show"    (prop_genericShow :: Int -> OneDataInstance Int Int Int Int -> Bool)-        , testProperty "AssocData1 () generic show"                      (prop_genericShow :: Int -> AssocData1 () -> Bool)-        , testProperty "AssocData2 () generic show"                      (prop_genericShow :: Int -> AssocData2 () Int Int -> Bool)-# if __GLASGOW_HASKELL__ >= 708-        , testProperty "NullaryData generic show"                        (prop_genericShow :: Int -> NullaryData -> Bool)-# endif-#endif-        ]-    ]+{-# LANGUAGE CPP           #-}
+{-# LANGUAGE MagicHash     #-}
+{-# LANGUAGE TypeOperators #-}
+{-|
+Module:      Properties.BaseAndFriends
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+@QuickCheck@ properties for data types that have derived 'Show' instances
+(using "Text.Show.Text.TH").
+-}
+module Properties.Derived (derivedTests) where
+
+import Derived
+
+import Instances.Derived ()
+
+import Properties.Utils (prop_matchesShow, prop_genericShow)
+
+import Test.Tasty (TestTree, testGroup)
+import Test.Tasty.QuickCheck (testProperty)
+
+derivedTests :: [TestTree]
+derivedTests =
+    [ testGroup "Template Haskell-derived data types"
+        [ testProperty "Nullary instance"                                (prop_matchesShow :: Int -> Nullary -> Bool)
+        , testProperty "PhantomNullary Int instance"                     (prop_matchesShow :: Int -> PhantomNullary Int -> Bool)
+        , testProperty "MonomorphicUnary instance"                       (prop_matchesShow :: Int -> MonomorphicUnary -> Bool)
+        , testProperty "PolymorphicUnary Int Int instance"               (prop_matchesShow :: Int -> PolymorphicUnary Int Int -> Bool)
+        , testProperty "MonomorphicProduct instance"                     (prop_matchesShow :: Int -> MonomorphicProduct -> Bool)
+        , testProperty "PolymorphicProduct Int Int Int Int instance"     (prop_matchesShow :: Int -> PolymorphicProduct Int Int Int Int -> Bool)
+        , testProperty "MonomorphicRecord instance"                      (prop_matchesShow :: Int -> MonomorphicRecord -> Bool)
+        , testProperty "PolymorphicRecord Int Int Int Int instance"      (prop_matchesShow :: Int -> PolymorphicRecord Int Int Int Int -> Bool)
+        , testProperty "MonomorphicInfix instance"                       (prop_matchesShow :: Int -> MonomorphicInfix -> Bool)
+        , testProperty "PolymorphicInfix Int Int Int instance"           (prop_matchesShow :: Int -> PolymorphicInfix Int Int Int -> Bool)
+        , testProperty "MonomorphicForall instance"                      (prop_matchesShow :: Int -> MonomorphicForall -> Bool)
+        , testProperty "PolymorphicForall Int Int instance"              (prop_matchesShow :: Int -> PolymorphicForall Int Int -> Bool)
+        , testProperty "AllAtOnce Int Int Int Int instance"              (prop_matchesShow :: Int -> AllAtOnce Int Int Int Int -> Bool)
+        , testProperty "GADT Char Int Int instance"                      (prop_matchesShow :: Int -> GADT Char Int Int -> Bool)
+        , testProperty "GADT Double Double Int instance"                 (prop_matchesShow :: Int -> GADT Double Double Int -> Bool)
+        , testProperty "GADT Int String Int instance"                    (prop_matchesShow :: Int -> GADT Int String Int -> Bool)
+        , testProperty "GADT Ordering Int Int instance"                  (prop_matchesShow :: Int -> GADT Ordering Int Int -> Bool)
+        , testProperty "GADT Int Int Int instance"                       (prop_matchesShow :: Int -> GADT Int Int Int -> Bool)
+        , testProperty "PrimADT# Int instance"                           (prop_matchesShow :: Int -> PrimADT# Int -> Bool)
+        , testProperty "LeftAssocTree Int instance"                      (prop_matchesShow :: Int -> LeftAssocTree Int -> Bool)
+        , testProperty "RightAssocTree Int instance"                     (prop_matchesShow :: Int -> RightAssocTree Int -> Bool)
+        , testProperty "Int :?: Int instance"                            (prop_matchesShow :: Int -> Int :?: Int -> Bool)
+        , testProperty "HigherKindedTypeParams Maybe Int instance"       (prop_matchesShow :: Int -> HigherKindedTypeParams Maybe Int -> Bool)
+        , testProperty "RestrictedContext Int instance"                  (prop_matchesShow :: Int -> RestrictedContext Int -> Bool)
+        , testProperty "Fix Maybe instance"                              (prop_matchesShow :: Int -> Fix Maybe -> Bool)
+#if MIN_VERSION_template_haskell(2,7,0)                                  
+        , testProperty "AllShow () () Int Int instance"                  (prop_matchesShow :: Int -> AllShow () () Int Int -> Bool)
+        , testProperty "AllShow Int Int Int Int instance"                (prop_matchesShow :: Int -> AllShow Int Int Int Int -> Bool)
+        , testProperty "AllShow Bool Bool Int Int instance"              (prop_matchesShow :: Int -> AllShow Bool Bool Int Int -> Bool)
+        , testProperty "AllShow Char Double Int Int instance"            (prop_matchesShow :: Int -> AllShow Char Double Int Int -> Bool)
+        , testProperty "AllShow Float Ordering Int Int instance"         (prop_matchesShow :: Int -> AllShow Float Ordering Int Int -> Bool)
+        , testProperty "NotAllShow Int Int Int Int instance"             (prop_matchesShow :: Int -> NotAllShow Int Int Int Int -> Bool)
+        , testProperty "OneDataInstance Int Int Int Int instance"        (prop_matchesShow :: Int -> OneDataInstance Int Int Int Int -> Bool)
+        , testProperty "AssocData1 () instance"                          (prop_matchesShow :: Int -> AssocData1 () -> Bool)
+        , testProperty "AssocData2 () instance"                          (prop_matchesShow :: Int -> AssocData2 () Int Int -> Bool)
+# if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+        , testProperty "NullaryData instance"                            (prop_matchesShow :: Int -> NullaryData -> Bool)
+# endif
+        , testProperty "GADTFam Char Int Int instance"                   (prop_matchesShow :: Int -> GADTFam Char Int Int -> Bool)
+        , testProperty "GADTFam Double Double Int instance"              (prop_matchesShow :: Int -> GADTFam Double Double Int -> Bool)
+        , testProperty "GADTFam Int String Int instance"                 (prop_matchesShow :: Int -> GADTFam Int String Int -> Bool)
+        , testProperty "GADTFam Ordering Int Int instance"               (prop_matchesShow :: Int -> GADTFam Ordering Int Int -> Bool)
+        , testProperty "GADTFam Int Int Int instance"                    (prop_matchesShow :: Int -> GADTFam Int Int Int -> Bool)
+#endif
+        , testProperty "Nullary generic show"                            (prop_genericShow :: Int -> Nullary -> Bool)
+        , testProperty "PhantomNullary Int generic show"                 (prop_genericShow :: Int -> PhantomNullary Int -> Bool)
+        , testProperty "MonomorphicUnary generic show"                   (prop_genericShow :: Int -> MonomorphicUnary -> Bool)
+        , testProperty "PolymorphicUnary Int Int generic show"           (prop_genericShow :: Int -> PolymorphicUnary Int Int -> Bool)
+        , testProperty "MonomorphicProduct generic show"                 (prop_genericShow :: Int -> MonomorphicProduct -> Bool)
+        , testProperty "PolymorphicProduct Int Int Int Int generic show" (prop_genericShow :: Int -> PolymorphicProduct Int Int Int Int -> Bool)
+        , testProperty "MonomorphicRecord generic show"                  (prop_genericShow :: Int -> MonomorphicRecord -> Bool)
+        , testProperty "PolymorphicRecord Int Int Int Int generic show"  (prop_genericShow :: Int -> PolymorphicRecord Int Int Int Int -> Bool)
+        , testProperty "MonomorphicInfix generic show"                   (prop_genericShow :: Int -> MonomorphicInfix -> Bool)
+        , testProperty "PolymorphicInfix Int Int Int generic show"       (prop_genericShow :: Int -> PolymorphicInfix Int Int Int -> Bool)
+--         , testProperty "MonomorphicForall generic show"                  (prop_genericShow :: Int -> MonomorphicForall -> Bool)
+--         , testProperty "PolymorphicForall Int Int generic show"          (prop_genericShow :: Int -> PolymorphicForall Int Int -> Bool)
+--         , testProperty "AllAtOnce Int Int Int Int generic show"          (prop_genericShow :: Int -> AllAtOnce Int Int Int Int -> Bool)
+--         , testProperty "GADT Char Int Int generic show"                  (prop_genericShow :: Int -> GADT Char Int Int -> Bool)
+--         , testProperty "GADT Double Double Int generic show"             (prop_genericShow :: Int -> GADT Double Double Int -> Bool)
+--         , testProperty "GADT Int String Int generic show"                (prop_genericShow :: Int -> GADT Int String Int -> Bool)
+--         , testProperty "GADT Ordering Int Int generic show"              (prop_genericShow :: Int -> GADT Ordering Int Int -> Bool)
+--         , testProperty "GADT Int Int Int generic show"                   (prop_genericShow :: Int -> GADT Int Int Int -> Bool)
+        , testProperty "LeftAssocTree Int generic show"                  (prop_genericShow :: Int -> LeftAssocTree Int -> Bool)
+        , testProperty "RightAssocTree Int generic show"                 (prop_genericShow :: Int -> RightAssocTree Int -> Bool)
+        , testProperty "Int :?: Int generic show"                        (prop_genericShow :: Int -> Int :?: Int -> Bool)
+        , testProperty "HigherKindedTypeParams Maybe Int generic show"   (prop_genericShow :: Int -> HigherKindedTypeParams Maybe Int -> Bool)
+        , testProperty "RestrictedContext Int generic show"              (prop_genericShow :: Int -> RestrictedContext Int -> Bool)
+        , testProperty "Fix Maybe generic show"                          (prop_genericShow :: Int -> Fix Maybe -> Bool)
+#if MIN_VERSION_template_haskell(2,7,0) && __GLASGOW_HASKELL__ >= 706
+        , testProperty "AllShow () () Int Int generic show"              (prop_matchesShow :: Int -> AllShow () () Int Int -> Bool)
+        , testProperty "AllShow Int Int Int Int generic show"            (prop_matchesShow :: Int -> AllShow Int Int Int Int -> Bool)
+        , testProperty "AllShow Bool Bool Int Int generic show"          (prop_matchesShow :: Int -> AllShow Bool Bool Int Int -> Bool)
+        , testProperty "AllShow Char Double Int Int generic show"        (prop_matchesShow :: Int -> AllShow Char Double Int Int -> Bool)
+        , testProperty "AllShow Float Ordering Int Int generic show"     (prop_matchesShow :: Int -> AllShow Float Ordering Int Int -> Bool)
+        , testProperty "NotAllShow Int Int Int Int generic show"         (prop_genericShow :: Int -> NotAllShow Int Int Int Int -> Bool)
+        , testProperty "OneDataInstance Int Int Int Int generic show"    (prop_genericShow :: Int -> OneDataInstance Int Int Int Int -> Bool)
+        , testProperty "AssocData1 () generic show"                      (prop_genericShow :: Int -> AssocData1 () -> Bool)
+        , testProperty "AssocData2 () generic show"                      (prop_genericShow :: Int -> AssocData2 () Int Int -> Bool)
+# if __GLASGOW_HASKELL__ >= 708
+        , testProperty "NullaryData generic show"                        (prop_genericShow :: Int -> NullaryData -> Bool)
+# endif
+#endif
+        ]
+    ]
tests/Properties/MkShow.hs view
@@ -1,133 +1,133 @@-{-# LANGUAGE CPP             #-}-{-# LANGUAGE TemplateHaskell #-}-#if __GLASGOW_HASKELL__ < 706--- Template Haskell's name generation didn't name-mangle very well prior to GHC--- 7.6 and can cause name shadowing warnings, so suppress them.-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}-#endif-{-|-Module:      Properties.MkShow-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@QuickCheck@ properties for 'mkShowbPrec' in "Text.Show.Text.TH".--}-module Properties.MkShow (mkShowTests) where--#if !(MIN_VERSION_base(4,8,0))-import           Control.Applicative ((*>), pure)-#endif--import           Debug.Trace (traceShow)--import           Derived (AllAtOnce)-#if MIN_VERSION_template_haskell(2,7,0)-import           Derived (NotAllShow(..), OneDataInstance)-#endif--import           Instances.Derived ()--import           Properties.Utils (ioProperty)--import           System.IO (hFlush, stdout, stderr)-import           System.IO.Silently (capture_, hCapture_)--import           Test.Tasty (TestTree, testGroup)-import           Test.Tasty.QuickCheck (Property, testProperty)--import qualified Text.Show as S (Show)-import           Text.Show.Text (Builder, FromStringShow(..), showbPrec)-import           Text.Show.Text.Debug.Trace.TH (mkTraceShow)-import           Text.Show.Text.TH (mkPrint, mkShowbPrec)---- | Verifies 'mkShowbPrec' produces the same output as 'showsPrec'.-prop_mkShowbPrec :: S.Show a-                 => (Int -> a -> Builder) -- ^ TH-generated 'mkShowbPrec' function-                 -> Int -> a -> Bool-prop_mkShowbPrec sf p x = showbPrec p (FromStringShow x) == sf p x---- | Verifies 'mkPrint' produces the same output as 'print'.-prop_mkPrint :: S.Show a-             => (a -> IO ()) -- ^ TH-generated 'mkPrint' function-             -> a -> Property-prop_mkPrint pf x = ioProperty $ do-    sRes <- capture_ $ print x *> hFlush stdout-    tRes <- capture_ $ pf    x *> hFlush stdout-    pure $ sRes == tRes---- | Verifies 'mkTraceShow' produces the same output as 'traceShow'.-prop_mkTraceShow :: S.Show a-                 => (a -> IO () -> IO ()) -- ^ TH-generated 'mkTraceShow' function-                 -> a -> Property-prop_mkTraceShow tsf x = ioProperty $ do-    let handles = [stdout, stderr]-    sRes <- hCapture_ handles $ traceShow x (pure ()) *> mapM_ hFlush handles-    tRes <- hCapture_ handles $ tsf       x (pure ()) *> mapM_ hFlush handles-    pure $ sRes == tRes---- | Verifies 'mkShowbPrec' produces the same output as 'showsPrec' .--- This uses a plain type constructor.-prop_mkShowbPrecTyCon :: Int -> AllAtOnce Int Int Int Int -> Bool-prop_mkShowbPrecTyCon = prop_mkShowbPrec $(mkShowbPrec ''AllAtOnce)---- | Verifies 'mkPrint' produces the same output as 'print'.--- This uses a plain type constructor.-prop_mkPrintTyCon :: AllAtOnce Int Int Int Int -> Property-prop_mkPrintTyCon = prop_mkPrint $(mkPrint ''AllAtOnce)---- | Verifies 'mkTraceShow' produces the same output as 'traceShow'.--- This uses a plain type constructor.-prop_mkTraceShowTyCon :: AllAtOnce Int Int Int Int -> Property-prop_mkTraceShowTyCon = prop_mkTraceShow $(mkTraceShow ''AllAtOnce)--#if MIN_VERSION_template_haskell(2,7,0)--- | Verifies 'mkShowbPrec' produces the same output as 'showsPrec'.--- This uses a data family name.-prop_mkShowbPrecDataFam :: Int -> OneDataInstance Int Int Int Int -> Bool-prop_mkShowbPrecDataFam = prop_mkShowbPrec $(mkShowbPrec ''OneDataInstance)---- | Verifies 'mkPrint' produces the same output as 'print'.--- This uses a data family name.-prop_mkPrintDataFam :: OneDataInstance Int Int Int Int -> Property-prop_mkPrintDataFam = prop_mkPrint $(mkPrint ''OneDataInstance)---- | Verifies 'mkTraceShow' produces the same output as 'traceShow'.--- This uses a data family name.-prop_mkTraceShowDataFam :: OneDataInstance Int Int Int Int -> Property-prop_mkTraceShowDataFam = prop_mkTraceShow $(mkTraceShow ''OneDataInstance)---- | Verifies 'mkShowbPrec' produces the same output as 'showsPrec'.--- This uses a data family instance constructor.-prop_mkShowbPrecDataFamInstCon :: Int -> NotAllShow Int Int Int Int -> Bool-prop_mkShowbPrecDataFamInstCon = prop_mkShowbPrec $(mkShowbPrec 'NASShow1)---- | Verifies 'mkPrint' produces the same output as 'print'.--- This uses a data family instance constructor.-prop_mkPrintDataFamInstCon :: NotAllShow Int Int Int Int -> Property-prop_mkPrintDataFamInstCon = prop_mkPrint $(mkPrint 'NASShow1)---- | Verifies 'mkTraceShow' produces the same output as 'traceShow'.--- This uses a data family instance constructor.-prop_mkTraceShowDataFamInstCon :: NotAllShow Int Int Int Int -> Property-prop_mkTraceShowDataFamInstCon = prop_mkTraceShow $(mkTraceShow 'NASShow1)-#endif--mkShowTests :: [TestTree]-mkShowTests =-    [ testGroup "mkShow and related functions"-        [ testProperty "$(mkShowbPrec ''AllAtOnce) (a plain type constructor)"            prop_mkShowbPrecTyCon-        , testProperty "$(mkPrint ''AllAtOnce) (a plain type constructor)"                prop_mkPrintTyCon-        , testProperty "$(mkTraceShow ''AllAtOnce) (a plain type constructor)"            prop_mkTraceShowTyCon-#if MIN_VERSION_template_haskell(2,7,0)-        , testProperty "$(mkShowbPrec ''NotAllShow) (a data family instance constructor)" prop_mkShowbPrecDataFamInstCon-        , testProperty "$(mkPrint ''NotAllShow) (a data family instance constructor)"     prop_mkPrintDataFamInstCon-        , testProperty "$(mkTraceShow ''NotAllShow) (a data family instance constructor)" prop_mkTraceShowDataFamInstCon-        , testProperty "$(mkShowbPrec ''OneDataInstance) (a data family name)"            prop_mkShowbPrecDataFam-        , testProperty "$(mkPrint ''OneDataInstance) (a data family name)"                prop_mkPrintDataFam-        , testProperty "$(mkTraceShow ''OneDataInstance) (a data family name)"            prop_mkTraceShowDataFam-#endif-        ]-    ]+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE TemplateHaskell #-}
+#if __GLASGOW_HASKELL__ < 706
+-- Template Haskell's name generation didn't name-mangle very well prior to GHC
+-- 7.6 and can cause name shadowing warnings, so suppress them.
+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+#endif
+{-|
+Module:      Properties.MkShow
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+@QuickCheck@ properties for 'mkShowbPrec' in "Text.Show.Text.TH".
+-}
+module Properties.MkShow (mkShowTests) where
+
+-- #if !(MIN_VERSION_base(4,8,0))
+-- import           Control.Applicative ((*>), pure)
+-- #endif
+
+-- import           Debug.Trace (traceShow)
+
+import           Derived (AllAtOnce)
+#if MIN_VERSION_template_haskell(2,7,0)
+import           Derived (NotAllShow(..), OneDataInstance)
+#endif
+
+import           Instances.Derived ()
+
+-- import           Properties.Utils (ioProperty)
+
+-- import           System.IO (hFlush, stdout, stderr)
+-- import           System.IO.Silently (capture_, hCapture_)
+
+import           Test.Tasty (TestTree, testGroup)
+import           Test.Tasty.QuickCheck (testProperty)
+
+import qualified Text.Show as S (Show)
+import           Text.Show.Text (Builder, FromStringShow(..), showbPrec)
+-- import           Text.Show.Text.Debug.Trace.TH (mkTraceShow)
+import           Text.Show.Text.TH (mkShowbPrec)
+
+-- | Verifies 'mkShowbPrec' produces the same output as 'showsPrec'.
+prop_mkShowbPrec :: S.Show a
+                 => (Int -> a -> Builder) -- ^ TH-generated 'mkShowbPrec' function
+                 -> Int -> a -> Bool
+prop_mkShowbPrec sf p x = showbPrec p (FromStringShow x) == sf p x
+
+-- -- | Verifies 'mkPrint' produces the same output as 'print'.
+-- prop_mkPrint :: S.Show a
+--              => (a -> IO ()) -- ^ TH-generated 'mkPrint' function
+--              -> a -> Property
+-- prop_mkPrint pf x = ioProperty $ do
+--     sRes <- capture_ $ print x *> hFlush stdout
+--     tRes <- capture_ $ pf    x *> hFlush stdout
+--     pure $ sRes == tRes
+-- 
+-- -- | Verifies 'mkTraceShow' produces the same output as 'traceShow'.
+-- prop_mkTraceShow :: S.Show a
+--                  => (a -> IO () -> IO ()) -- ^ TH-generated 'mkTraceShow' function
+--                  -> a -> Property
+-- prop_mkTraceShow tsf x = ioProperty $ do
+--     let handles = [stdout, stderr]
+--     sRes <- hCapture_ handles $ traceShow x (pure ()) *> mapM_ hFlush handles
+--     tRes <- hCapture_ handles $ tsf       x (pure ()) *> mapM_ hFlush handles
+--     pure $ sRes == tRes
+
+-- | Verifies 'mkShowbPrec' produces the same output as 'showsPrec' .
+-- This uses a plain type constructor.
+prop_mkShowbPrecTyCon :: Int -> AllAtOnce Int Int Int Int -> Bool
+prop_mkShowbPrecTyCon = prop_mkShowbPrec $(mkShowbPrec ''AllAtOnce)
+
+-- -- | Verifies 'mkPrint' produces the same output as 'print'.
+-- -- This uses a plain type constructor.
+-- prop_mkPrintTyCon :: AllAtOnce Int Int Int Int -> Property
+-- prop_mkPrintTyCon = prop_mkPrint $(mkPrint ''AllAtOnce)
+-- 
+-- -- | Verifies 'mkTraceShow' produces the same output as 'traceShow'.
+-- -- This uses a plain type constructor.
+-- prop_mkTraceShowTyCon :: AllAtOnce Int Int Int Int -> Property
+-- prop_mkTraceShowTyCon = prop_mkTraceShow $(mkTraceShow ''AllAtOnce)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+-- | Verifies 'mkShowbPrec' produces the same output as 'showsPrec'.
+-- This uses a data family name.
+prop_mkShowbPrecDataFam :: Int -> OneDataInstance Int Int Int Int -> Bool
+prop_mkShowbPrecDataFam = prop_mkShowbPrec $(mkShowbPrec ''OneDataInstance)
+
+-- -- | Verifies 'mkPrint' produces the same output as 'print'.
+-- -- This uses a data family name.
+-- prop_mkPrintDataFam :: OneDataInstance Int Int Int Int -> Property
+-- prop_mkPrintDataFam = prop_mkPrint $(mkPrint ''OneDataInstance)
+-- 
+-- -- | Verifies 'mkTraceShow' produces the same output as 'traceShow'.
+-- -- This uses a data family name.
+-- prop_mkTraceShowDataFam :: OneDataInstance Int Int Int Int -> Property
+-- prop_mkTraceShowDataFam = prop_mkTraceShow $(mkTraceShow ''OneDataInstance)
+
+-- | Verifies 'mkShowbPrec' produces the same output as 'showsPrec'.
+-- This uses a data family instance constructor.
+prop_mkShowbPrecDataFamInstCon :: Int -> NotAllShow Int Int Int Int -> Bool
+prop_mkShowbPrecDataFamInstCon = prop_mkShowbPrec $(mkShowbPrec 'NASShow1)
+
+-- -- | Verifies 'mkPrint' produces the same output as 'print'.
+-- -- This uses a data family instance constructor.
+-- prop_mkPrintDataFamInstCon :: NotAllShow Int Int Int Int -> Property
+-- prop_mkPrintDataFamInstCon = prop_mkPrint $(mkPrint 'NASShow1)
+-- 
+-- -- | Verifies 'mkTraceShow' produces the same output as 'traceShow'.
+-- -- This uses a data family instance constructor.
+-- prop_mkTraceShowDataFamInstCon :: NotAllShow Int Int Int Int -> Property
+-- prop_mkTraceShowDataFamInstCon = prop_mkTraceShow $(mkTraceShow 'NASShow1)
+#endif
+
+mkShowTests :: [TestTree]
+mkShowTests =
+    [ testGroup "mkShow and related functions"
+        [ testProperty "$(mkShowbPrec ''AllAtOnce) (a plain type constructor)"            prop_mkShowbPrecTyCon
+--         , testProperty "$(mkPrint ''AllAtOnce) (a plain type constructor)"                prop_mkPrintTyCon
+--         , testProperty "$(mkTraceShow ''AllAtOnce) (a plain type constructor)"            prop_mkTraceShowTyCon
+#if MIN_VERSION_template_haskell(2,7,0)
+        , testProperty "$(mkShowbPrec ''NotAllShow) (a data family instance constructor)" prop_mkShowbPrecDataFamInstCon
+--         , testProperty "$(mkPrint ''NotAllShow) (a data family instance constructor)"     prop_mkPrintDataFamInstCon
+--         , testProperty "$(mkTraceShow ''NotAllShow) (a data family instance constructor)" prop_mkTraceShowDataFamInstCon
+        , testProperty "$(mkShowbPrec ''OneDataInstance) (a data family name)"            prop_mkShowbPrecDataFam
+--         , testProperty "$(mkPrint ''OneDataInstance) (a data family name)"                prop_mkPrintDataFam
+--         , testProperty "$(mkTraceShow ''OneDataInstance) (a data family name)"            prop_mkTraceShowDataFam
+#endif
+        ]
+    ]
tests/Properties/Utils.hs view
@@ -1,64 +1,64 @@-{-# LANGUAGE CPP              #-}-{-# LANGUAGE FlexibleContexts #-}-{-|-Module:      Properties.Utils-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@QuickCheck@ property-related utility functions.--}-module Properties.Utils (-      ioProperty-    , prop_matchesShow-    , prop_genericShow-    , prop_readShow-    , prop_showEq-    ) where--import           GHC.Generics (Generic, Rep)--import           Prelude hiding (Show)--#if MIN_VERSION_QuickCheck(2,7,0)-import qualified Test.Tasty.QuickCheck as QC (ioProperty)-#else-import           Test.Tasty.QuickCheck (morallyDubiousIOProperty)-#endif-import           Test.Tasty.QuickCheck (Property, Testable)--import qualified Text.Show as S (Show)-import qualified Text.Show.Text as T (Show)-import           Text.Show.Text hiding (Show)-import           Text.Show.Text.Generic--ioProperty :: Testable prop => IO prop -> Property-#if MIN_VERSION_QuickCheck(2,7,0)-ioProperty = QC.ioProperty-#else-ioProperty = morallyDubiousIOProperty-#endif---- | Verifies that a type's @Show@ instances coincide for both 'String's and 'Text',--- irrespective of precedence.-prop_matchesShow :: (S.Show a, T.Show a) => Int -> a -> Bool-prop_matchesShow p x = showbPrec p (FromStringShow x) == showbPrec p x---- | Verifies that a type's @Show@ instance coincides with the output produced--- by the equivalent 'Generic' functions.--- TODO: Add other generic functions--- TODO: Put in tuples-prop_genericShow :: (S.Show a, T.Show a, Generic a, GShow (Rep a))-                 => Int -> a -> Bool-prop_genericShow p x = showbPrec p x == genericShowbPrec p x---- | Verifies that @read . show = id@.-prop_readShow :: (Eq a, Read a, S.Show a) => Int -> a -> Bool-prop_readShow p x = read (showsPrec p x "") == x---- | Verifies that two type's @Show@ instances produce identical output, where the first--- type is a wrapper around the second type.-prop_showEq :: (T.Show a, T.Show b) => (a -> b) -> Int -> a -> Bool-prop_showEq f p x = showbPrec p (f x) == showbPrec p x+{-# LANGUAGE CPP              #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-|
+Module:      Properties.Utils
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Experimental
+Portability: GHC
+
+@QuickCheck@ property-related utility functions.
+-}
+module Properties.Utils (
+      ioProperty
+    , prop_matchesShow
+    , prop_genericShow
+    , prop_readShow
+    , prop_showEq
+    ) where
+
+import           GHC.Generics (Generic, Rep)
+
+import           Prelude hiding (Show)
+
+#if MIN_VERSION_QuickCheck(2,7,0)
+import qualified Test.Tasty.QuickCheck as QC (ioProperty)
+#else
+import           Test.Tasty.QuickCheck (morallyDubiousIOProperty)
+#endif
+import           Test.Tasty.QuickCheck (Property, Testable)
+
+import qualified Text.Show as S (Show)
+import qualified Text.Show.Text as T (Show)
+import           Text.Show.Text hiding (Show)
+import           Text.Show.Text.Generic
+
+ioProperty :: Testable prop => IO prop -> Property
+#if MIN_VERSION_QuickCheck(2,7,0)
+ioProperty = QC.ioProperty
+#else
+ioProperty = morallyDubiousIOProperty
+#endif
+
+-- | Verifies that a type's @Show@ instances coincide for both 'String's and 'Text',
+-- irrespective of precedence.
+prop_matchesShow :: (S.Show a, T.Show a) => Int -> a -> Bool
+prop_matchesShow p x = showbPrec p (FromStringShow x) == showbPrec p x
+
+-- | Verifies that a type's @Show@ instance coincides with the output produced
+-- by the equivalent 'Generic' functions.
+-- TODO: Add other generic functions
+-- TODO: Put in tuples
+prop_genericShow :: (S.Show a, T.Show a, Generic a, GShow (Rep a))
+                 => Int -> a -> Bool
+prop_genericShow p x = showbPrec p x == genericShowbPrec p x
+
+-- | Verifies that @read . show = id@.
+prop_readShow :: (Eq a, Read a, S.Show a) => Int -> a -> Bool
+prop_readShow p x = read (showsPrec p x "") == x
+
+-- | Verifies that two type's @Show@ instances produce identical output, where the first
+-- type is a wrapper around the second type.
+prop_showEq :: (T.Show a, T.Show b) => (a -> b) -> Int -> a -> Bool
+prop_showEq f p x = showbPrec p (f x) == showbPrec p x
text-show.cabal view
@@ -1,216 +1,216 @@-name:                text-show-version:             0.7-synopsis:            Efficient conversion of values into Text-description:         @text-show@ offers a replacement for the @Show@ typeclass intended-                     for use with @Text@ instead of @String@s. This package was created-                     in the spirit of-                     @<http://hackage.haskell.org/package/bytestring-show bytestring-show>@.-                     .-                     At the moment, @text-show@ provides @Show@ instances for most data-                     types in the @<http://hackage.haskell.org/package/array array>@,-                     @<http://hackage.haskell.org/package/base base>@,-                     @<http://hackage.haskell.org/package/bytestring bytestring>@, and-                     @<http://hackage.haskell.org/package/text text>@ packages.-                     Therefore, much of the source code for @text-show@ consists of-                     borrowed code from those packages in order to ensure that the-                     behaviors of the two @Show@ typeclasses coincide.-                     .-                     For most uses, simply importing "Text.Show.Text"-                     will suffice:-                     .-                     @-                        module Main where-                        .-                        import Data.Text (Text)-                        import Prelude hiding (Show(..), print)-                        import Text.Show.Text-                        .-                        hello :: Text-                        hello = show (Just \"Hello, World!\")-                        .-                        main :: IO ()-                        main = print hello-                     @-                     .-                     If you desire it, there are also monomorphic versions of the @showb@-                     function available in the submodules of "Text.Show.Text". A naming-                     convention is present in which functions that show different values-                     depending on the precedence end with @Prec@ (e.g., @showbIntPrec@),-                     whereas functions that show the same values regardless of-                     precedence do not end with @Prec@ (e.g., @showbBool@).-                     .-                     Support for automatically deriving @Show@ instances can be found-                     in the "Text.Show.Text.TH" and "Text.Show.Text.Generic" modules.-                     If you don't know which one to use, use @Text.Show.Text.TH@.-homepage:            https://github.com/RyanGlScott/text-show-bug-reports:         https://github.com/RyanGlScott/text-show/issues-license:             BSD3-license-file:        LICENSE-author:              Ryan Scott-maintainer:          Ryan Scott <ryan.gl.scott@ku.edu>-stability:           Experimental-copyright:           (C) 2014-2015 Ryan Scott-category:            Text-build-type:          Simple-extra-source-files:  CHANGELOG.md, README.md, include/*.h-cabal-version:       >=1.10--source-repository head-  type:                git-  location:            git://github.com/RyanGlScott/text-show.git--library-  exposed-modules:     Text.Show.Text-                       Text.Show.Text.Debug.Trace-                       Text.Show.Text.Debug.Trace.TH-                       Text.Show.Text.TH-                       -                       Text.Show.Text.Control.Applicative-                       Text.Show.Text.Control.Concurrent-                       Text.Show.Text.Control.Exception-                       Text.Show.Text.Control.Monad.ST-                       Text.Show.Text.Data.Array-                       Text.Show.Text.Data.Bool-                       Text.Show.Text.Data.ByteString-                       Text.Show.Text.Data.Char-                       Text.Show.Text.Data.Complex-                       Text.Show.Text.Data.Data-                       Text.Show.Text.Data.Dynamic-                       Text.Show.Text.Data.Either-                       Text.Show.Text.Data.Fixed-                       Text.Show.Text.Data.Floating-                       Text.Show.Text.Data.Functor.Identity-                       Text.Show.Text.Data.Integral-                       Text.Show.Text.Data.List-                       Text.Show.Text.Data.Maybe-                       Text.Show.Text.Data.Monoid-                       Text.Show.Text.Data.Ord-                       Text.Show.Text.Data.Proxy-                       Text.Show.Text.Data.Ratio-                       Text.Show.Text.Data.Text-                       Text.Show.Text.Data.Tuple-                       Text.Show.Text.Data.Typeable-                       Text.Show.Text.Data.Version-                       Text.Show.Text.Data.Void-                       Text.Show.Text.Foreign.C.Types-                       Text.Show.Text.Foreign.Ptr-                       Text.Show.Text.Functions-                       Text.Show.Text.Numeric.Natural-                       Text.Show.Text.System.Exit-                       Text.Show.Text.System.IO-                       Text.Show.Text.System.Posix.Types-                       Text.Show.Text.Text.Read-  other-modules:       Text.Show.Text.Classes-                       Text.Show.Text.Control-                       Text.Show.Text.Data-                       Text.Show.Text.Data.Typeable.Utils-                       Text.Show.Text.Foreign-                       Text.Show.Text.GHC-                       Text.Show.Text.Instances-                       Text.Show.Text.Numeric-                       Text.Show.Text.System-                       Text.Show.Text.Text-                       Text.Show.Text.TH.Internal-                       Text.Show.Text.Utils-  build-depends:       array               >= 0.3     && < 0.6-                     , base                >= 4.2     && < 5-                     -- , containers          >= 0.1     && < 0.6-                     , bytestring          >= 0.9     && < 0.11-                     , ghc-prim-                     , semigroups          >= 0.16.1  && < 1-                     , text                >= 0.8     && < 1.3-                     , template-haskell    >= 2.4     && < 2.11-  hs-source-dirs:      src-  default-language:    Haskell2010-  ghc-options:         -Wall-  include-dirs:        include-  includes:            inline.h-                     , utils.h-  install-includes:    inline.h-                     , utils.h-  -  if impl(ghc >= 7.2)-    exposed-modules:   Text.Show.Text.Debug.Trace.Generic-                       Text.Show.Text.Generic-                       Text.Show.Text.GHC.Fingerprint-                       Text.Show.Text.GHC.Generics-    if !os(windows)-      exposed-modules: Text.Show.Text.GHC.Event-  -  if impl(ghc >= 7.4)-    exposed-modules:   Text.Show.Text.GHC.Stats-  -  if impl(ghc >= 7.6)-    exposed-modules:   Text.Show.Text.GHC.TypeLits-  -  if impl(ghc < 7.7)-    build-depends:     tagged              >= 0.4.4   && < 1-  -  if impl(ghc >= 7.8)-    exposed-modules:   Text.Show.Text.Data.Type.Coercion-                       Text.Show.Text.Data.Type.Equality-    -    if impl(ghc < 7.10)-      exposed-modules: Text.Show.Text.Data.OldTypeable-  else-    build-depends:     bytestring-builder--  if impl(ghc < 7.9)-    build-depends:     nats                >= 0.1     && < 2-                     , transformers        >= 0.2.1   && < 0.5-                     , void                >= 0.5     && < 1-  else-    build-depends:     integer-gmp         >= 1.0     && < 1.1-  -  if impl(ghc >= 7.10)-    exposed-modules:   Text.Show.Text.GHC.RTS.Flags-                       Text.Show.Text.GHC.StaticPtr--  if os(windows)-    exposed-modules:   Text.Show.Text.GHC.Conc.Windows--test-suite text-show-properties-  type:                exitcode-stdio-1.0-  main-is:             Properties.hs-  other-modules:       Derived-                       Instances.BaseAndFriends-                       Instances.Derived-                       Instances.Utils-                       Properties.BaseAndFriends-                       Properties.Builder-                       Properties.Derived-                       Properties.MkShow-                       Properties.Utils-  build-depends:       array                      >= 0.3   && < 0.6-                     , base                       >= 4.5   && < 5-                     , bytestring                 >= 0.9   && < 0.11-                     , ghc-prim-                     -- Needed to conditionally import Arbitrary Natural instance-                     , QuickCheck                 >= 2.5   && < 3-                     , quickcheck-instances       >= 0.1   && < 0.4-                     , silently                   >= 1.2.4 && < 1.3-                     , tasty                      >= 0.8   && < 0.11-                     , tasty-hunit                >= 0.8   && < 0.10-                     , tasty-quickcheck           >= 0.8   && < 0.9-                     , text                       >= 0.8   && < 1.3-                     , text-show                  == 0.7-  hs-source-dirs:      tests-  default-language:    Haskell2010-  ghc-options:         -Wall-  include-dirs:        include-  includes:            overlap.h-                     , utils.h-  install-includes:    overlap.h-                     , utils.h--  if impl(ghc < 7.7)-    build-depends:     tagged                     >= 0.4.4 && < 1--  if impl(ghc < 7.8)-    build-depends:     bytestring-builder--  if impl(ghc < 7.9)-    build-depends:     nats                       >= 0.1   && < 2-                     , transformers               >= 0.2.1 && < 0.5-                     , transformers-compat        >= 0.3   && < 1-                     , void                       >= 0.5   && < 1+name:                text-show
+version:             0.7.0.1
+synopsis:            Efficient conversion of values into Text
+description:         @text-show@ offers a replacement for the @Show@ typeclass intended
+                     for use with @Text@ instead of @String@s. This package was created
+                     in the spirit of
+                     @<http://hackage.haskell.org/package/bytestring-show bytestring-show>@.
+                     .
+                     At the moment, @text-show@ provides @Show@ instances for most data
+                     types in the @<http://hackage.haskell.org/package/array array>@,
+                     @<http://hackage.haskell.org/package/base base>@,
+                     @<http://hackage.haskell.org/package/bytestring bytestring>@, and
+                     @<http://hackage.haskell.org/package/text text>@ packages.
+                     Therefore, much of the source code for @text-show@ consists of
+                     borrowed code from those packages in order to ensure that the
+                     behaviors of the two @Show@ typeclasses coincide.
+                     .
+                     For most uses, simply importing "Text.Show.Text"
+                     will suffice:
+                     .
+                     @
+                        module Main where
+                        .
+                        import Data.Text (Text)
+                        import Prelude hiding (Show(..), print)
+                        import Text.Show.Text
+                        .
+                        hello :: Text
+                        hello = show (Just \"Hello, World!\")
+                        .
+                        main :: IO ()
+                        main = print hello
+                     @
+                     .
+                     If you desire it, there are also monomorphic versions of the @showb@
+                     function available in the submodules of "Text.Show.Text". A naming
+                     convention is present in which functions that show different values
+                     depending on the precedence end with @Prec@ (e.g., @showbIntPrec@),
+                     whereas functions that show the same values regardless of
+                     precedence do not end with @Prec@ (e.g., @showbBool@).
+                     .
+                     Support for automatically deriving @Show@ instances can be found
+                     in the "Text.Show.Text.TH" and "Text.Show.Text.Generic" modules.
+                     If you don't know which one to use, use @Text.Show.Text.TH@.
+homepage:            https://github.com/RyanGlScott/text-show
+bug-reports:         https://github.com/RyanGlScott/text-show/issues
+license:             BSD3
+license-file:        LICENSE
+author:              Ryan Scott
+maintainer:          Ryan Scott <ryan.gl.scott@ku.edu>
+stability:           Experimental
+copyright:           (C) 2014-2015 Ryan Scott
+category:            Text
+build-type:          Simple
+extra-source-files:  CHANGELOG.md, README.md, include/*.h
+cabal-version:       >=1.10
+
+source-repository head
+  type:                git
+  location:            git://github.com/RyanGlScott/text-show.git
+
+library
+  exposed-modules:     Text.Show.Text
+                       Text.Show.Text.Debug.Trace
+                       Text.Show.Text.Debug.Trace.TH
+                       Text.Show.Text.TH
+                       
+                       Text.Show.Text.Control.Applicative
+                       Text.Show.Text.Control.Concurrent
+                       Text.Show.Text.Control.Exception
+                       Text.Show.Text.Control.Monad.ST
+                       Text.Show.Text.Data.Array
+                       Text.Show.Text.Data.Bool
+                       Text.Show.Text.Data.ByteString
+                       Text.Show.Text.Data.Char
+                       Text.Show.Text.Data.Complex
+                       Text.Show.Text.Data.Data
+                       Text.Show.Text.Data.Dynamic
+                       Text.Show.Text.Data.Either
+                       Text.Show.Text.Data.Fixed
+                       Text.Show.Text.Data.Floating
+                       Text.Show.Text.Data.Functor.Identity
+                       Text.Show.Text.Data.Integral
+                       Text.Show.Text.Data.List
+                       Text.Show.Text.Data.Maybe
+                       Text.Show.Text.Data.Monoid
+                       Text.Show.Text.Data.Ord
+                       Text.Show.Text.Data.Proxy
+                       Text.Show.Text.Data.Ratio
+                       Text.Show.Text.Data.Text
+                       Text.Show.Text.Data.Tuple
+                       Text.Show.Text.Data.Typeable
+                       Text.Show.Text.Data.Version
+                       Text.Show.Text.Data.Void
+                       Text.Show.Text.Foreign.C.Types
+                       Text.Show.Text.Foreign.Ptr
+                       Text.Show.Text.Functions
+                       Text.Show.Text.Numeric.Natural
+                       Text.Show.Text.System.Exit
+                       Text.Show.Text.System.IO
+                       Text.Show.Text.System.Posix.Types
+                       Text.Show.Text.Text.Read
+  other-modules:       Text.Show.Text.Classes
+                       Text.Show.Text.Control
+                       Text.Show.Text.Data
+                       Text.Show.Text.Data.Typeable.Utils
+                       Text.Show.Text.Foreign
+                       Text.Show.Text.GHC
+                       Text.Show.Text.Instances
+                       Text.Show.Text.Numeric
+                       Text.Show.Text.System
+                       Text.Show.Text.Text
+                       Text.Show.Text.TH.Internal
+                       Text.Show.Text.Utils
+  build-depends:       array               >= 0.3     && < 0.6
+                     , base                >= 4.2     && < 5
+                     -- , containers          >= 0.1     && < 0.6
+                     , bytestring          >= 0.9     && < 0.11
+                     , ghc-prim
+                     , semigroups          >= 0.16.1  && < 1
+                     , text                >= 0.8     && < 1.3
+                     , template-haskell    >= 2.4     && < 2.11
+  hs-source-dirs:      src
+  default-language:    Haskell2010
+  ghc-options:         -Wall
+  include-dirs:        include
+  includes:            inline.h
+                     , utils.h
+  install-includes:    inline.h
+                     , utils.h
+  
+  if impl(ghc >= 7.2)
+    exposed-modules:   Text.Show.Text.Debug.Trace.Generic
+                       Text.Show.Text.Generic
+                       Text.Show.Text.GHC.Fingerprint
+                       Text.Show.Text.GHC.Generics
+    if !os(windows)
+      exposed-modules: Text.Show.Text.GHC.Event
+  
+  if impl(ghc >= 7.4)
+    exposed-modules:   Text.Show.Text.GHC.Stats
+  
+  if impl(ghc >= 7.6)
+    exposed-modules:   Text.Show.Text.GHC.TypeLits
+  
+  if impl(ghc < 7.7)
+    build-depends:     tagged              >= 0.4.4   && < 1
+  
+  if impl(ghc >= 7.8)
+    exposed-modules:   Text.Show.Text.Data.Type.Coercion
+                       Text.Show.Text.Data.Type.Equality
+    
+    if impl(ghc < 7.10)
+      exposed-modules: Text.Show.Text.Data.OldTypeable
+  else
+    build-depends:     bytestring-builder
+
+  if impl(ghc < 7.9)
+    build-depends:     nats                >= 0.1     && < 2
+                     , transformers        >= 0.2.1   && < 0.5
+                     , void                >= 0.5     && < 1
+  else
+    build-depends:     integer-gmp         >= 1.0     && < 1.1
+  
+  if impl(ghc >= 7.10)
+    exposed-modules:   Text.Show.Text.GHC.RTS.Flags
+                       Text.Show.Text.GHC.StaticPtr
+
+  if os(windows)
+    exposed-modules:   Text.Show.Text.GHC.Conc.Windows
+
+test-suite text-show-properties
+  type:                exitcode-stdio-1.0
+  main-is:             Properties.hs
+  other-modules:       Derived
+                       Instances.BaseAndFriends
+                       Instances.Derived
+                       Instances.Utils
+                       Properties.BaseAndFriends
+                       Properties.Builder
+                       Properties.Derived
+                       Properties.MkShow
+                       Properties.Utils
+  build-depends:       array                      >= 0.3   && < 0.6
+                     , base                       >= 4.5   && < 5
+                     , bytestring                 >= 0.9   && < 0.11
+                     , ghc-prim
+                     -- Needed to conditionally import Arbitrary Natural instance
+                     , QuickCheck                 >= 2.5   && < 3
+                     , quickcheck-instances       >= 0.1   && < 0.4
+                     -- , silently                   >= 1.2.4 && < 1.3
+                     , tasty                      >= 0.8   && < 0.11
+                     , tasty-hunit                >= 0.8   && < 0.10
+                     , tasty-quickcheck           >= 0.8   && < 0.9
+                     , text                       >= 0.8   && < 1.3
+                     , text-show                  == 0.7.0.1
+  hs-source-dirs:      tests
+  default-language:    Haskell2010
+  ghc-options:         -Wall
+  include-dirs:        include
+  includes:            overlap.h
+                     , utils.h
+  install-includes:    overlap.h
+                     , utils.h
+
+  if impl(ghc < 7.7)
+    build-depends:     tagged                     >= 0.4.4 && < 1
+
+  if impl(ghc < 7.8)
+    build-depends:     bytestring-builder
+
+  if impl(ghc < 7.9)
+    build-depends:     nats                       >= 0.1   && < 2
+                     , transformers               >= 0.2.1 && < 0.5
+                     , transformers-compat        >= 0.3   && < 1
+                     , void                       >= 0.5   && < 1