packages feed

text-show 0.8.1.1 → 1

raw patch · 177 files changed

+14405/−12852 lines, 177 filesdep +containersdep +generic-derivingdep ~base-orphansdep ~taggeddep ~text-showsetup-changed

Dependencies added: containers, generic-deriving

Dependency ranges changed: base-orphans, tagged, text-show

Files

CHANGELOG.md view
@@ -1,105 +1,122 @@-### 0.8.1.1-* Retroactive `CHANGELOG` update--## 0.8.1-* Fix test suite build with older versions of `QuickCheck`--# 0.8-* Exported `formatRealFloatB` and `formatRealFloatAltB` from `Text.Show.Text.Data.Floating`. Reexported `FPFormat` (from `text`) in the same module, and added a `Text` `Show` instance for it.-* The `Show` instance for `Ratio a` now only requires a `Show a` constraint if using `base-4.4.0.0` or later (if using `base-4.3.0.0`, it requires a `(Show a, Integral a)` constraint)-* Added `showbSingPrec` to `Text.Show.Text.GHC.TypeLits` (if using `base-4.6`)-* Modules which were previously exported only if using a recent-enough version of GHC/`base` (e.g., `Text.Show.Text.GHC.Generics`) are now always exposed. If the functionality that the module provides is not available on a given version of GHC/`base`, the module will not expose anything.-* Bump lower version bounds of `text` to 0.11.1 due to reexporting `FPFormat`-* Added `showbUnicodeException`, `showbI16Prec`, `showbDecodingPrec`, and `showbSizePrec` functions (and corresponding `Show` instances) to `Text.Show.Text.Data.Text`-* Made `GShow` in `Text.Show.Text.Generics` poly-kinded-* The Template Haskell deriver (and `GShow`) now handles "infix" data constructors that are applied as prefix correctly (e.g., `data Amp a = (:&) a a`)-* The Template Haskell deriver now handles showable unlifted types (`Char#`, `Double#`, `Float#`, `Int#`, and `Word#`) correctly on GHC 7.11 and later-* The Template Haskell derive now does not parenthesize record types regardless of precedence on GHC 7.11 and later-* Fixed build on GHC 7.2-* Changed test-suite to use `hspec`, which allows for it to be built on GHC 7.0 and 7.2--### 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-* 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+# 1
+* The `Show1` class has been completely overhauled. `Show1` now uses the function `showbPrecWith`, which takes as an argument a function of type `Int -> a -> Builder` to show occurrences of the type parameter (instead of requiring the type parameter to be a `Show` instance). This matches the new implementation of `Show1` in the next version of `transformers`. A similar `Show2` class (with the function `showbPrecWith2`) was also added.
+* As a consequence, `Show1` instances should no longer be defined in terms of `showbPrec`; rather, `Show` instances should be defined in terms of `showbPrecWith` or `showbPrecWith2`, and `Show1` instances can be defined in terms of `showbPrecWith2`.
+* The `showbPrec1` function is no longer a class method of `Show1`, but is now a standalone function defined in terms of `showbPrecWith`. `showbPrec1` can be useful for defining `Show` instances. A similar `showbPrec2` function was also added.
+* The monomorphic functions in the many submodules of this package have been generalized (where possible) to use `Show1` and `Show2` instances. These functions have `-PrecWith` and `-PrecWith2` suffixes, respectively.
+* Because of the generality of the new `showPrecWith` function, `Show1` instances are now possible for `Ratio`, `Alt`, `Rec1`, `M1`, `(:+:)`, `(:*:)`, and `(:.:)`.
+* Removed many silly instances for `FromStringShow` and `FromTextShow`, since they'll never be used in the ways suggested by those instances to begin with.
+* The Template Haskell engine has been completely overhauled. Deriving `Show1` and `Show2` instances are now possible using the `deriveShow1` and `deriveShow2` functions. See the documentation in `Text.Show.Text.TH` for more details. In addition, the `mkShowbPrecWith`, `mkShowbPrec1`, `mkShowbPrecWith2`, and `mkShowbPrec2` functions were added.
+* Removed the ability to call `deriveShow` or `mkShowbPrec` (or other functions prefixed with `mk-`) using a data family name. This is considered a misfeature. If you want to derive `Show` for data family instances, use the corresponding `data instance` or `newtype instance` constructor name as an argument instead.
+ * Removed `PragmaOptions`, `deriveShowPragmas`, `defaultInlineShowbPrec`, `defaultInlineShowb`, and `defaultInlineShowbList`, as it was impossible to make Template Haskell-generated pragmas work consistently across different versions of GHC. If you really want to use `INLINE` and `SPECIALIZE instance` pragmas with your Template Haskell-generated code, create manual instances with `mkShowbPrec` and family.
+* `Show1` instances can now be created generically using the `genericShowbPrecWith` function in `Text.Show.Text.Generics`. A `genericShowbPrec1` was also added.
+* Added `generic-deriving` as a dependency, which allows generics-related code to be exported on more versions of GHC
+* `ConType` (in `Text.Show.Text.Generics`) now has an `Inf String` constructor instead of `Inf Builder`. As a result, `ConType` now always an `Eq` and `Ord` instance, and a `Read ConType` instance was added.
+* `Typeable` instances for the promoted data constructors `'FromStringShow` and `'FromTextShow`
+* Added `showbFPFormat` to `Text.Show.Text.Data.Floating`
+* Revamped test suite
+
+### 0.8.1.1
+* Retroactive `CHANGELOG` update
+
+## 0.8.1
+* Fix test suite build with older versions of `QuickCheck`
+
+# 0.8
+* Exported `formatRealFloatB` and `formatRealFloatAltB` from `Text.Show.Text.Data.Floating`. Reexported `FPFormat` (from `text`) in the same module, and added a `Text` `Show` instance for it.
+* The `Show` instance for `Ratio a` now only requires a `Show a` constraint if using `base-4.4.0.0` or later (if using `base-4.3.0.0`, it requires a `(Show a, Integral a)` constraint)
+* Added `showbSingPrec` to `Text.Show.Text.GHC.TypeLits` (if using `base-4.6`)
+* Modules which were previously exported only if using a recent-enough version of GHC/`base` (e.g., `Text.Show.Text.GHC.Generics`) are now always exposed. If the functionality that the module provides is not available on a given version of GHC/`base`, the module will not expose anything.
+* Bump lower version bounds of `text` to 0.11.1 due to reexporting `FPFormat`
+* Added `showbUnicodeException`, `showbI16Prec`, `showbDecodingPrec`, and `showbSizePrec` functions (and corresponding `Show` instances) to `Text.Show.Text.Data.Text`
+* Made `GShow` in `Text.Show.Text.Generics` poly-kinded
+* The Template Haskell deriver (and `GShow`) now handles "infix" data constructors that are applied as prefix correctly (e.g., `data Amp a = (:&) a a`)
+* The Template Haskell deriver now handles showable unlifted types (`Char#`, `Double#`, `Float#`, `Int#`, and `Word#`) correctly on GHC 7.11 and later
+* The Template Haskell derive now does not parenthesize record types regardless of precedence on GHC 7.11 and later
+* Fixed build on GHC 7.2
+* Changed test-suite to use `hspec`, which allows for it to be built on GHC 7.0 and 7.2
+
+### 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
+* 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.
+* 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,25 +1,25 @@-# `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`).--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`.+# `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`).
+
+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`.
Setup.hs view
@@ -1,2 +1,2 @@-import Distribution.Simple-main = defaultMain+import Distribution.Simple
+main = defaultMain
+ include/generic.h view
@@ -0,0 +1,11 @@+#ifndef GENERIC_H
+#define GENERIC_H
+
+#if __GLASGOW_HASKELL__ >= 709 || \
+   (__GLASGOW_HASKELL__ == 708 && \
+    defined(__GLASGOW_HASKELL_PATCHLEVEL1__) && \
+    __GLASGOW_HASKELL_PATCHLEVEL1__ == 4)
+# define __LANGUAGE_DERIVE_GENERIC1__ // Workaround for https://ghc.haskell.org/trac/ghc/ticket/9563
+#endif
+
+#endif
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 OVERLAPS 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,57 @@-{-|-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 ()--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:   Provisional
+Portability: GHC
+
+Efficiently convert from values to 'Text' via 'Builder's.
+
+/Since: 0.1/
+-}
+module Text.Show.Text (
+      -- * The @Show@-related classes
+      -- ** 'Show'
+      Show(..)
+    , show
+    , showLazy
+    , showPrec
+    , showPrecLazy
+    , showList
+    , showListLazy
+    , showbParen
+    , showbSpace
+      -- ** 'Show1'
+    , Show1(..)
+    , showbPrec1
+    , showbUnaryWith
+      -- ** 'Show2'
+    , Show2(..)
+    , showbPrec2
+    , showbBinaryWith
+      -- * '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 ()
+
+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,470 +1,378 @@-{-# 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--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.Monoid.Compat ((<>))-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 ()-import           Prelude.Compat 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 OverloadedStrings          #-}
+
+#if __GLASGOW_HASKELL__ >= 702
+{-# LANGUAGE DeriveGeneric              #-}
+#else
+{-# LANGUAGE TemplateHaskell            #-}
+{-# LANGUAGE TypeFamilies               #-}
+#endif
+
+#if __GLASGOW_HASKELL__ >= 708
+{-# LANGUAGE AutoDeriveTypeable         #-}
+{-# LANGUAGE DataKinds                  #-}
+{-# LANGUAGE PolyKinds                  #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+#endif
+{-|
+Module:      Text.Show.Text.Classes
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+The 'Show', 'Show1', and 'Show2' typeclasses.
+-}
+module Text.Show.Text.Classes where
+
+import           Data.Data (Data, Typeable)
+import           Data.Monoid.Compat ((<>))
+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, singleton, toLazyText)
+
+#if __GLASGOW_HASKELL__ >= 702
+import           GHC.Generics (Generic)
+# if __GLASGOW_HASKELL__ >= 706
+import           GHC.Generics (Generic1)
+# endif
+#else
+import qualified Generics.Deriving.TH as Generics (deriveAll)
+#endif
+import           GHC.Show (appPrec, appPrec1)
+
+import           Prelude ()
+import           Prelude.Compat hiding (Show(..))
+
+import           System.IO (Handle)
+
+import           Text.Read (Read(..), readListPrecDefault)
+import qualified Text.Show as S (Show(..))
+import           Text.Show.Text.Utils (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
+
+-- | 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         = singleton '(' <> builder <> singleton ')'
+                     | otherwise = builder
+{-# INLINE showbParen #-}
+
+-- | Construct a 'Builder' containing a single space character.
+--
+-- /Since: 0.5/
+showbSpace :: Builder
+showbSpace = singleton ' '
+
+-- | 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) = singleton '[' <> showbx x <> go xs -- "[..
+  where
+    go (y:ys) = singleton ',' <> showbx y <> go ys               -- ..,..
+    go []     = singleton ']'                                    -- ..]"
+{-# INLINE showbListWith #-}
+
+-- | 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 #-}
+
+-------------------------------------------------------------------------------
+
+-- | Lifting of the 'Show' class to unary type constructors.
+--
+-- /Since: 1/
+class Show1 f where
+    -- | Lifts a 'showbPrec' function through the type constructor.
+    --
+    -- /Since: 1/
+    showbPrecWith :: (Int -> a -> Builder) -> Int -> f a -> Builder
+
+#if __GLASGOW_HASKELL__ >= 708
+deriving instance Typeable Show1
+#endif
+
+-- | Lift the standard 'showbPrec' function through the type constructor.
+--
+-- /Since: 1/
+showbPrec1 :: (Show1 f, Show a) => Int -> f a -> Builder
+showbPrec1 = showbPrecWith showbPrec
+{-# INLINE showbPrec1 #-}
+
+-- | @'showbUnaryWith' sp n p x@ produces the 'Builder' representation of a unary data
+-- constructor with name @n@ and argument @x@, in precedence context @p@, using the
+-- function @sp@ to show occurrences of the type argument.
+--
+-- /Since: 1/
+showbUnaryWith :: (Int -> a -> Builder) -> Builder -> Int -> a -> Builder
+showbUnaryWith sp nameB p x = showbParen (p > appPrec) $
+    nameB <> showbSpace <> sp appPrec1 x
+{-# INLINE showbUnaryWith #-}
+
+-------------------------------------------------------------------------------
+
+-- | Lifting of the 'Show' class to binary type constructors.
+--
+-- /Since: 1/
+class Show2 f where
+    -- | Lifts 'showbPrec' functions through the type constructor.
+    --
+    -- /Since: 1/
+    showbPrecWith2 :: (Int -> a -> Builder) -> (Int -> b -> Builder) ->
+        Int -> f a b -> Builder
+
+#if __GLASGOW_HASKELL__ >= 708
+deriving instance Typeable Show2
+#endif
+
+-- | Lift two 'showbPrec' functions through the type constructor.
+--
+-- /Since: 1/
+showbPrec2 :: (Show2 f, Show a, Show b) => Int -> f a b -> Builder
+showbPrec2 = showbPrecWith2 showbPrec showbPrec
+{-# INLINE showbPrec2 #-}
+
+-- | @'showbBinaryWith' sp 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@, using the functions @sp1@ and @sp2@ to show occurrences of the type arguments.
+--
+-- /Since: 1/
+showbBinaryWith :: (Int -> a -> Builder) -> (Int -> b -> Builder) ->
+    Builder -> Int -> a -> b -> Builder
+showbBinaryWith sp1 sp2 nameB p x y = showbParen (p > appPrec) $ nameB
+    <> showbSpace <> sp1 appPrec1 x
+    <> showbSpace <> sp2 appPrec1 y
+{-# INLINE showbBinaryWith #-}
+
+-------------------------------------------------------------------------------
+
+-- | 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 ( Data
+           , Eq
+           , Foldable
+           , Functor
+#if __GLASGOW_HASKELL__ >= 702
+           , Generic
+# if __GLASGOW_HASKELL__ >= 706
+           , Generic1
+# endif
+#endif
+           , Ord
+           , Traversable
+           , Typeable
+           )
+
+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 ( Data
+           , Eq
+           , Foldable
+           , Functor
+#if __GLASGOW_HASKELL__ >= 702
+           , Generic
+# if __GLASGOW_HASKELL__ >= 706
+           , Generic1
+# endif
+#endif
+           , Ord
+           , Traversable
+           , Typeable
+           )
+
+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) = showString . toString $ showbPrec p x
+    INLINE_INST_FUN(showsPrec)
+
+instance Show a => Show (FromTextShow a) where
+    showbPrec = showbPrec1
+    INLINE_INST_FUN(showbPrec)
+
+instance Show1 FromTextShow where
+    showbPrecWith sp p (FromTextShow x) = sp p x
+    INLINE_INST_FUN(showbPrecWith)
+
+-------------------------------------------------------------------------------
+
+#if __GLASGOW_HASKELL__ < 702
+$(Generics.deriveAll ''FromStringShow)
+$(Generics.deriveAll ''FromTextShow)
+#endif
src/Text/Show/Text/Control/Applicative.hs view
@@ -1,57 +1,50 @@-{-# 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)+{-# 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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'ZipList'.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Control.Applicative (showbConstPrecWith, showbZipListPrecWith) where
+
+import Control.Applicative (Const(..), ZipList)
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec), Show1(..), Show2(..), showbUnaryWith)
+import Text.Show.Text.Data.List ()
+import Text.Show.Text.TH.Internal (deriveShow, deriveShow1)
+
+-- | Convert a 'Const' value to a 'Builder' with the given show function and precedence.
+-- 
+-- /Since: 1/
+showbConstPrecWith :: (Int -> a -> Builder) -> Int -> Const a b -> Builder
+showbConstPrecWith sp = showbPrecWith2 sp undefined
+
+-- | Convert a 'ZipList' to a 'Builder' with the given show function precedence.
+-- 
+-- /Since: 1/
+showbZipListPrecWith :: (Int -> a -> Builder) -> Int -> ZipList a -> Builder
+showbZipListPrecWith = showbPrecWith
+
+instance Show a => Show (Const a b) where
+    showbPrec = showbPrecWith undefined
+
+instance Show a => Show1 (Const a) where
+    showbPrecWith = showbPrecWith2 showbPrec
+
+instance Show2 Const where
+    showbPrecWith2 sp1 _ p (Const x) = showbUnaryWith sp1 "Const" p x
+
+$(deriveShow  ''ZipList)
+$(deriveShow1 ''ZipList)
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:   Provisional
+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,299 +1,299 @@-{-# 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--import Data.Monoid.Compat ((<>))-import Data.Text.Lazy.Builder (Builder, fromString)--import Prelude ()-import Prelude.Compat hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))-import Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowb)--#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:   Provisional
+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
+
+import Data.Monoid.Compat ((<>))
+import Data.Text.Lazy.Builder (Builder, fromString)
+
+import Prelude ()
+import Prelude.Compat hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), FromStringShow(..))
+import Text.Show.Text.TH.Internal (deriveShow)
+
+#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)
+
+$(deriveShow ''MaskingState)
src/Text/Show/Text/Control/Monad/ST.hs view
@@ -1,38 +1,42 @@-{-# 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 ()-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:   Provisional
+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), Show1(..), Show2(..))
+
+#include "inline.h"
+
+-- | Convert a strict 'ST' value to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbST :: ST s a -> Builder
+showbST = showb
+{-# INLINE showbST #-}
+
+instance Show (ST s a) where
+    showb = showbPrecWith undefined 0
+    INLINE_INST_FUN(showb)
+
+instance Show1 (ST s) where
+    showbPrecWith = showbPrecWith2 undefined
+    INLINE_INST_FUN(showbPrecWith)
+
+instance Show2 ST where
+    showbPrecWith2 _ _ _ _ = "<<ST action>>"
+    INLINE_INST_FUN(showbPrecWith2)
src/Text/Show/Text/Data/Array.hs view
@@ -1,81 +1,81 @@-{-# 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.Monoid.Compat ((<>))-import           Data.Text.Lazy.Builder (Builder)--import           GHC.Show (appPrec)--import           Prelude ()-import           Prelude.Compat hiding (Show)--import           Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, showbSpace)-import           Text.Show.Text.Data.List ()-import           Text.Show.Text.Data.Tuple ()--#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:   Provisional
+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.Monoid.Compat ((<>))
+import           Data.Text.Lazy.Builder (Builder)
+
+import           GHC.Show (appPrec)
+
+import           Prelude ()
+import           Prelude.Compat hiding (Show)
+
+import           Text.Show.Text.Classes (Show(showb, showbPrec), showbParen, showbSpace)
+import           Text.Show.Text.Data.List ()
+import           Text.Show.Text.Data.Tuple ()
+
+#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 #-}--$(deriveShowPragmas defaultInlineShowb ''Bool)+{-# 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:   Provisional
+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 (deriveShow)
+
+-- | Convert a 'Bool' to a 'Builder'.
+--
+-- /Since: 0.3/
+showbBool :: Bool -> Builder
+showbBool = showb
+{-# INLINE showbBool #-}
+
+$(deriveShow ''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:   Provisional
+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 (deriveShow)
+#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
+$(deriveShow ''BL.ByteString)
+#endif
+
+instance Show ShortByteString where
+    showb = showbShortByteString
+    INLINE_INST_FUN(showb)
src/Text/Show/Text/Data/Char.hs view
@@ -1,109 +1,109 @@-{-# 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)-import           Data.Monoid.Compat ((<>))-import           Data.Text.Lazy.Builder (Builder)--import           Prelude ()-import           Prelude.Compat 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:   Provisional
+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)
+import           Data.Monoid.Compat ((<>))
+import           Data.Text.Lazy.Builder (Builder, singleton)
+
+import           Prelude ()
+import           Prelude.Compat hiding (Show)
+
+import           Text.Show.Text.Classes (Show(..))
+import           Text.Show.Text.Data.Integral (showbIntPrec)
+import           Text.Show.Text.TH.Internal (deriveShow)
+
+#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    = singleton '\'' <> showbLitChar c <> singleton '\''
+{-# INLINE showbChar #-}
+
+-- | Convert a 'Char' to a 'Builder' (without single quotes).
+--
+-- /Since: 0.3/
+showbLitChar :: Char -> Builder
+showbLitChar c | c > '\DEL' = singleton '\\' <> showbIntPrec 0 (ord c)
+showbLitChar '\DEL'         = "\\DEL"
+showbLitChar '\\'           = "\\\\"
+showbLitChar c | c >= ' '   = singleton 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              = singleton '\\' <> (asciiTabB ! ord c)
+
+-- | Convert a 'String' to a 'Builder' (surrounded by double quotes).
+--
+-- /Since: 0.3/
+showbString :: String -> Builder
+showbString cs = singleton '"' <> showbLitString cs <> singleton '"'
+{-# 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 = singleton '\\' <> showbIntPrec 0 (ord c) <> "\\&"
+                             <> singleton 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,69 +1,65 @@-{-# 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.--- --- Note that on @base-4.3.0.0@, this function must have a @('Show' a, 'RealFloat' a)@--- constraint instead of just a @('Show' a)@ constraint.--- /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 #-}---- TODO: Only use TH when context solver is improved-#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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'Ratio' values.
+
+Due to use of the @DatatypeContexts@ extension, there is no @Show1 Complex@
+instance on @base-4.3.0.0@.
+
+/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 ()
+import Text.Show.Text.TH.Internal (mkShowbPrec)
+#if MIN_VERSION_base(4,4,0)
+import Text.Show.Text.TH.Internal (deriveShow1)
+#endif
+
+#include "inline.h"
+
+-- | Convert a 'Complex' value to a 'Builder' with the given precedence.
+--
+-- Note that on @base-4.3.0.0@, this function must have a @('Show' a, 'RealFloat' a)@
+-- constraint instead of just a @('Show' a)@ constraint.
+-- /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 #-}
+
+instance
+#if MIN_VERSION_base(4,4,0)
+  Show a
+#else
+  (RealFloat a, Show a)
+#endif
+  => Show (Complex a) where
+    {-# SPECIALIZE instance Show (Complex Float)  #-}
+    {-# SPECIALIZE instance Show (Complex Double) #-}
+    showbPrec = $(mkShowbPrec ''Complex)
+    INLINE_INST_FUN(showbPrec)
+
+#if MIN_VERSION_base(4,4,0)
+$(deriveShow1 ''Complex)
+#endif
src/Text/Show/Text/Data/Data.hs view
@@ -1,79 +1,78 @@-{-# 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:   Provisional
+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)
+
+#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 #-}
+
+$(deriveShow ''DataType)
+$(deriveShow ''DataRep)
+$(deriveShow ''ConstrRep)
+$(deriveShow ''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.Monoid.Compat ((<>))-import Data.Text.Lazy.Builder (Builder)--import Prelude ()--import Text.Show.Text.Classes (Show(showb))-import Text.Show.Text.Data.Typeable (showbTypeRepPrec)--#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:   Provisional
+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.Monoid.Compat ((<>))
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude ()
+
+import Text.Show.Text.Classes (Show(showb))
+import Text.Show.Text.Data.Typeable (showbTypeRepPrec)
+
+#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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'Either' values.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Either (showbEitherPrecWith2) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (showbPrecWith2)
+import Text.Show.Text.TH.Internal (deriveShow, deriveShow1, deriveShow2)
+
+#include "inline.h"
+
+-- | Convert a 'Either' value to a 'Builder' with the given show functions
+-- and precedence.
+--
+-- /Since: 1/
+showbEitherPrecWith2 :: (Int -> a -> Builder) -> (Int -> b -> Builder)
+                     -> Int -> Either a b -> Builder
+showbEitherPrecWith2 = showbPrecWith2
+{-# INLINE showbEitherPrecWith2 #-}
+
+$(deriveShow  ''Either)
+$(deriveShow1 ''Either)
+$(deriveShow2 ''Either)
src/Text/Show/Text/Data/Fixed.hs view
@@ -1,92 +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 ()-import Prelude.Compat 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.Monoid.Compat ((<>))-import Data.Semigroup (timesN)--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:   Provisional
+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 ()
+import Prelude.Compat 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.Monoid.Compat ((<>))
+import Data.Semigroup (timesN)
+import Data.Text.Lazy.Builder (singleton)
+
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.Utils (lengthB)
+#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
+    = singleton '-' <> 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) (singleton '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   = singleton '.' <> 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,409 +1,413 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell   #-}-{-# 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-    , FPFormat(..)-    , formatRealFloatB-    , formatRealFloatAltB-    ) where--import           Data.Array.Base (unsafeAt)-import           Data.Array.IArray (Array, array)-import           Data.Monoid.Compat ((<>))-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.TH.Internal (deriveShowPragmas, defaultInlineShowb)-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 = formatRealFloatB 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 = formatRealFloatB 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 = formatRealFloatB 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 = formatRealFloatAltB Fixed d True-{-# 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 = formatRealFloatAltB Generic d True-{-# 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 'formatRealFloatAltB', except that the decimal is only shown for arguments--- whose absolute value is between @0.1@ and @9,999,999@.--- --- /Since: 0.8/-formatRealFloatB :: RealFloat a-                 => FPFormat  -- ^ What notation to use.-                 -> Maybe Int -- ^ Number of decimal places to render.-                 -> a-                 -> Builder-formatRealFloatB fmt decs = formatRealFloatAltB fmt decs False-{-# INLINE formatRealFloatB #-}---- | Converts a 'RealFloat' value to a Builder, specifying if a decimal point--- should always be shown.--- --- /Since: 0.8/-formatRealFloatAltB :: 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 formatRealFloatAltB :: FPFormat -> Maybe Int -> Bool -> Float -> Builder #-}-{-# SPECIALIZE formatRealFloatAltB :: FPFormat -> Maybe Int -> Bool -> Double -> Builder #-}-formatRealFloatAltB 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]]------------------------------------------------------------------------------------ Orphan instance for FPFormat----------------------------------------------------------------------------------$(deriveShowPragmas defaultInlineShowb ''FPFormat)+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell   #-}
+{-# 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:   Provisional
+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
+    , showbFPFormat
+    , FPFormat(..)
+    , formatRealFloatB
+    , formatRealFloatAltB
+    ) where
+
+import           Data.Array.Base (unsafeAt)
+import           Data.Array.IArray (Array, array)
+import           Data.Monoid.Compat ((<>))
+import qualified Data.Text as T (replicate)
+import           Data.Text.Lazy.Builder (Builder, fromString, fromText, singleton)
+import           Data.Text.Lazy.Builder.Int (decimal)
+import           Data.Text.Lazy.Builder.RealFloat (FPFormat(..))
+
+import           Prelude hiding (Show)
+
+import           Text.Show.Text.Classes (Show(showb, showbPrec), showbParen)
+import           Text.Show.Text.TH.Internal (deriveShow)
+import           Text.Show.Text.Utils (i2d)
+
+#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) $ singleton '-' <> 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 = formatRealFloatB 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 = formatRealFloatB 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 = formatRealFloatB 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 = formatRealFloatAltB Fixed d True
+{-# 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 = formatRealFloatAltB Generic d True
+{-# INLINE showbGFloatAlt #-}
+
+-- | Convert an 'FPFormat' value to a 'Builder'.
+--
+-- /Since: 0.9/
+showbFPFormat :: FPFormat -> Builder
+showbFPFormat = showb
+{-# INLINE showbFPFormat #-}
+
+-------------------------------------------------------------------------------
+-- GHC.Float internal functions, adapted for Builders
+-------------------------------------------------------------------------------
+
+-- | Like 'formatRealFloatAltB', except that the decimal is only shown for arguments
+-- whose absolute value is between @0.1@ and @9,999,999@.
+--
+-- /Since: 0.8/
+formatRealFloatB :: RealFloat a
+                 => FPFormat  -- ^ What notation to use.
+                 -> Maybe Int -- ^ Number of decimal places to render.
+                 -> a
+                 -> Builder
+formatRealFloatB fmt decs = formatRealFloatAltB fmt decs False
+{-# INLINE formatRealFloatB #-}
+
+-- | Converts a 'RealFloat' value to a Builder, specifying if a decimal point
+-- should always be shown.
+--
+-- /Since: 0.8/
+formatRealFloatAltB :: 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 formatRealFloatAltB :: FPFormat -> Maybe Int -> Bool -> Float -> Builder #-}
+{-# SPECIALIZE formatRealFloatAltB :: FPFormat -> Maybe Int -> Bool -> Double -> Builder #-}
+formatRealFloatAltB fmt decs alt x
+   | isNaN x                   = "NaN"
+   | isInfinite x              = if x < 0 then "-Infinity" else "Infinity"
+   | x < 0 || isNegativeZero x = singleton '-' <> 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]     -> singleton d <> ".0e" <> show_e'
+          (d:ds') -> singleton d <> singleton '.' <> fromString ds' <> singleton '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
+          singleton d <> singleton '.' <> fromString ds' <> singleton '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) <> singleton '.' <> 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 singleton '.' <> 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
+         singleton d <> (if null ds' && not alt then "" else singleton '.' <> 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
+
+-- | The maximum exponent (of 2) in the cache.
+maxExpt :: Int
+maxExpt = 1100
+
+-- | 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
+
+-- | Cached powers of 10.
+expts10 :: Array Int Integer
+expts10 = array (minExpt,maxExpt10) [(n,10^n) | n <- [minExpt .. maxExpt10]]
+
+-------------------------------------------------------------------------------
+-- Show instances
+-------------------------------------------------------------------------------
+
+instance Show Float where
+    showbPrec = showbFloatPrec
+    INLINE_INST_FUN(showbPrec)
+
+instance Show Double where
+    showbPrec = showbDoublePrec
+    INLINE_INST_FUN(showbPrec)
+
+$(deriveShow ''FPFormat)
src/Text/Show/Text/Data/Functor/Identity.hs view
@@ -1,42 +1,43 @@-{-# 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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'Identity' values.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Data.Functor.Identity (showbIdentityPrecWith) 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, showbUnaryWith)
+
+#include "inline.h"
+
+-- | Convert an 'Identity' value to a 'Builder' with the given show function
+-- and precedence.
+-- 
+-- /Since: 1/
+showbIdentityPrecWith :: (Int -> a -> Builder) -> Int -> Identity a -> Builder
+-- This would be equivalent to the derived instance of 'Identity' if the
+-- 'runIdentity' field were removed.
+showbIdentityPrecWith sp p (Identity x) = showbUnaryWith sp "Identity" p x
+{-# INLINE showbIdentityPrecWith #-}
+
+instance Show a => Show (Identity a) where
+    showbPrec = showbPrec1
+    {-# INLINE showbPrec #-}
+
+instance Show1 Identity where
+    showbPrecWith = showbIdentityPrecWith
+    INLINE_INST_FUN(showbPrecWith)
src/Text/Show/Text/Data/Integral.hs view
@@ -1,241 +1,241 @@-{-# 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)-import           Data.Monoid.Compat ((<>))-import           Data.Text.Lazy.Builder (Builder)-import           Data.Text.Lazy.Builder.Int (decimal)-import           Data.Word (Word8, Word16, Word32, Word64)--import           GHC.Exts (Int(I#))-#if __GLASGOW_HASKELL__ >= 708-import           GHC.Exts (isTrue#)-import           GHC.Prim (Int#)-#endif-import           GHC.Prim ((<#), (>#))--import           Prelude ()-import           Prelude.Compat 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:   Provisional
+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)
+import           Data.Monoid.Compat ((<>))
+import           Data.Text.Lazy.Builder (Builder, singleton)
+import           Data.Text.Lazy.Builder.Int (decimal)
+import           Data.Word (Word8, Word16, Word32, Word64)
+
+import           GHC.Exts (Int(I#))
+#if __GLASGOW_HASKELL__ >= 708
+import           GHC.Exts (isTrue#)
+import           GHC.Prim (Int#)
+#endif
+import           GHC.Prim ((<#), (>#))
+
+import           Prelude ()
+import           Prelude.Compat hiding (Show)
+
+import           Text.Show.Text.Classes (Show(showb, showbPrec))
+import           Text.Show.Text.Utils (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#) = singleton '(' <> decimal n' <> singleton ')'
+    | 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 = singleton '(' <> decimal n <> singleton ')'
+    | 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' = singleton 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,32 @@-{-# 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 String   #-}-    {-# SPECIALIZE instance Show [Int]    #-}-    showb = showbList-    INLINE_INST_FUN(showb)--instance Show1 [] where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)+{-# 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:   Provisional
+Portability: GHC
+
+Exports 'showbListWith'.
+-}
+module Text.Show.Text.Data.List (showbListWith) where
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbList), Show1(..), 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 String   #-}
+    {-# SPECIALIZE instance Show [Int]    #-}
+    showb = showbList
+    INLINE_INST_FUN(showb)
+
+instance Show1 [] where
+    showbPrecWith sp _ = showbListWith (sp 0)
+    INLINE_INST_FUN(showbPrecWith)
src/Text/Show/Text/Data/Maybe.hs view
@@ -1,38 +1,35 @@-{-# 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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'Maybe' values.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Maybe (showbMaybePrecWith) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (showbPrecWith)
+import Text.Show.Text.TH.Internal (deriveShow, deriveShow1)
+
+#include "inline.h"
+
+-- | Convert a 'Maybe' value to a 'Builder' with the given show function and precedence.
+--
+-- /Since: 1/
+showbMaybePrecWith :: (Int -> a -> Builder) -> Int -> Maybe a -> Builder
+showbMaybePrecWith = showbPrecWith
+{-# INLINE showbMaybePrecWith #-}
+
+$(deriveShow  ''Maybe)
+$(deriveShow1 ''Maybe)
src/Text/Show/Text/Data/Monoid.hs view
@@ -1,141 +1,136 @@-{-# 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.Compat (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.8/-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)--- TODO: Derive with TH once it can detect higher-kinded types properly-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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' functions for 'Monoid'-related newtypes.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Monoid (
+      showbAllPrec
+    , showbAnyPrec
+    , showbDualPrecWith
+    , showbFirstPrecWith
+    , showbLastPrecWith
+    , showbProductPrecWith
+    , showbSumPrecWith
+#if MIN_VERSION_base(4,8,0)
+    , showbAltPrec
+    , showbAltPrecWith
+#endif
+    ) where
+
+import Data.Monoid.Compat (All, Any, Dual, First, Last, Product, Sum)
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec), showbPrecWith)
+import Text.Show.Text.Data.Bool ()
+import Text.Show.Text.Data.Maybe ()
+import Text.Show.Text.TH.Internal (deriveShow, deriveShow1)
+
+#if MIN_VERSION_base(4,8,0)
+import Data.Monoid (Alt)
+import Text.Show.Text.Classes (Show1)
+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 show function and precedence.
+--
+-- /Since: 1/
+showbDualPrecWith :: (Int -> a -> Builder) -> Int -> Dual a -> Builder
+showbDualPrecWith = showbPrecWith
+{-# INLINE showbDualPrecWith #-}
+
+-- | Convert a 'First' value to a 'Builder' with the given show function and precedence.
+--
+-- /Since: 1/
+showbFirstPrecWith :: (Int -> a -> Builder) -> Int -> First a -> Builder
+showbFirstPrecWith = showbPrecWith
+{-# INLINE showbFirstPrecWith #-}
+
+-- | Convert a 'Last' value to a 'Builder' with the given show function and precedence.
+--
+-- /Since: 1/
+showbLastPrecWith :: (Int -> a -> Builder) -> Int -> Last a -> Builder
+showbLastPrecWith = showbPrecWith
+{-# INLINE showbLastPrecWith #-}
+
+-- | Convert a 'Product' value to a 'Builder' with the given show function
+-- and precedence.
+--
+-- /Since: 1/
+showbProductPrecWith :: (Int -> a -> Builder) -> Int -> Product a -> Builder
+showbProductPrecWith = showbPrecWith
+{-# INLINE showbProductPrecWith #-}
+
+-- | Convert a 'Sum' value to a 'Builder' with the given show function and precedence.
+--
+-- /Since: 1/
+showbSumPrecWith :: (Int -> a -> Builder) -> Int -> Sum a -> Builder
+showbSumPrecWith = showbPrecWith
+{-# INLINE showbSumPrecWith #-}
+
+#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.8/
+showbAltPrec :: Show (f a) => Int -> Alt f a -> Builder
+showbAltPrec = showbPrec
+{-# INLINE showbAltPrec #-}
+
+-- | Convert an 'Alt' value to a 'Builder' with the given show function and precedence.
+-- This function is only available with @base-4.8.0.0@ or later.
+--
+-- /Since: 1/
+showbAltPrecWith :: Show1 f => (Int -> a -> Builder) -> Int -> Alt f a -> Builder
+showbAltPrecWith = showbPrecWith
+#endif
+
+$(deriveShow  ''All)
+$(deriveShow  ''Any)
+$(deriveShow  ''Dual)
+$(deriveShow1 ''Dual)
+$(deriveShow  ''First)
+$(deriveShow1 ''First)
+$(deriveShow  ''Last)
+$(deriveShow1 ''Last)
+$(deriveShow  ''Product)
+$(deriveShow1 ''Product)
+$(deriveShow  ''Sum)
+$(deriveShow1 ''Sum)
+
+#if MIN_VERSION_base(4,8,0)
+instance Show (f a) => Show (Alt f a) where
+    showbPrec = $(mkShowbPrec ''Alt)
+
+$(deriveShow1 ''Alt)
+#endif
src/Text/Show/Text/Data/OldTypeable.hs view
@@ -1,78 +1,78 @@-{-# LANGUAGE CPP               #-}--#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-}-#endif-{-|-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 only exports functions if using @base-4.7@.--/Since: 0.5/--}-module Text.Show.Text.Data.OldTypeable (-#if !(MIN_VERSION_base(4,7,0)) || MIN_VERSION_base(4,8,0)-    ) where-#else-      showbTyCon-    , showbTypeRepPrec-    ) where--import Data.Monoid.Compat ((<>))-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 #-}-#endif+{-# LANGUAGE CPP               #-}
+
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-}
+#endif
+{-|
+Module:      Text.Show.Text.Data.OldTypeable
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the @OldTypeable@ module.
+This module only exports functions if using @base-4.7@.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Data.OldTypeable (
+#if !(MIN_VERSION_base(4,7,0)) || MIN_VERSION_base(4,8,0)
+    ) where
+#else
+      showbTyCon
+    , showbTypeRepPrec
+    ) where
+
+import Data.Monoid.Compat ((<>))
+import Data.OldTypeable.Internal (TyCon(TyCon, tyConName), TypeRep(..),
+                                  funTc, listTc)
+import Data.Text.Lazy.Builder (Builder, fromString, singleton)
+
+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)
+
+-- | 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 -> singleton '[' <> showb x <> singleton ']'
+      [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 #-}
+#endif
src/Text/Show/Text/Data/Ord.hs view
@@ -1,66 +1,63 @@-{-# 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 Prelude hiding (Show)--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 #-}--#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.8/-showbDownPrec :: Show a => Int -> Down a -> Builder-showbDownPrec = showbPrec-{-# INLINE showbDownPrec #-}-#endif--$(deriveShowPragmas defaultInlineShowb ''Ordering)--#if MIN_VERSION_base(4,6,0)-$(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:   Provisional
+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)
+    , showbDownPrecWith
+#endif
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (showb)
+import Text.Show.Text.TH.Internal (deriveShow)
+
+#if MIN_VERSION_base(4,6,0)
+import Data.Ord (Down)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (showbPrecWith)
+import Text.Show.Text.TH.Internal (deriveShow1)
+#endif
+
+#include "inline.h"
+
+-- | Convert a 'Ordering' to a 'Builder'.
+--
+-- /Since: 0.3/
+showbOrdering :: Ordering -> Builder
+showbOrdering = showb
+{-# INLINE showbOrdering #-}
+
+#if MIN_VERSION_base(4,6,0)
+-- | Convert a 'Down' value to a 'Builder' with the given show function and precedence.
+-- This function is only available with @base-4.6.0.0@ or later.
+--
+-- /Since: 1/
+showbDownPrecWith :: (Int -> a -> Builder) -> Int -> Down a -> Builder
+showbDownPrecWith = showbPrecWith
+{-# INLINE showbDownPrecWith #-}
+#endif
+
+$(deriveShow  ''Ordering)
+
+#if MIN_VERSION_base(4,6,0)
+$(deriveShow  ''Down)
+$(deriveShow1 ''Down)
+#endif
src/Text/Show/Text/Data/Proxy.hs view
@@ -1,43 +1,40 @@-{-# 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 ()--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:   Provisional
+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), showbPrecWith)
+import Text.Show.Text.TH.Internal (deriveShow1)
+
+#include "inline.h"
+
+-- | Convert a 'Proxy' type to a 'Builder'.
+--
+-- /Since: 0.4/
+showbProxy :: Proxy s -> Builder
+showbProxy = showb
+{-# INLINE showbProxy #-}
+
+instance Show (Proxy s) where
+    showbPrec = showbPrecWith undefined
+    INLINE_INST_FUN(showb)
+
+$(deriveShow1 ''Proxy)
src/Text/Show/Text/Data/Ratio.hs view
@@ -1,58 +1,70 @@-{-# 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.Monoid.Compat ((<>))-import Data.Text.Lazy.Builder (Builder)--import GHC.Real (Ratio(..), ratioPrec, ratioPrec1)--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showbPrec), showbParen)-import Text.Show.Text.Data.Integral ()--#include "inline.h"---- | Convert a 'Ratio' to a 'Builder' with the given precedence.--- --- Note that on @base-4.3.0.0@, this function must have a @('Show' a, 'Integral' a)@--- constraint instead of just a @('Show' a)@ constraint.--- --- /Since: 0.5/-showbRatioPrec ::-#if MIN_VERSION_base(4,4,0)-                  Show a-#else-                  (Show a, Integral a)-#endif-               => Int -> Ratio a -> Builder-showbRatioPrec p (numer :% denom) = showbParen (p > ratioPrec) $-       showbPrec ratioPrec1 numer-    <> " % "-    <> showbPrec ratioPrec1 denom-{-# INLINE showbRatioPrec #-}--instance-#if MIN_VERSION_base(4,4,0)-         Show a-#else-         (Show a, Integral a)-#endif-      => 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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'Ratio' values.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.Data.Ratio (showbRatioPrec) where
+
+import Data.Monoid.Compat ((<>))
+import Data.Text.Lazy.Builder (Builder)
+
+import GHC.Real (Ratio(..), ratioPrec, ratioPrec1)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec), showbParen)
+#if MIN_VERSION_base(4,4,0)
+import Text.Show.Text.Classes (Show1(..))
+#endif
+import Text.Show.Text.Data.Integral ()
+
+#include "inline.h"
+
+-- | Convert a 'Ratio' to a 'Builder' with the given precedence.
+-- 
+-- Note that on @base-4.3.0.0@, this function must have a @('Show' a, 'Integral' a)@
+-- constraint instead of just a @('Show' a)@ constraint.
+-- 
+-- /Since: 0.5/
+showbRatioPrec ::
+#if MIN_VERSION_base(4,4,0)
+                  Show a
+#else
+                  (Show a, Integral a)
+#endif
+               => Int -> Ratio a -> Builder
+showbRatioPrec p (numer :% denom) = showbParen (p > ratioPrec) $
+       showbPrec ratioPrec1 numer
+    <> " % "
+    <> showbPrec ratioPrec1 denom
+{-# INLINE showbRatioPrec #-}
+
+instance
+#if MIN_VERSION_base(4,4,0)
+         Show a
+#else
+         (Show a, Integral a)
+#endif
+      => Show (Ratio a) where
+    {-# SPECIALIZE instance Show Rational #-}
+    showbPrec = showbRatioPrec
+    INLINE_INST_FUN(showbPrec)
+
+#if MIN_VERSION_base(4,4,0)
+instance Show1 Ratio where
+    showbPrecWith sp p (numer :% denom) = showbParen (p > ratioPrec) $
+           sp ratioPrec1 numer
+        <> " % "
+        <> sp ratioPrec1 denom
+    INLINE_INST_FUN(showbPrecWith)
+#endif
src/Text/Show/Text/Data/Text.hs view
@@ -1,157 +1,156 @@-{-# LANGUAGE CPP               #-}-{-# LANGUAGE OverloadedStrings #-}-#if MIN_VERSION_text(0,9,0)-{-# LANGUAGE TemplateHaskell   #-}-#endif-{-# OPTIONS_GHC -fno-warn-deprecations #-} -- TODO: Remove this later-{-# 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-    , showbI16Prec-    , showbUnicodeException-#if MIN_VERSION_text(1,0,0)-    , showbDecodingPrec-#endif-#if MIN_VERSION_text(1,1,0)-    , showbSizePrec-#endif-    ) where--import           Data.Monoid.Compat ((<>))-import qualified Data.Text as TS-import           Data.Text.Encoding.Error (UnicodeException(..))-import           Data.Text.Foreign (I16)-import qualified Data.Text.Lazy as TL-import           Data.Text.Lazy.Builder (Builder, fromString, toLazyText)-import           Prelude hiding (Show)--import           Text.Show.Text.Classes (Show(showb, showbPrec))-import           Text.Show.Text.Data.Char (showbString)-import           Text.Show.Text.Data.Integral (showbHex)-import           Text.Show.Text.TH.Internal (deriveShowPragmas, defaultInlineShowbPrec)--#if MIN_VERSION_text(1,0,0)-import           Data.Text.Encoding (Decoding(..))-import           Data.Text.Lazy.Builder (singleton)-import           GHC.Show (appPrec)-import           Text.Show.Text.Classes (showbParen)-import           Text.Show.Text.Data.ByteString (showbByteStringStrict)-#endif--#if MIN_VERSION_text(1,1,0)-import           Data.Text.Internal.Fusion.Size (Size)-import           Text.Show.Text.TH.Internal (deriveShow)-#endif--#include "inline.h"---- | Convert a strict 'TS.Text' to 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' to 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 #-}---- | Convert an 'I16' value to a 'Builder' with the given precedence.--- --- /Since: 0.8/-showbI16Prec :: Int -> I16 -> Builder-showbI16Prec = showbPrec-{-# INLINE showbI16Prec #-}---- | Convert a 'UnicodeException' to a 'Builder'.--- --- /Since: 0.8/-showbUnicodeException :: UnicodeException -> Builder-showbUnicodeException (DecodeError desc (Just w))-    = "Cannot decode byte '\\x" <> showbHex w <> "': " <> fromString desc-showbUnicodeException (DecodeError desc Nothing)-    = "Cannot decode input: " <> fromString desc-showbUnicodeException (EncodeError desc (Just c))-    = "Cannot encode character '\\x" <> showbHex (fromEnum c) <> "': " <> fromString desc-showbUnicodeException (EncodeError desc Nothing)-    = "Cannot encode input: " <> fromString desc--#if MIN_VERSION_text(1,0,0)--- | Convert a 'Decoding' value to a 'Builder' with the given precedence.--- This function is only available with @text-1.0.0.0@ or later.--- --- /Since: 0.8/-showbDecodingPrec :: Int -> Decoding -> Builder-showbDecodingPrec p (Some t bs _) = showbParen (p > appPrec) $-    fromString "Some " <> showbText t <>-    singleton ' ' <> showbByteStringStrict bs <>-    fromString " _"-{-# INLINE showbDecodingPrec #-}-#endif--#if MIN_VERSION_text(1,1,0)--- | Convert a 'Size' value to a 'Builder' with the given precedence.--- This function is only available with @text-1.1.0.0@ or later.--- --- /Since: 0.8/-showbSizePrec :: Int -> Size -> Builder-showbSizePrec = showbPrec-{-# INLINE showbSizePrec #-}-#endif--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)--$(deriveShowPragmas defaultInlineShowbPrec ''I16)--instance Show UnicodeException where-    showb = showbUnicodeException-    INLINE_INST_FUN(showb)--#if MIN_VERSION_text(1,0,0)-instance Show Decoding where-    showbPrec = showbDecodingPrec-    INLINE_INST_FUN(showbPrec)-#endif--#if MIN_VERSION_text(1,1,0)-$(deriveShow ''Size)-#endif+{-# LANGUAGE CPP               #-}
+{-# LANGUAGE OverloadedStrings #-}
+#if MIN_VERSION_text(0,9,0)
+{-# LANGUAGE TemplateHaskell   #-}
+#endif
+{-# OPTIONS_GHC -fno-warn-deprecations #-} -- TODO: Remove this later
+{-# 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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' functions for 'Text' types.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Text (
+      showbText
+    , showbTextLazy
+    , showbBuilder
+    , showbI16Prec
+    , showbUnicodeException
+#if MIN_VERSION_text(1,0,0)
+    , showbDecodingPrec
+#endif
+#if MIN_VERSION_text(1,1,0)
+    , showbSizePrec
+#endif
+    ) where
+
+import           Data.Monoid.Compat ((<>))
+import qualified Data.Text as TS
+import           Data.Text.Encoding.Error (UnicodeException(..))
+import           Data.Text.Foreign (I16)
+import qualified Data.Text.Lazy as TL
+import           Data.Text.Lazy.Builder (Builder, fromString, toLazyText)
+import           Prelude hiding (Show)
+
+import           Text.Show.Text.Classes (Show(showb, showbPrec))
+import           Text.Show.Text.Data.Char (showbString)
+import           Text.Show.Text.Data.Integral (showbHex)
+import           Text.Show.Text.TH.Internal (deriveShow)
+
+#if MIN_VERSION_text(1,0,0)
+import           Data.Text.Encoding (Decoding(..))
+import           Data.Text.Lazy.Builder (singleton)
+import           GHC.Show (appPrec)
+import           Text.Show.Text.Classes (showbParen)
+import           Text.Show.Text.Data.ByteString (showbByteStringStrict)
+#endif
+
+#if MIN_VERSION_text(1,1,0)
+import           Data.Text.Internal.Fusion.Size (Size)
+#endif
+
+#include "inline.h"
+
+-- | Convert a strict 'TS.Text' to 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' to 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 #-}
+
+-- | Convert an 'I16' value to a 'Builder' with the given precedence.
+--
+-- /Since: 0.8/
+showbI16Prec :: Int -> I16 -> Builder
+showbI16Prec = showbPrec
+{-# INLINE showbI16Prec #-}
+
+-- | Convert a 'UnicodeException' to a 'Builder'.
+--
+-- /Since: 0.8/
+showbUnicodeException :: UnicodeException -> Builder
+showbUnicodeException (DecodeError desc (Just w))
+    = "Cannot decode byte '\\x" <> showbHex w <> "': " <> fromString desc
+showbUnicodeException (DecodeError desc Nothing)
+    = "Cannot decode input: " <> fromString desc
+showbUnicodeException (EncodeError desc (Just c))
+    = "Cannot encode character '\\x" <> showbHex (fromEnum c) <> "': " <> fromString desc
+showbUnicodeException (EncodeError desc Nothing)
+    = "Cannot encode input: " <> fromString desc
+
+#if MIN_VERSION_text(1,0,0)
+-- | Convert a 'Decoding' value to a 'Builder' with the given precedence.
+-- This function is only available with @text-1.0.0.0@ or later.
+--
+-- /Since: 0.8/
+showbDecodingPrec :: Int -> Decoding -> Builder
+showbDecodingPrec p (Some t bs _) = showbParen (p > appPrec) $
+    fromString "Some " <> showbText t <>
+    singleton ' ' <> showbByteStringStrict bs <>
+    fromString " _"
+{-# INLINE showbDecodingPrec #-}
+#endif
+
+#if MIN_VERSION_text(1,1,0)
+-- | Convert a 'Size' value to a 'Builder' with the given precedence.
+-- This function is only available with @text-1.1.0.0@ or later.
+--
+-- /Since: 0.8/
+showbSizePrec :: Int -> Size -> Builder
+showbSizePrec = showbPrec
+{-# INLINE showbSizePrec #-}
+#endif
+
+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)
+
+$(deriveShow ''I16)
+
+instance Show UnicodeException where
+    showb = showbUnicodeException
+    INLINE_INST_FUN(showb)
+
+#if MIN_VERSION_text(1,0,0)
+instance Show Decoding where
+    showbPrec = showbDecodingPrec
+    INLINE_INST_FUN(showbPrec)
+#endif
+
+#if MIN_VERSION_text(1,1,0)
+$(deriveShow ''Size)
+#endif
src/Text/Show/Text/Data/Tuple.hs view
@@ -1,240 +1,231 @@-{-# 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 ()--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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' functions for tuple types.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Tuple (
+      showbUnit
+    , showb2TupleWith2
+    , showb3TupleWith2
+    , showb4TupleWith2
+    , showb5TupleWith2
+    , showb6TupleWith2
+    , showb7TupleWith2
+    , showb8TupleWith2
+    , showb9TupleWith2
+    , showb10TupleWith2
+    , showb11TupleWith2
+    , showb12TupleWith2
+    , showb13TupleWith2
+    , showb14TupleWith2
+    , showb15TupleWith2
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb), Show2(..))
+import Text.Show.Text.TH.Internal (deriveShow, deriveShow1, deriveShow2)
+
+#include "inline.h"
+
+-- | Converts @()@ into a 'Builder'.
+--
+-- /Since: 0.3/
+showbUnit :: () -> Builder
+-- showbUnit () = "()"
+showbUnit = showb
+{-# INLINE showbUnit #-}
+
+-- | Converts a 2-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb2TupleWith2 :: (a -> Builder) -> (b -> Builder)
+                 -> (a, b) -> Builder
+showb2TupleWith2 = showbWith2
+{-# INLINE showb2TupleWith2 #-}
+
+-- | Converts a 3-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb3TupleWith2 :: Show a
+                 => (b -> Builder) -> (c -> Builder)
+                 -> (a, b, c) -> Builder
+showb3TupleWith2 = showbWith2
+{-# INLINE showb3TupleWith2 #-}
+
+-- | Converts a 4-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb4TupleWith2 :: (Show a, Show b)
+                 => (c -> Builder) -> (d -> Builder)
+                 -> (a, b, c, d) -> Builder
+showb4TupleWith2 = showbWith2
+{-# INLINE showb4TupleWith2 #-}
+
+-- | Converts a 5-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb5TupleWith2 :: (Show a, Show b, Show c)
+                 => (d -> Builder) -> (e -> Builder)
+                 -> (a, b, c, d, e) -> Builder
+showb5TupleWith2 = showbWith2
+{-# INLINE showb5TupleWith2 #-}
+
+-- | Converts a 6-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb6TupleWith2 :: (Show a, Show b, Show c, Show d)
+                 => (e -> Builder) -> (f -> Builder)
+                 -> (a, b, c, d, e, f) -> Builder
+showb6TupleWith2 = showbWith2
+{-# INLINE showb6TupleWith2 #-}
+
+-- | Converts a 7-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb7TupleWith2 :: (Show a, Show b, Show c, Show d, Show e)
+                 => (f -> Builder) -> (g -> Builder)
+                 -> (a, b, c, d, e, f, g) -> Builder
+showb7TupleWith2 = showbWith2
+{-# INLINE showb7TupleWith2 #-}
+
+-- | Converts an 8-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb8TupleWith2 :: (Show a, Show b, Show c, Show d, Show e, Show f)
+                 => (g -> Builder) -> (h -> Builder)
+                 -> (a, b, c, d, e, f, g, h) -> Builder
+showb8TupleWith2 = showbWith2
+{-# INLINE showb8TupleWith2 #-}
+
+-- | Converts a 9-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb9TupleWith2 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g)
+                 => (h -> Builder) -> (i -> Builder)
+                 -> (a, b, c, d, e, f, g, h, i) -> Builder
+showb9TupleWith2 = showbWith2
+{-# INLINE showb9TupleWith2 #-}
+
+-- | Converts a 10-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb10TupleWith2 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h)
+                  => (i -> Builder) -> (j -> Builder)
+                  -> (a, b, c, d, e, f, g, h, i, j) -> Builder
+showb10TupleWith2 = showbWith2
+{-# INLINE showb10TupleWith2 #-}
+
+-- | Converts an 11-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb11TupleWith2 :: (Show a, Show b, Show c, Show d, Show e,
+                      Show f, Show g, Show h, Show i)
+                  => (j -> Builder) -> (k -> Builder)
+                  -> (a, b, c, d, e, f, g, h, i, j, k) -> Builder
+showb11TupleWith2 = showbWith2
+{-# INLINE showb11TupleWith2 #-}
+
+-- | Converts a 12-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb12TupleWith2 :: (Show a, Show b, Show c, Show d, Show e,
+                      Show f, Show g, Show h, Show i, Show j)
+                  => (k -> Builder) -> (l -> Builder)
+                  -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Builder
+showb12TupleWith2 = showbWith2
+{-# INLINE showb12TupleWith2 #-}
+
+-- | Converts a 13-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb13TupleWith2 :: (Show a, Show b, Show c, Show d, Show e, Show f,
+                      Show g, Show h, Show i, Show j, Show k)
+                  => (l -> Builder) -> (m -> Builder)
+                  -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Builder
+showb13TupleWith2 = showbWith2
+{-# INLINE showb13TupleWith2 #-}
+
+-- | Converts a 14-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb14TupleWith2 :: (Show a, Show b, Show c, Show d, Show e, Show f,
+                      Show g, Show h, Show i, Show j, Show k, Show l)
+                  => (m -> Builder) -> (n -> Builder)
+                  -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Builder
+showb14TupleWith2 = showbWith2
+{-# INLINE showb14TupleWith2 #-}
+
+-- | Converts a 15-tuple into a 'Builder' with the given show functions.
+--
+-- /Since: 1/
+showb15TupleWith2 :: (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)
+                  => (n -> Builder) -> (o -> Builder)
+                  -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Builder
+showb15TupleWith2 = showbWith2
+{-# INLINE showb15TupleWith2 #-}
+
+-- | Like 'showbPrecWith2', except precedence-agnostic.
+showbWith2 :: Show2 f => (a -> Builder) -> (b -> Builder) -> f a b -> Builder
+showbWith2 sp1 sp2 = showbPrecWith2 (const sp1) (const sp2) 0
+{-# INLINE showbWith2 #-}
+
+-- The Great Pyramids of Template Haskell
+$(deriveShow ''())
+$(deriveShow ''(,))
+$(deriveShow ''(,,))
+$(deriveShow ''(,,,))
+$(deriveShow ''(,,,,))
+$(deriveShow ''(,,,,,))
+$(deriveShow ''(,,,,,,))
+$(deriveShow ''(,,,,,,,))
+$(deriveShow ''(,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,,,,,))
+$(deriveShow ''(,,,,,,,,,,,,,,))
+
+$(deriveShow1 ''(,))
+$(deriveShow1 ''(,,))
+$(deriveShow1 ''(,,,))
+$(deriveShow1 ''(,,,,))
+$(deriveShow1 ''(,,,,,))
+$(deriveShow1 ''(,,,,,,))
+$(deriveShow1 ''(,,,,,,,))
+$(deriveShow1 ''(,,,,,,,,))
+$(deriveShow1 ''(,,,,,,,,,))
+$(deriveShow1 ''(,,,,,,,,,,))
+$(deriveShow1 ''(,,,,,,,,,,,))
+$(deriveShow1 ''(,,,,,,,,,,,,))
+$(deriveShow1 ''(,,,,,,,,,,,,,))
+$(deriveShow1 ''(,,,,,,,,,,,,,,))
+
+$(deriveShow2 ''(,))
+$(deriveShow2 ''(,,))
+$(deriveShow2 ''(,,,))
+$(deriveShow2 ''(,,,,))
+$(deriveShow2 ''(,,,,,))
+$(deriveShow2 ''(,,,,,,))
+$(deriveShow2 ''(,,,,,,,))
+$(deriveShow2 ''(,,,,,,,,))
+$(deriveShow2 ''(,,,,,,,,,))
+$(deriveShow2 ''(,,,,,,,,,,))
+$(deriveShow2 ''(,,,,,,,,,,,))
+$(deriveShow2 ''(,,,,,,,,,,,,))
+$(deriveShow2 ''(,,,,,,,,,,,,,))
+$(deriveShow2 ''(,,,,,,,,,,,,,,))
src/Text/Show/Text/Data/Type/Coercion.hs view
@@ -1,52 +1,53 @@-{-# LANGUAGE CPP             #-}--#if MIN_VERSION_base(4,7,0)-{-# LANGUAGE GADTs           #-}-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-#endif-{-|-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 only exports functions if using @base-4.7.0.0@ or later.--/Since: 0.3/--}-module Text.Show.Text.Data.Type.Coercion (-#if !(MIN_VERSION_base(4,7,0))-    ) where-#else-      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 #-}-#endif+{-# LANGUAGE CPP             #-}
+
+#if MIN_VERSION_base(4,7,0)
+{-# LANGUAGE GADTs           #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+#endif
+{-|
+Module:      Text.Show.Text.Data.Type.Coercion
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for representational equality.
+This module only exports functions if using @base-4.7.0.0@ or later.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Type.Coercion (
+#if !(MIN_VERSION_base(4,7,0))
+    ) where
+#else
+      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(..), Show2(..))
+import Text.Show.Text.TH.Internal (deriveShow2)
+
+-- | 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 #-}
+
+instance Show (Coercion a b) where
+    showbPrec = showbPrecWith undefined
+    {-# INLINE showb #-}
+
+instance Show1 (Coercion a) where
+    showbPrecWith = showbPrecWith2 undefined
+    {-# INLINE showbPrecWith #-}
+
+$(deriveShow2 ''Coercion)
+#endif
src/Text/Show/Text/Data/Type/Equality.hs view
@@ -1,53 +1,54 @@-{-# LANGUAGE CPP             #-}--#if MIN_VERSION_base(4,7,0)-{-# LANGUAGE GADTs           #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE TypeOperators   #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-#endif-{-|-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 only exports functions if using @base-4.7.0.0@ or later.--/Since: 0.3/--}-module Text.Show.Text.Data.Type.Equality (-#if !(MIN_VERSION_base(4,7,0))-    ) where-#else-      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 #-}-#endif+{-# LANGUAGE CPP             #-}
+
+#if MIN_VERSION_base(4,7,0)
+{-# LANGUAGE GADTs           #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeOperators   #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+#endif
+{-|
+Module:      Text.Show.Text.Data.Type.Equality
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for propositional equality.
+This module only exports functions if using @base-4.7.0.0@ or later.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Type.Equality (
+#if !(MIN_VERSION_base(4,7,0))
+    ) where
+#else
+      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(..), Show2(..))
+import Text.Show.Text.TH.Internal (deriveShow2)
+
+-- | 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 #-}
+
+instance Show (a :~: b) where
+    showbPrec = showbPrecWith undefined
+    {-# INLINE showbPrec #-}
+
+instance Show1 ((:~:) a) where
+    showbPrecWith = showbPrecWith2 undefined
+    {-# INLINE showbPrecWith #-}
+
+$(deriveShow2 ''(:~:))
+#endif
src/Text/Show/Text/Data/Typeable.hs view
@@ -1,105 +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.Monoid.Compat ((<>))-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:   Provisional
+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.Monoid.Compat ((<>))
+import Data.Text.Lazy.Builder (Builder, fromString, singleton)
+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)
+
+#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 -> singleton '[' <> showb x <> singleton ']'
+      [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 [()]
+
+-- | 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,32 +1,31 @@-{-|-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--import Data.Monoid.Compat ((<>))-import Data.Text.Lazy.Builder (Builder)--import Prelude ()-import Prelude.Compat 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 #-}+{-|
+Module:      Text.Show.Text.Data.Typeable.Utils
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Utility functions for showing data types in the @Typeable@ (or @OldTypeable@) module.
+-}
+module Text.Show.Text.Data.Typeable.Utils (showbArgs, showbTuple) where
+
+import Data.Monoid.Compat ((<>))
+import Data.Text.Lazy.Builder (Builder, singleton)
+
+import Prelude ()
+import Prelude.Compat hiding (Show)
+
+import Text.Show.Text.Classes (Show(showbPrec))
+
+-- | 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 = singleton '(' <> showbArgs (singleton ',') args <> singleton ')'
+{-# INLINE showbTuple #-}
src/Text/Show/Text/Data/Version.hs view
@@ -1,53 +1,52 @@-{-# 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)-import Data.Monoid.Compat ((<>))-import Data.Text.Lazy.Builder (Builder, fromString)-import Data.Version (Version(..))--import Prelude ()-import Prelude.Compat--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 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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' functions for 'Version'.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.Data.Version (
+      showbVersionPrec
+    , showbVersionConcrete
+    ) where
+
+import Data.List (intersperse)
+import Data.Monoid.Compat ((<>))
+import Data.Text.Lazy.Builder (Builder, fromString, singleton)
+import Data.Version (Version(..))
+
+import Prelude ()
+import Prelude.Compat
+
+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 (deriveShow)
+
+-- | 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 (singleton '.') $ map showb branch) <>
+        mconcat (map ((singleton '-' <>) . fromString) tags)
+{-# INLINE showbVersionConcrete #-}
+
+$(deriveShow ''Version)
src/Text/Show/Text/Data/Void.hs view
@@ -1,36 +1,31 @@-{-# 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 ()--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)+{-# 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:   Provisional
+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 ()
+
+import Text.Show.Text.Classes (Show(showb))
+
+-- | 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
+
+instance Show Void where
+    showb = showbVoid
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 (unless)--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-    unless (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-    unless (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:   Provisional
+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 (unless)
+
+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
+    unless (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
+    unless (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,51 +1,43 @@-{-# LANGUAGE CPP              #-}--#if __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE FlexibleContexts #-}-#endif-{-|-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@). This module only exports functions if the compiler supports-generics (on GHC, 7.2 or above).--/Since: 0.6/--}-module Text.Show.Text.Debug.Trace.Generic (-#if __GLASGOW_HASKELL__ < 702-    ) where-#else-      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-#endif+{-# 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:   Provisional
+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 Generics.Deriving.Base (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-mkTraceShowM name = [| traceM . $(mkShow name) |]+{-# 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:   Provisional
+Portability: GHC
+
+Functions that splice traces into source code which take an arbitrary data type or
+data family instance as an argument (even if it is not an instance 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/C/Types.hs view
@@ -1,479 +1,479 @@-{-# LANGUAGE CPP                        #-}-#if MIN_VERSION_base(4,5,0)-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-#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 Data.Int-import Data.Word--import Unsafe.Coerce (unsafeCoerce)--# include "HsBaseConfig.h"-# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_CHAR -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_SIGNED_CHAR -> Builder)-#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 = unsafeCoerce (showb :: HTYPE_UNSIGNED_CHAR -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_SHORT -> Builder)-#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 = unsafeCoerce (showb :: HTYPE_UNSIGNED_SHORT -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_INT -> Builder)-#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 = unsafeCoerce (showb :: HTYPE_UNSIGNED_INT -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_LONG -> Builder)-#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 = unsafeCoerce (showb :: HTYPE_UNSIGNED_LONG -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_PTRDIFF_T -> Builder)-#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 = unsafeCoerce (showb :: HTYPE_SIZE_T -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_WCHAR_T -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_SIG_ATOMIC_T -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_LONG_LONG -> Builder)-#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 = unsafeCoerce (showb :: HTYPE_UNSIGNED_LONG_LONG -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_INTPTR_T -> Builder)-#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 = unsafeCoerce (showb :: HTYPE_UINTPTR_T -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_INTMAX_T -> Builder)-#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 = unsafeCoerce (showb :: HTYPE_UINTMAX_T -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_CLOCK_T -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_TIME_T -> Builder)-#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 = unsafeCoerce (showb :: HTYPE_USECONDS_T -> Builder)-# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_SUSECONDS_T -> Builder)-# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_FLOAT -> Builder)-#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_DOUBLE -> Builder)-#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         #-}
+#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:   Provisional
+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 Data.Int
+import Data.Word
+
+import Unsafe.Coerce (unsafeCoerce)
+
+# include "HsBaseConfig.h"
+# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_CHAR -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_SIGNED_CHAR -> Builder)
+#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 = unsafeCoerce (showb :: HTYPE_UNSIGNED_CHAR -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_SHORT -> Builder)
+#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 = unsafeCoerce (showb :: HTYPE_UNSIGNED_SHORT -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_INT -> Builder)
+#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 = unsafeCoerce (showb :: HTYPE_UNSIGNED_INT -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_LONG -> Builder)
+#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 = unsafeCoerce (showb :: HTYPE_UNSIGNED_LONG -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_PTRDIFF_T -> Builder)
+#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 = unsafeCoerce (showb :: HTYPE_SIZE_T -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_WCHAR_T -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_SIG_ATOMIC_T -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_LONG_LONG -> Builder)
+#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 = unsafeCoerce (showb :: HTYPE_UNSIGNED_LONG_LONG -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_INTPTR_T -> Builder)
+#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 = unsafeCoerce (showb :: HTYPE_UINTPTR_T -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_INTMAX_T -> Builder)
+#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 = unsafeCoerce (showb :: HTYPE_UINTMAX_T -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_CLOCK_T -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_TIME_T -> Builder)
+#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 = unsafeCoerce (showb :: HTYPE_USECONDS_T -> Builder)
+# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_SUSECONDS_T -> Builder)
+# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_FLOAT -> Builder)
+#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 = unsafeCoerce (showbPrec :: Int -> HTYPE_DOUBLE -> Builder)
+#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,117 +1,117 @@-{-# 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.Monoid.Compat ((<>))-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:   Provisional
+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.Monoid.Compat ((<>))
+import Data.Semigroup (timesN)
+import Data.Text.Lazy.Builder (Builder, singleton)
+
+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(..))
+import Text.Show.Text.Data.Integral (showbHex, showbIntPrec, showbWord)
+import Text.Show.Text.Utils (lengthB)
+
+#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 = showb
+{-# INLINE showbPtr #-}
+
+-- | 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
+{-# 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
+{-# INLINE showbForeignPtr #-}
+
+instance Show (Ptr a) where
+    showbPrec = showbPrecWith undefined
+    INLINE_INST_FUN(showb)
+
+instance Show1 Ptr where
+    showbPrecWith _ _ (Ptr a) = padOut . showbHex $ wordToInteger (int2Word# (addr2Int# a))
+      where
+        padOut :: Builder -> Builder
+        padOut ls =
+             singleton '0' <> singleton 'x'
+          <> timesN (fromIntegral . max 0 $ 2*SIZEOF_HSPTR - lengthB ls) (singleton '0')
+          <> ls
+
+instance Show (FunPtr a) where
+    showbPrec = showbPrecWith undefined
+    INLINE_INST_FUN(showb)
+
+instance Show1 FunPtr where
+    showbPrecWith _ _ = showb . castFunPtrToPtr
+    INLINE_INST_FUN(showbPrecWith)
+
+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
+    showbPrec = showbPrecWith undefined
+    INLINE_INST_FUN(showb)
+
+instance Show1 ForeignPtr where
+    showbPrecWith _ _ = showb . unsafeForeignPtrToPtr
+    INLINE_INST_FUN(showbPrecWith)
src/Text/Show/Text/Functions.hs view
@@ -1,37 +1,41 @@-{-# 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 ()-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:   Provisional
+Portability: GHC
+
+Optional 'Show', 'Show1', and 'Show2' 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(..), Show2(..))
+
+#include "inline.h"
+
+-- | Convert a function to a 'Builder'.
+-- 
+-- /Since: 0.3/
+showbFunction :: (a -> b) -> Builder
+showbFunction = showb
+{-# INLINE showbFunction #-}
+
+instance Show (a -> b) where
+    showbPrec = showbPrecWith undefined
+    INLINE_INST_FUN(showb)
+
+instance Show1 ((->) a) where
+    showbPrecWith = showbPrecWith2 undefined
+    INLINE_INST_FUN(showbPrecWith)
+
+instance Show2 (->) where
+    showbPrecWith2 _ _ _ _ = "<function>"
+    INLINE_INST_FUN(showbPrecWith2)
src/Text/Show/Text/GHC/Conc/Windows.hs view
@@ -1,42 +1,42 @@-{-# LANGUAGE CPP             #-}--#if !defined(__GHCJS__) && defined(mingw32_HOST_OS)-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-#endif-{-|-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 only exports functions if using Windows, and not using GHCJS.--/Since: 0.5/--}-module Text.Show.Text.GHC.Conc.Windows (-#if defined(__GHCJS__) || !defined(mingw32_HOST_OS)-    ) 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__) && defined(mingw32_HOST_OS)
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+#endif
+{-|
+Module:      Text.Show.Text.GHC.Conc.Windows
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'ConsoleEvent'.
+This module only exports functions if using Windows, and not using GHCJS.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.GHC.Conc.Windows (
+#if defined(__GHCJS__) || !defined(mingw32_HOST_OS)
+    ) 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 (deriveShow)
+
+-- | Convert a 'ConsoleEvent' to a 'Builder'.
+--
+-- /Since: 0.5/
+showbConsoleEvent :: ConsoleEvent -> Builder
+showbConsoleEvent = showb
+{-# INLINE showbConsoleEvent #-}
+
+$(deriveShow ''ConsoleEvent)
+#endif
src/Text/Show/Text/GHC/Event.hs view
@@ -1,58 +1,58 @@-{-# LANGUAGE CPP #-}--#if !defined(__GHCJS__) && !defined(mingw32_HOST_OS) && MIN_VERSION_base(4,4,0)-{-# OPTIONS_GHC -fno-warn-orphans #-}-#endif-{-|-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 only exports functions if using @base-4.4.0.0@ on a platform other-than Windows or GHCJS.--/Since: 0.3/--}-module Text.Show.Text.GHC.Event (-#if defined(__GHCJS__) || defined(mingw32_HOST_OS) || !(MIN_VERSION_base(4,4,0))-    ) 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 #-}
+
+#if !defined(__GHCJS__) && !defined(mingw32_HOST_OS) && MIN_VERSION_base(4,4,0)
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+#endif
+{-|
+Module:      Text.Show.Text.GHC.Event
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the @Event@ module.
+This module only exports functions if using @base-4.4.0.0@ on a platform other
+than Windows or GHCJS.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.GHC.Event (
+#if defined(__GHCJS__) || defined(mingw32_HOST_OS) || !(MIN_VERSION_base(4,4,0))
+    ) 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,53 +1,53 @@-{-# LANGUAGE CPP #-}--#if MIN_VERSION_base(4,4,0)-{-# OPTIONS_GHC -fno-warn-orphans #-}-#endif-{-|-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 only exports functions if using @base-4.4.0.0@ or later.--/Since: 0.5/--}-module Text.Show.Text.GHC.Fingerprint (-#if !(MIN_VERSION_base(4,4,0))-    ) where-#else-      showbFingerprint-    ) where--import Data.Monoid.Compat ((<>))-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 #-}-#endif+{-# LANGUAGE CPP #-}
+
+#if MIN_VERSION_base(4,4,0)
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+#endif
+{-|
+Module:      Text.Show.Text.GHC.Fingerprint
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'Fingerprint' values.
+This module only exports functions if using @base-4.4.0.0@ or later.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.GHC.Fingerprint (
+#if !(MIN_VERSION_base(4,4,0))
+    ) where
+#else
+      showbFingerprint
+    ) where
+
+import Data.Monoid.Compat ((<>))
+import Data.Semigroup (timesN)
+import Data.Text.Lazy.Builder (Builder, singleton)
+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)
+
+-- | 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) (singleton '0') <> hex
+
+instance Show Fingerprint where
+    showb = showbFingerprint
+    {-# INLINE showb #-}
+#endif
src/Text/Show/Text/GHC/Generics.hs view
@@ -1,197 +1,201 @@-{-# LANGUAGE CPP              #-}--#if __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE TemplateHaskell  #-}-{-# LANGUAGE TypeOperators    #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-#endif-{-|-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 only exports functions if the compiler supports generics-(on GHC, 7.2 or above).--/Since: 0.3/--}-module Text.Show.Text.GHC.Generics (-#if __GLASGOW_HASKELL__ < 702-    ) where-#else-      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)--# include "inline.h"---- | 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_INST_FUN(showb)--instance Show1 U1 where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(showbPrec1)--$(deriveShowPragmas defaultInlineShowbPrec ''Par1)--instance Show1 Par1 where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(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_INST_FUN(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_INST_FUN(showbPrec)---- TODO: Derive with TH once it can detect phantom types properly-instance Show c => Show1 (K1 i c) where-    showbPrec1 = showbPrec-    INLINE_INST_FUN(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_INST_FUN(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_INST_FUN(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_INST_FUN(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_INST_FUN(showbPrec)--$(deriveShowPragmas defaultInlineShowbPrec ''Fixity)-$(deriveShowPragmas defaultInlineShowb     ''Associativity)-$(deriveShowPragmas defaultInlineShowbPrec ''Arity)-#endif+{-# 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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' functions for generics-related data types.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.GHC.Generics (
+      showbU1
+    , showbPar1PrecWith
+    , showbRec1Prec
+    , showbRec1PrecWith
+    , showbK1PrecWith
+    , showbM1Prec
+    , showbM1PrecWith
+    , showbSumTypePrec
+    , showbSumTypePrecWith
+    , showbProductTypePrec
+    , showbProductTypePrecWith
+    , showbCompFunctorsPrec
+    , showbCompFunctorsPrecWith
+    , showbFixityPrec
+    , showbAssociativity
+    , showbArityPrec
+    ) where
+
+import Data.Text.Lazy.Builder (Builder)
+
+import Generics.Deriving.Base (U1(..), Par1, Rec1(..), K1(..),
+                               M1(..), (:+:)(..), (:*:)(..), (:.:)(..),
+                               Fixity, Associativity, Arity)
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), Show1(..), Show2(..))
+import Text.Show.Text.Data.Integral ()
+import Text.Show.Text.TH.Internal (deriveShow, deriveShow1, mkShowbPrec,
+                                   mkShowbPrecWith, mkShowbPrecWith2)
+
+-- | Convert a 'U1' value to a 'Builder'.
+--
+-- /Since: 0.3/
+showbU1 :: U1 p -> Builder
+showbU1 = showb
+{-# INLINE showbU1 #-}
+
+-- | Convert a 'Par1' value to a 'Builder' with the given show function and precedence.
+--
+-- /Since: 1/
+showbPar1PrecWith :: (Int -> p -> Builder) -> Int -> Par1 p -> Builder
+showbPar1PrecWith = showbPrecWith
+{-# INLINE showbPar1PrecWith #-}
+
+-- | Convert a 'Rec1' value to a 'Builder' with the given precedence.
+--
+-- /Since: 0.3/
+showbRec1Prec :: Show (f p) => Int -> Rec1 f p -> Builder
+showbRec1Prec = showbPrec
+{-# INLINE showbRec1Prec #-}
+
+-- | Convert a 'Rec1' value to a 'Builder' with the given show function and precedence.
+--
+-- /Since: 1/
+showbRec1PrecWith :: Show1 f => (Int -> p -> Builder) -> Int -> Rec1 f p -> Builder
+showbRec1PrecWith = showbPrecWith
+{-# INLINE showbRec1PrecWith #-}
+
+-- | Convert a 'K1' value to a 'Builder' with the given show function and precedence.
+--
+-- /Since: 1/
+showbK1PrecWith :: (Int -> c -> Builder) -> Int -> K1 i c p -> Builder
+showbK1PrecWith sp = showbPrecWith2 sp undefined
+{-# INLINE showbK1PrecWith #-}
+
+-- | Convert an 'M1' value to a 'Builder' with the given precedence.
+--
+-- /Since: 0.3/
+showbM1Prec :: Show (f p) => Int -> M1 i c f p -> Builder
+showbM1Prec = showbPrec
+{-# INLINE showbM1Prec #-}
+
+-- | Convert an 'M1' value to a 'Builder' with the given show function and precedence.
+--
+-- /Since: 1/
+showbM1PrecWith :: Show1 f => (Int -> p -> Builder) -> Int -> M1 i c f p -> Builder
+showbM1PrecWith = showbPrecWith
+{-# INLINE showbM1PrecWith #-}
+
+-- | Convert a '(:+:)' value to a 'Builder' with the given precedence.
+--
+-- /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 show function and precedence.
+--
+-- /Since: 1/
+showbSumTypePrecWith :: (Show1 f, Show1 g) => (Int -> p -> Builder) -> Int -> (f :+: g) p -> Builder
+showbSumTypePrecWith = showbPrecWith
+{-# INLINE showbSumTypePrecWith #-}
+
+-- | Convert a '(:*:)' value to a 'Builder' with the given precedence.
+--
+-- /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 show function and precedence.
+--
+-- /Since: 1/
+showbProductTypePrecWith :: (Show1 f, Show1 g) => (Int -> p -> Builder) -> Int -> (f :*: g) p -> Builder
+showbProductTypePrecWith = showbPrecWith
+{-# INLINE showbProductTypePrecWith #-}
+
+-- | Convert a '(:.:)' value to a 'Builder' with the given precedence.
+--
+-- /Since: 0.3/
+showbCompFunctorsPrec :: Show (f (g p)) => Int -> (f :.: g) p -> Builder
+showbCompFunctorsPrec = showbPrec
+{-# INLINE showbCompFunctorsPrec #-}
+
+-- | Convert a '(:.:)' value to a 'Builder' with the given show function and precedence.
+-- This function is only available with @base-4.4.0.0@ or later.
+--
+-- /Since: 1/
+showbCompFunctorsPrecWith :: (Show1 f, Show1 g) => (Int -> p -> Builder) -> Int -> (f :.: g) p -> Builder
+showbCompFunctorsPrecWith = showbPrecWith
+{-# INLINE showbCompFunctorsPrecWith #-}
+
+-- | Convert a 'Fixity' value to a 'Builder' with the given precedence.
+--
+-- /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.
+--
+-- /Since: 0.3/
+showbArityPrec :: Int -> Arity -> Builder
+showbArityPrec = showbPrec
+{-# INLINE showbArityPrec #-}
+
+instance Show (U1 p) where
+    showbPrec = showbPrecWith undefined
+$(deriveShow1 ''U1)
+
+$(deriveShow  ''Par1)
+$(deriveShow1 ''Par1)
+
+instance Show (f p) => Show (Rec1 f p) where
+    showbPrec = $(mkShowbPrec ''Rec1)
+$(deriveShow1 ''Rec1)
+
+instance Show c => Show (K1 i c p) where
+    showbPrec = showbPrecWith undefined
+instance Show c => Show1 (K1 i c) where
+    showbPrecWith = showbPrecWith2 showbPrec
+instance Show2 (K1 i) where
+    showbPrecWith2 = $(mkShowbPrecWith2 ''K1)
+
+instance Show (f p) => Show (M1 i c f p) where
+    showbPrec = $(mkShowbPrec ''M1)
+instance Show1 f => Show1 (M1 i c f) where
+    showbPrecWith = $(mkShowbPrecWith ''M1)
+
+instance (Show (f p), Show (g p)) => Show ((f :+: g) p) where
+    showbPrec = $(mkShowbPrec ''(:+:))
+$(deriveShow1 ''(:+:))
+
+instance (Show (f p), Show (g p)) => Show ((f :*: g) p) where
+    showbPrec = $(mkShowbPrec ''(:*:))
+$(deriveShow1 ''(:*:))
+
+instance Show (f (g p)) => Show ((f :.: g) p) where
+    showbPrec = $(mkShowbPrec ''(:.:))
+$(deriveShow1 ''(:.:))
+
+$(deriveShow ''Fixity)
+$(deriveShow ''Associativity)
+$(deriveShow ''Arity)
src/Text/Show/Text/GHC/RTS/Flags.hs view
@@ -1,268 +1,267 @@-{-# LANGUAGE CPP               #-}--#if MIN_VERSION_base(4,8,0)-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell   #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-#endif-{-|-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 only exports functions if using @base-4.8.0.0@ or later.--/Since: 0.5/--}-module Text.Show.Text.GHC.RTS.Flags (-#if !(MIN_VERSION_base(4,8,0))-    ) where-#else-      showbRTSFlagsPrec-    , showbGCFlagsPrec-    , showbConcFlagsPrec-    , showbMiscFlagsPrec-    , showbDebugFlagsPrec-    , showbCCFlagsPrec-    , showbProfFlagsPrec-    , showbTraceFlagsPrec-    , showbTickyFlagsPrec-    ) where--import Data.Monoid.Compat ((<>))-import Data.Text.Lazy.Builder (Builder)--import GHC.RTS.Flags--import Prelude hiding (Show)--import Text.Show.Text.Classes (Show(showb, showbPrec), 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)--# if __GLASGOW_HASKELL__ < 711-import GHC.Show (appPrec)-import Text.Show.Text.Classes (showbParen)-# endif---- | 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-# if __GLASGOW_HASKELL__ >= 711-showbGCFlagsPrec _ gcfs =-# else-showbGCFlagsPrec p gcfs = showbParen (p > appPrec) $-# endif-       "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-# if __GLASGOW_HASKELL__ >= 711-showbCCFlagsPrec _ ccfs =-# else-showbCCFlagsPrec p ccfs = showbParen (p > appPrec) $-# endif-       "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-# if __GLASGOW_HASKELL__ >= 711-showbProfFlagsPrec _ pfs =-# else-showbProfFlagsPrec p pfs = showbParen (p > appPrec) $-# endif-       "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-# if __GLASGOW_HASKELL__ >= 711-showbTraceFlagsPrec _ tfs =-# else-showbTraceFlagsPrec p tfs = showbParen (p > appPrec) $-# endif-       "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)-#endif+{-# LANGUAGE CPP               #-}
+
+#if MIN_VERSION_base(4,8,0)
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell   #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+#endif
+{-|
+Module:      Text.Show.Text.GHC.RTS.Flags
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the 'GHC.RTS.Flags' module.
+This module only exports functions if using @base-4.8.0.0@ or later.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.GHC.RTS.Flags (
+#if !(MIN_VERSION_base(4,8,0))
+    ) where
+#else
+      showbRTSFlagsPrec
+    , showbGCFlagsPrec
+    , showbConcFlagsPrec
+    , showbMiscFlagsPrec
+    , showbDebugFlagsPrec
+    , showbCCFlagsPrec
+    , showbProfFlagsPrec
+    , showbTraceFlagsPrec
+    , showbTickyFlagsPrec
+    ) where
+
+import Data.Monoid.Compat ((<>))
+import Data.Text.Lazy.Builder (Builder, singleton)
+
+import GHC.RTS.Flags
+
+import Prelude hiding (Show)
+
+import Text.Show.Text.Classes (Show(showb, showbPrec), 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 (showbMaybePrecWith)
+import Text.Show.Text.TH.Internal (deriveShow)
+
+# if __GLASGOW_HASKELL__ < 711
+import GHC.Show (appPrec)
+import Text.Show.Text.Classes (showbParen)
+# endif
+
+-- | 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
+# if __GLASGOW_HASKELL__ >= 711
+showbGCFlagsPrec _ gcfs =
+# else
+showbGCFlagsPrec p gcfs = showbParen (p > appPrec) $
+# endif
+       "GCFlags {statsFile = "
+    <> showbMaybePrecWith showbPrec 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)
+    <> singleton '}'
+
+-- | 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
+# if __GLASGOW_HASKELL__ >= 711
+showbCCFlagsPrec _ ccfs =
+# else
+showbCCFlagsPrec p ccfs = showbParen (p > appPrec) $
+# endif
+       "CCFlags {doCostCentres = "
+    <> showb (FromStringShow $ doCostCentres ccfs)
+    <> ", profilerTicks = "
+    <> showbIntPrec 0 (profilerTicks ccfs)
+    <> ", msecsPerTick = "
+    <> showbIntPrec 0 (msecsPerTick ccfs)
+    <> singleton '}'
+
+-- | 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
+# if __GLASGOW_HASKELL__ >= 711
+showbProfFlagsPrec _ pfs =
+# else
+showbProfFlagsPrec p pfs = showbParen (p > appPrec) $
+# endif
+       "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 = "
+    <> showbMaybePrecWith showbPrec 0 (modSelector pfs)
+    <> ", descrSelector = "
+    <> showbMaybePrecWith showbPrec 0 (descrSelector pfs)
+    <> ", typeSelector = "
+    <> showbMaybePrecWith showbPrec 0 (typeSelector pfs)
+    <> ", ccSelector = "
+    <> showbMaybePrecWith showbPrec 0 (ccSelector pfs)
+    <> ", ccsSelector = "
+    <> showbMaybePrecWith showbPrec 0 (ccsSelector pfs)
+    <> ", retainerSelector = "
+    <> showbMaybePrecWith showbPrec 0 (retainerSelector pfs)
+    <> ", bioSelector = "
+    <> showbMaybePrecWith showbPrec 0 (bioSelector pfs)
+    <> singleton '}'
+
+-- | 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
+# if __GLASGOW_HASKELL__ >= 711
+showbTraceFlagsPrec _ tfs =
+# else
+showbTraceFlagsPrec p tfs = showbParen (p > appPrec) $
+# endif
+       "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)
+    <> singleton '}'
+
+-- | 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)
+#endif
src/Text/Show/Text/GHC/StaticPtr.hs view
@@ -1,47 +1,47 @@-{-# LANGUAGE CPP             #-}--#if MIN_VERSION_base(4,8,0)-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-#endif-{-|-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 only exports functions if using @base-4.8.0.0@ or later.--/Since: 0.5/--}-module Text.Show.Text.GHC.StaticPtr (-#if !(MIN_VERSION_base(4,8,0))-    ) where-#else-      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)-#endif+{-# LANGUAGE CPP             #-}
+
+#if MIN_VERSION_base(4,8,0)
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+#endif
+{-|
+Module:      Text.Show.Text.GHC.StaticPtr
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'StaticPtrInfo' values.
+This module only exports functions if using @base-4.8.0.0@ or later.
+
+/Since: 0.5/
+-}
+module Text.Show.Text.GHC.StaticPtr (
+#if !(MIN_VERSION_base(4,8,0))
+    ) where
+#else
+      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)
+#endif
src/Text/Show/Text/GHC/Stats.hs view
@@ -1,45 +1,45 @@-{-# LANGUAGE CPP             #-}--#if MIN_VERSION_base(4,5,0)-{-# LANGUAGE TemplateHaskell #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}-#endif-{-|-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 only exports functions if using @base-4.5.0.0@ or later.--/Since: 0.3/--}-module Text.Show.Text.GHC.Stats (-#if !(MIN_VERSION_base(4,5,0))-    ) where-#else-      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)-#endif+{-# LANGUAGE CPP             #-}
+
+#if MIN_VERSION_base(4,5,0)
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+#endif
+{-|
+Module:      Text.Show.Text.GHC.Stats
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'GCStats'.
+This module only exports functions if using @base-4.5.0.0@ or later.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.GHC.Stats (
+#if !(MIN_VERSION_base(4,5,0))
+    ) where
+#else
+      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)
+#endif
src/Text/Show/Text/GHC/TypeLits.hs view
@@ -1,125 +1,125 @@-{-# LANGUAGE CPP                  #-}--#if MIN_VERSION_base(4,6,0)-# 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 #-}-#endif-{-|-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 only exports functions if using @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-    ) where-#elif MIN_VERSION_base(4,6,0)-      showbIsEven-    , showbIsZero-    , showbSingPrec-    ) where-#else-    ) where-#endif--#if MIN_VERSION_base(4,6,0)--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 Data.Monoid.Compat ((<>))-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 #-}---- | Convert a 'Sing' value to a 'Builder' with the given precedence.--- --- /Since: 0.8/-showbSingPrec :: (SingE (Kind :: k) rep, Show rep) => Int -> Sing (a :: k) -> Builder-showbSingPrec p = showbPrec p . fromSing-{-# INLINE showbSingPrec #-}-# 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 = showbSingPrec-    {-# INLINE showbPrec #-}-# endif--#endif+{-# LANGUAGE CPP                  #-}
+
+#if MIN_VERSION_base(4,6,0)
+# 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 #-}
+#endif
+{-|
+Module:      Text.Show.Text.GHC.TypeLits
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' functions for data types in the @GHC.TypeLits@ module.
+This module only exports functions if using @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
+    ) where
+#elif MIN_VERSION_base(4,6,0)
+      showbIsEven
+    , showbIsZero
+    , showbSingPrec
+    ) where
+#else
+    ) where
+#endif
+
+#if MIN_VERSION_base(4,6,0)
+
+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 Data.Monoid.Compat ((<>))
+import Data.Text.Lazy.Builder (singleton)
+import GHC.TypeLits (IsEven(..), IsZero(..), Kind, Sing, SingE(fromSing))
+import Text.Show.Text.Data.Integral ()
+# 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 = singleton '0'
+showbIsEven (IsEven x) = "(2 * " <> showb x <> singleton ')'
+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     = singleton '0'
+showbIsZero (IsSucc n) = singleton '(' <> showb n <> " + 1)"
+{-# INLINE showbIsZero #-}
+
+-- | Convert a 'Sing' value to a 'Builder' with the given precedence.
+--
+-- /Since: 0.8/
+showbSingPrec :: (SingE (Kind :: k) rep, Show rep) => Int -> Sing (a :: k) -> Builder
+showbSingPrec p = showbPrec p . fromSing
+{-# INLINE showbSingPrec #-}
+# 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 = showbSingPrec
+    {-# INLINE showbPrec #-}
+# endif
+
+#endif
src/Text/Show/Text/Generic.hs view
@@ -1,343 +1,446 @@-{-# LANGUAGE CPP                 #-}--#if __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE DeriveDataTypeable  #-}-{-# LANGUAGE DeriveGeneric       #-}-{-# LANGUAGE FlexibleContexts    #-}-{-# LANGUAGE FlexibleInstances   #-}-{-# LANGUAGE OverloadedStrings   #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TypeOperators       #-}-#endif--#if __GLASGOW_HASKELL__ >= 706-{-# LANGUAGE PolyKinds           #-}-#endif--#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 only exports functions 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 (-#if __GLASGOW_HASKELL__ < 702-    ) where-#else-      -- * 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--import           Data.Monoid.Compat ((<>))-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 ()-import           Prelude.Compat 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 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-    {-# MINIMAL gShowbPrec #-}--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 __GLASGOW_HASKELL__ >= 711-                                        || conIsRecord c-# endif-                                      )-                             ) $-               (if conIsTuple c-                   then mempty-                   else let cn = conName c-                        in showbParen (isInfixTypeCon cn) $ fromString cn-               )-            <> (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-#endif+{-# LANGUAGE CPP                  #-}
+{-# LANGUAGE DeriveDataTypeable   #-}
+{-# LANGUAGE FlexibleContexts     #-}
+{-# LANGUAGE FlexibleInstances    #-}
+{-# LANGUAGE OverloadedStrings    #-}
+{-# LANGUAGE ScopedTypeVariables  #-}
+{-# LANGUAGE TypeOperators        #-}
+
+#if __GLASGOW_HASKELL__ >= 702
+{-# LANGUAGE DeriveGeneric        #-}
+#else
+{-# LANGUAGE TemplateHaskell      #-}
+{-# LANGUAGE TypeFamilies         #-}
+{-# LANGUAGE TypeSynonymInstances #-}
+#endif
+
+#if __GLASGOW_HASKELL__ >= 706
+{-# LANGUAGE PolyKinds            #-}
+#endif
+
+#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:   Provisional
+Portability: GHC
+
+Generic versions of 'Show' and 'Show1' class functions, as an alternative to
+"Text.Show.Text.TH", which uses Template Haskell. Because there is no 'Generic2'
+class, 'T.Show2' cannot be implemented generically.
+
+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
+    , genericShowbPrecWith
+    , genericShowbPrec1
+      -- * The 'GShow' and 'GShow1' classes
+    , GShow(..)
+    , GShow1(..)
+    , ConType(..)
+    ) where
+
+import           Data.Monoid.Compat ((<>))
+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, singleton, toLazyText)
+import qualified Data.Text.Lazy    as TL (Text)
+import qualified Data.Text.Lazy.IO as TL (putStrLn, hPutStrLn)
+import           Data.Typeable (Typeable)
+
+import           Generics.Deriving.Base
+#if __GLASGOW_HASKELL__ < 702
+import qualified Generics.Deriving.TH as Generics (deriveAll)
+#endif
+import           GHC.Show (appPrec, appPrec1)
+
+import           Prelude ()
+import           Prelude.Compat 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), Show1(..),
+                                         showbListWith, showbParen, showbSpace)
+import           Text.Show.Text.Instances ()
+import           Text.Show.Text.Utils (isInfixTypeCon, isTupleString)
+
+#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 GHC.Generics
+import Text.Show.Text
+import Text.Show.Generic
+
+data D a = D a
+  deriving (Generic, Generic1)
+
+instance Show a => Show (D a) where
+    showbPrec = 'genericShowbPrec'
+
+instance Show1 D where
+    showbPrecWith = 'genericShowbPrecWith'
+@
+-}
+
+{- $generic_err
+
+Suppose you intend to use 'genericShowbPrec' to define a 'T.Show' instance.
+
+@
+data Oops1 = Oops1
+    -- forgot to add \"deriving Generic\" here!
+
+instance Show Oops1 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 Oops1))
+@
+
+This error can be confusing, but don't let it intimidate you. The correct fix is
+simply to add the missing \"@deriving 'Generic'@\" clause.
+
+Similarly, if the compiler complains about not having an instance for @('GShow1'
+(Rep1 Oops2))@, add a \"@deriving 'Generic1'@\" 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
+
+-- | A 'Generic1' implementation of 'showbPrecWith'.
+--
+-- /Since: 1/
+genericShowbPrecWith :: (Generic1 f, GShow1 (Rep1 f))
+                     => (Int -> a -> Builder) -> Int -> f a -> Builder
+genericShowbPrecWith sp p = gShowbPrecWith Pref sp p . from1
+
+-- | A 'Generic'/'Generic1' implementation of 'showbPrec1'.
+--
+-- /Since: 1/
+genericShowbPrec1 :: (Generic a, Generic1 f, GShow (Rep a), GShow1 (Rep1 f))
+                  => Int -> f a -> Builder
+genericShowbPrec1 = genericShowbPrecWith genericShowbPrec
+
+-------------------------------------------------------------------------------
+
+-- | 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 String
+  deriving ( Eq
+           , Ord
+           , Read
+           , S.Show
+           , Typeable
+#if __GLASGOW_HASKELL__ >= 702
+           , Generic
+#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 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 showbPrec (isNullary): unnecessary case"
+#if __GLASGOW_HASKELL__ >= 708
+    {-# MINIMAL gShowbPrec #-}
+
+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 f) => GShow (C1 c f) where
+    gShowbPrec = gShowbConstructor gShowbPrec isNullary
+
+instance (Selector s, GShow f) => GShow (S1 s f) where
+    gShowbPrec = gShowbSelector gShowbPrec
+    isNullary (M1 x) = isNullary x
+
+instance GShow f => GShow (D1 d f) where
+    gShowbPrec t n (M1 x) = gShowbPrec t n x
+
+instance (GShow f, GShow g) => GShow (f :+: g) where
+    gShowbPrec t n (L1 x) = gShowbPrec t n x
+    gShowbPrec t n (R1 x) = gShowbPrec t n x
+
+instance (GShow f, GShow g) => GShow (f :*: g) where
+    gShowbPrec = gShowbProduct gShowbPrec gShowbPrec
+    -- If we have a product then it is not a nullary constructor
+    isNullary _ = False
+
+-------------------------------------------------------------------------------
+
+-- | Class of generic representation types ('Rep1') that can be converted to
+-- a 'Builder' by lifting through a unary type constructor.
+--
+-- /Since: 1/
+class GShow1 f where
+    -- | This is used as the default generic implementation of 'showbPrecWith'.
+    gShowbPrecWith :: ConType -> (Int -> a -> Builder) -> Int -> f a -> Builder
+    -- | Whether a representation type has any constructors.
+    isNullary1 :: f a -> Bool
+    isNullary1 = error "generic showbPrecWith (isNullary1): unnecessary case"
+#if __GLASGOW_HASKELL__ >= 708
+    {-# MINIMAL gShowbPrecWith #-}
+
+deriving instance Typeable GShow1
+#endif
+
+instance GShow1 U1 where
+    gShowbPrecWith _ _ _ U1 = mempty
+    isNullary1 _ = True
+
+instance GShow1 Par1 where
+    gShowbPrecWith _ sp n (Par1 p) = sp n p
+    isNullary1 _ = False
+
+instance T.Show c => GShow1 (K1 i c) where
+    gShowbPrecWith _ _ n (K1 a) = showbPrec n a
+    isNullary1 _ = False
+
+instance Show1 f => GShow1 (Rec1 f) where
+    gShowbPrecWith _ sp n (Rec1 r) = showbPrecWith sp n r
+    isNullary1 _ = False
+
+instance (Constructor c, GShow1 f) => GShow1 (C1 c f) where
+    gShowbPrecWith t sp = gShowbConstructor (flip gShowbPrecWith sp) isNullary1 t
+
+instance (Selector s, GShow1 f) => GShow1 (S1 s f) where
+    gShowbPrecWith t sp = gShowbSelector (flip gShowbPrecWith sp) t
+    isNullary1 (M1 x) = isNullary1 x
+
+instance GShow1 f => GShow1 (D1 d f) where
+    gShowbPrecWith t sp n (M1 x) = gShowbPrecWith t sp n x
+
+instance (GShow1 f, GShow1 g) => GShow1 (f :+: g) where
+    gShowbPrecWith t sp n (L1 x) = gShowbPrecWith t sp n x
+    gShowbPrecWith t sp n (R1 x) = gShowbPrecWith t sp n x
+
+instance (GShow1 f, GShow1 g) => GShow1 (f :*: g) where
+    gShowbPrecWith t sp = gShowbProduct (flip gShowbPrecWith sp) (flip gShowbPrecWith sp) t
+    -- If we have a product then it is not a nullary constructor
+    isNullary1 _ = False
+
+instance (Show1 f, GShow1 g) => GShow1 (f :.: g) where
+    gShowbPrecWith t sp n (Comp1 c) = showbPrecWith (gShowbPrecWith t sp) n c
+    isNullary1 _ = False
+
+-------------------------------------------------------------------------------
+-- Shared code between GShow and GShow1
+-------------------------------------------------------------------------------
+
+gShowbConstructor :: forall c f p. Constructor c
+                  => (ConType -> Int -> f p -> Builder)
+                  -> (f p -> Bool)
+                  -> ConType -> Int -> C1 c f p -> Builder
+gShowbConstructor gs isNull _ n c@(M1 x) = case fixity of
+    Prefix -> showbParen ( n > appPrec
+                           && not ( isNull x
+                                    || conIsTuple c
+#if __GLASGOW_HASKELL__ >= 711
+                                    || conIsRecord c
+#endif
+                                  )
+                         ) $
+           (if conIsTuple c
+               then mempty
+               else let cn = conName c
+                    in showbParen (isInfixTypeCon cn) $ fromString cn
+           )
+        <> (if isNull x || conIsTuple c
+               then mempty
+               else singleton ' '
+           )
+        <> showbBraces t (gs t appPrec1 x)
+    Infix _ m -> showbParen (n > m) . showbBraces t $ gs 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 $ conName c
+
+    showbBraces :: ConType -> Builder -> Builder
+    showbBraces Rec     b = singleton '{' <> b <> singleton '}'
+    showbBraces Tup     b = singleton '(' <> b <> singleton ')'
+    showbBraces Pref    b = b
+    showbBraces (Inf _) b = b
+
+    conIsTuple :: C1 c f p -> Bool
+    conIsTuple = isTupleString . conName
+
+gShowbSelector :: Selector s
+               => (ConType -> Int -> f p -> Builder)
+               -> ConType -> Int -> S1 s f p -> Builder
+gShowbSelector gs t n sel@(M1 x)
+    | selName sel == "" = gs t n x
+    | otherwise         = fromString (selName sel) <> " = " <> gs t 0 x
+
+gShowbProduct :: (ConType -> Int -> f p -> Builder)
+              -> (ConType -> Int -> g p -> Builder)
+              -> ConType -> Int -> ((f :*: g) p) -> Builder
+gShowbProduct gsa gsb t@Rec _ (a :*: b) =
+       gsa t 0 a
+    <> ", "
+    <> gsb t 0 b
+gShowbProduct gsa gsb t@(Inf o) n (a :*: b) =
+       gsa t n a
+    <> showbSpace
+    <> infixOp
+    <> showbSpace
+    <> gsb t n b
+  where
+    infixOp :: Builder
+    infixOp = if isInfixTypeCon o
+                 then fromString o
+                 else singleton '`' <> fromString o <> singleton '`'
+gShowbProduct gsa gsb t@Tup _ (a :*: b) =
+       gsa t 0 a
+    <> singleton ','
+    <> gsb t 0 b
+gShowbProduct gsa gsb t@Pref n (a :*: b) =
+       gsa t n a
+    <> showbSpace
+    <> gsb t n b
+
+-------------------------------------------------------------------------------
+
+#if __GLASGOW_HASKELL__ < 702
+$(Generics.deriveAll ''ConType)
+#endif
src/Text/Show/Text/Instances.hs view
@@ -1,64 +1,65 @@-{-|-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 all orphan 'Show' instance covered by @text-show@ (except for the instance-in `Text.Show.Text.Functions`, which is not imported by default).--}-module Text.Show.Text.Instances () 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      ()--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           ()-import Text.Show.Text.Data.OldTypeable      ()-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            ()-import Text.Show.Text.Data.Type.Coercion    ()-import Text.Show.Text.Data.Type.Equality    ()-import Text.Show.Text.Data.Typeable         ()-import Text.Show.Text.Data.Version          ()-import Text.Show.Text.Data.Void             ()--import Text.Show.Text.Foreign.C.Types       ()-import Text.Show.Text.Foreign.Ptr           ()--import Text.Show.Text.GHC.Conc.Windows      ()-import Text.Show.Text.GHC.Event             ()-import Text.Show.Text.GHC.Fingerprint       ()-import Text.Show.Text.GHC.Generics          ()-import Text.Show.Text.GHC.RTS.Flags         ()-import Text.Show.Text.GHC.StaticPtr         ()-import Text.Show.Text.GHC.Stats             ()-import Text.Show.Text.GHC.TypeLits          ()--import Text.Show.Text.Numeric.Natural       ()--import Text.Show.Text.System.Exit           ()-import Text.Show.Text.System.IO             ()-import Text.Show.Text.System.Posix.Types    ()--import Text.Show.Text.Text.Read             ()+{-|
+Module:      Text.Show.Text.Instances
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Imports all orphan 'Show', 'Show1', and 'Show2' instances covered by @text-show@
+(except for the instances in `Text.Show.Text.Functions`, which are not imported
+by default).
+-}
+module Text.Show.Text.Instances () 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      ()
+
+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           ()
+import Text.Show.Text.Data.OldTypeable      ()
+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            ()
+import Text.Show.Text.Data.Type.Coercion    ()
+import Text.Show.Text.Data.Type.Equality    ()
+import Text.Show.Text.Data.Typeable         ()
+import Text.Show.Text.Data.Version          ()
+import Text.Show.Text.Data.Void             ()
+
+import Text.Show.Text.Foreign.C.Types       ()
+import Text.Show.Text.Foreign.Ptr           ()
+
+import Text.Show.Text.GHC.Conc.Windows      ()
+import Text.Show.Text.GHC.Event             ()
+import Text.Show.Text.GHC.Fingerprint       ()
+import Text.Show.Text.GHC.Generics          ()
+import Text.Show.Text.GHC.RTS.Flags         ()
+import Text.Show.Text.GHC.StaticPtr         ()
+import Text.Show.Text.GHC.Stats             ()
+import Text.Show.Text.GHC.TypeLits          ()
+
+import Text.Show.Text.Numeric.Natural       ()
+
+import Text.Show.Text.System.Exit           ()
+import Text.Show.Text.System.IO             ()
+import Text.Show.Text.System.Posix.Types    ()
+
+import Text.Show.Text.Text.Read             ()
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:   Provisional
+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/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 #-}--$(deriveShowPragmas defaultInlineShowbPrec ''ExitCode)+{-# 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:   Provisional
+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 (deriveShow)
+
+-- | Convert an 'ExitCode' to a 'Builder' with the given precedence.
+--
+-- /Since: 0.3/
+showbExitCodePrec :: Int -> ExitCode -> Builder
+showbExitCodePrec = showbPrec
+{-# INLINE showbExitCodePrec #-}
+
+$(deriveShow ''ExitCode)
src/Text/Show/Text/System/IO.hs view
@@ -1,160 +1,158 @@-{-# 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-    , showbTextEncoding-#if MIN_VERSION_base(4,4,0)-    , showbCodingProgress-    , showbCodingFailureMode-#endif-    , showbNewline-    , showbNewlineModePrec-    ) where--import Data.Monoid.Compat ((<>))-import Data.Text.Lazy.Builder (Builder, fromString)--import GHC.IO.Encoding.Types (TextEncoding(textEncodingName))-#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)--#include "inline.h"---- | 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 #-}---- | Convert a 'TextEncoding' to a 'Builder'.--- --- /Since: 0.3/-showbTextEncoding :: TextEncoding -> Builder-showbTextEncoding = fromString . textEncodingName-{-# INLINE showbTextEncoding #-}--#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)--instance Show TextEncoding where-    showb = showbTextEncoding-    INLINE_INST_FUN(showb)--#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:   Provisional
+Portability: GHC
+
+Monomorphic 'Show' function for 'IO'-related data types.
+
+/Since: 0.3/
+-}
+module Text.Show.Text.System.IO (
+      showbHandle
+    , showbIOMode
+    , showbBufferModePrec
+    , showbHandlePosn
+    , showbSeekMode
+    , showbTextEncoding
+#if MIN_VERSION_base(4,4,0)
+    , showbCodingProgress
+    , showbCodingFailureMode
+#endif
+    , showbNewline
+    , showbNewlineModePrec
+    ) where
+
+import Data.Monoid.Compat ((<>))
+import Data.Text.Lazy.Builder (Builder, fromString, singleton)
+
+import GHC.IO.Encoding.Types (TextEncoding(textEncodingName))
+#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)
+
+#include "inline.h"
+
+-- | 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 <> singleton '}'
+{-# 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 #-}
+
+-- | Convert a 'TextEncoding' to a 'Builder'.
+--
+-- /Since: 0.3/
+showbTextEncoding :: TextEncoding -> Builder
+showbTextEncoding = fromString . textEncodingName
+{-# INLINE showbTextEncoding #-}
+
+#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)
+
+$(deriveShow ''IOMode)
+$(deriveShow ''BufferMode)
+
+instance Show HandlePosn where
+    showb = showbHandlePosn
+    INLINE_INST_FUN(showb)
+
+$(deriveShow ''SeekMode)
+
+instance Show TextEncoding where
+    showb = showbTextEncoding
+    INLINE_INST_FUN(showb)
+
+#if MIN_VERSION_base(4,4,0)
+$(deriveShow ''CodingProgress)
+$(deriveShow ''CodingFailureMode)
+#endif
+
+$(deriveShow ''Newline)
+$(deriveShow ''NewlineMode)
src/Text/Show/Text/System/Posix/Types.hs view
@@ -1,394 +1,394 @@-{-# LANGUAGE CPP                        #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-{-# 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 Data.Int-import Data.Word--import Unsafe.Coerce (unsafeCoerce)--# include "HsBaseConfig.h"-# 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 = unsafeCoerce (showb :: HTYPE_DEV_T -> Builder)-# 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 = unsafeCoerce (showb :: HTYPE_INO_T -> Builder)-# 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 = unsafeCoerce (showb :: HTYPE_MODE_T -> Builder)-# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_OFF_T -> Builder)-# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_PID_T -> Builder)-# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_SSIZE_T -> Builder)-# 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 = unsafeCoerce (showb :: HTYPE_GID_T -> Builder)-# 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 = unsafeCoerce (showb :: HTYPE_NLINK_T -> Builder)-# 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 = unsafeCoerce (showb :: HTYPE_UID_T -> Builder)-# 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 = unsafeCoerce (showb :: HTYPE_CC_T -> Builder)-# 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 = unsafeCoerce (showb :: HTYPE_SPEED_T -> Builder)-# 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 = unsafeCoerce (showb :: HTYPE_TCFLAG_T -> Builder)-# 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 = unsafeCoerce (showb :: HTYPE_RLIM_T -> Builder)-# 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         #-}
+{-# 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:   Provisional
+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 Data.Int
+import Data.Word
+
+import Unsafe.Coerce (unsafeCoerce)
+
+# include "HsBaseConfig.h"
+# 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 = unsafeCoerce (showb :: HTYPE_DEV_T -> Builder)
+# 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 = unsafeCoerce (showb :: HTYPE_INO_T -> Builder)
+# 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 = unsafeCoerce (showb :: HTYPE_MODE_T -> Builder)
+# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_OFF_T -> Builder)
+# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_PID_T -> Builder)
+# 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 = unsafeCoerce (showbPrec :: Int -> HTYPE_SSIZE_T -> Builder)
+# 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 = unsafeCoerce (showb :: HTYPE_GID_T -> Builder)
+# 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 = unsafeCoerce (showb :: HTYPE_NLINK_T -> Builder)
+# 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 = unsafeCoerce (showb :: HTYPE_UID_T -> Builder)
+# 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 = unsafeCoerce (showb :: HTYPE_CC_T -> Builder)
+# 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 = unsafeCoerce (showb :: HTYPE_SPEED_T -> Builder)
+# 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 = unsafeCoerce (showb :: HTYPE_TCFLAG_T -> Builder)
+# 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 = unsafeCoerce (showb :: HTYPE_RLIM_T -> Builder)
+# 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 ()-import Text.Show.Text.TH.Internal+{-|
+Module:      Text.Show.Text.TH
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Functions to mechanically derive 'T.Show', 'Show1', or 'Show2' instances, or to
+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,798 +1,1434 @@-{-# 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--import           Data.List (foldl', intersperse)-#if MIN_VERSION_template_haskell(2,7,0)-import           Data.List (find)-import           Data.Maybe (fromJust)-#endif-import           Data.Monoid.Compat ((<>))-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           Language.Haskell.TH.Syntax (lift)--import           Prelude ()-import           Prelude.Compat 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` [| zero |]-  where-    -- To prevent the generated TH code from having a type ascription-    zero :: Int-    zero = 0---- | 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 (parenInfixConName conName ""))) $(varE p) |])-            []-encodeArgs p (NormalC conName [(_, argTy)]) = do-    arg <- newName "arg"-    -    let showArg  = showbPrecPrim appPrec1 argTy arg-        namedArg = [| fromString $(stringE (parenInfixConName conName " ")) <> $(showArg) |] -    -    match (conP conName [varP arg])-          (normalB [| showbParen ($(varE p) > $(lift 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 (`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 (parenInfixConName conName " ")) <> $(mappendArgs) |]-           -           match (conP conName $ map varP args)-                 (normalB [| showbParen ($(varE p) > $(lift 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 ++ " = ")) |]-                                         , showbPrecPrim 0 argTy arg-                                         , [| fromString ", "                                   |]-                                         ]-                                   )-                                   (zip args ts)-        braceCommaArgs = [| s '{' |] : take (length showArgs - 1) showArgs-        mappendArgs    = foldr (`infixApp` [| (<>) |])-                           [| s '}' |]-                           braceCommaArgs-        namedArgs      = [| fromString $(stringE (parenInfixConName conName " ")) <> $(mappendArgs) |]-    -    match (conP conName $ map varP args)-          (normalB-#if __GLASGOW_HASKELL__ >= 711-                    [| intConst $(namedArgs) $(varE p) |]-#else-                    [| showbParen ($(varE p) > $(lift appPrec)) $(namedArgs) |]-#endif-          )-          []-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 $(stringE $ " "  ++ opName ++ " " ) |]-                      else [| fromString $(stringE $ " `" ++ opName ++ "` ") |]-    -    match (infixP (varP al) conName (varP ar))-          (normalB $ appE [| showbParen ($(varE p) > conPrec) |]-                          [| $(showbPrecPrim (conPrec + 1) alTy al)-                          <> $(infixOpE)-                          <> $(showbPrecPrim (conPrec + 1) arTy ar)-                          |]-          )-          []-encodeArgs p (ForallC _ _ con) = encodeArgs p con------------------------------------------------------------------------------------ Utility functions------------------------------------------------------------------------------------ | Parenthesize an infix constructor name if it is being applied as a prefix--- function (e.g., data Amp a = (:&) a a)-parenInfixConName :: Name -> ShowS-parenInfixConName conName =-    let conNameBase = nameBase conName-     in showParen (isInfixTypeCon conNameBase) $ showString conNameBase---- | 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__ >= 711--- 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 = (fmap . 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 BangPatterns       #-}
+{-# 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:   Provisional
+Portability: GHC
+
+Functions to mechanically derive 'T.Show', 'Show1', or 'Show2' instances, or to
+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 loosely based off of the @Data.Aeson.TH@ module from the
+@aeson@ library.
+-}
+module Text.Show.Text.TH.Internal (
+      -- * 'deriveShow'
+      -- $deriveShow
+      deriveShow
+      -- * 'deriveShow1'
+      -- $deriveShow1
+    , deriveShow1
+      -- * 'deriveShow2'
+      -- $deriveShow2
+    , deriveShow2
+      -- * @mk@ functions
+      -- $mk
+    , mkShow
+    , mkShowLazy
+    , mkShowPrec
+    , mkShowPrecLazy
+    , mkShowList
+    , mkShowListLazy
+    , mkShowb
+    , mkShowbPrec
+    , mkShowbList
+    , mkPrint
+    , mkPrintLazy
+    , mkHPrint
+    , mkHPrintLazy
+    , mkShowbPrecWith
+    , mkShowbPrec1
+    , mkShowbPrecWith2
+    , mkShowbPrec2
+    ) where
+
+import           Data.Function (on)
+import           Data.List.Compat (foldl', intersperse)
+#if MIN_VERSION_template_haskell(2,7,0)
+import           Data.List.Compat (find)
+#endif
+import qualified Data.List.NonEmpty as NE
+import           Data.List.NonEmpty (NonEmpty(..), (<|))
+import qualified Data.Map as Map (fromList, lookup)
+import           Data.Map (Map)
+import           Data.Maybe (fromMaybe)
+import           Data.Monoid.Compat ((<>))
+import qualified Data.Set as Set
+import           Data.Set (Set)
+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 (Builder, fromString, singleton, 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.Lib
+import           Language.Haskell.TH.Ppr hiding (appPrec)
+import           Language.Haskell.TH.Syntax
+
+import           Prelude ()
+import           Prelude.Compat hiding (Show)
+
+import qualified Text.Show as S (Show(show))
+import qualified Text.Show.Text.Classes as T
+import           Text.Show.Text.Classes (Show1(..), Show2(..), showbPrec,
+                                         showbListWith, showbParen, showbSpace)
+import           Text.Show.Text.Utils (isInfixTypeCon, isTupleString)
+
+-------------------------------------------------------------------------------
+-- User-facing API
+-------------------------------------------------------------------------------
+
+{- $deriveShow
+
+'deriveShow' automatically generates a 'T.Show' instance declaration for a @data@
+type, a @newtype@, or a data family instance. 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 family instances (which requires the
+@-XTypeFamilies@ extension). To do so, pass the name of a @data instance@ or @newtype
+instance@ constructor to 'deriveShow'.  Note that the generated code may require the
+@-XFlexibleInstances@ extension. 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 = AssocDataInt1 Int | AssocDataInt2 Int Int
+$('deriveShow' 'AssocDataInt1) -- instance Show (AssocData Int) where ...
+-- Alternatively, one could use $(deriveShow 'AssocDataInt2)
+
+data family DataFam a b
+newtype instance DataFam () b = DataFamB b
+$('deriveShow' 'DataFamB)      -- instance Show b => Show (DataFam () b)
+@
+
+Note that at the moment, there are some limitations:
+
+* The 'Name' argument to 'deriveShow' must not be a type synonym.
+
+* 'deriveShow' makes the assumption that all type variables of kind @*@ 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 data
+-- family instance.
+--
+-- /Since: 0.3/
+deriveShow :: Name -> Q [Dec]
+deriveShow = deriveShowClass Show
+
+{- $deriveShow1
+
+'deriveShow1' automatically generates a 'Show1' instance declaration for a @data@
+type, a @newtype@, or a data family instance that has at least one type variable.
+This emulates what would (hypothetically) happen if you could attach a @deriving
+'Show1'@ clause to the end of a data declaration. Examples:
+
+@
+&#123;-&#35; LANGUAGE TemplateHaskell &#35;-&#125;
+import Text.Show.Text.TH (deriveShow1)
+
+data Stream a = Stream a (Stream a)
+$('deriveShow1' ''Stream)         -- instance Show1 Stream where ...
+
+newtype WrappedFunctor f a = WrapFunctor (f a)
+$('deriveShow1' ''WrappedFunctor) -- instance Show1 f => Show1 (WrappedFunctor f) where ...
+@
+
+The same restrictions that apply to 'deriveShow' also apply to 'deriveShow1', with
+some caveats:
+
+* With 'deriveShow1', the last type variable must be of kind @*@. For other ones, type
+  variables of kind @*@ are assumed to require a 'T.Show' context, and type variables
+  of kind @* -> *@ are assumed to require a 'Show1' context. For more complicated
+  scenarios, use 'mkShowbPrecWith'.
+
+* If using @DatatypeContexts@, a datatype constraint cannot mention the last type
+  variable. For example, @data Show a => Illegal a = Illegal a@ cannot have a derived
+  'Show1' instance.
+
+* If the last type variable is used within a data field of a constructor, it must only
+  be used in the last argument of the data type constructor. For example, @data Legal a
+  = Legal (Either Int a)@ can have a derived 'Show1' instance, but @data Illegal a =
+  Illegal (Either a a)@ cannot.
+
+* Data family instances must be able to eta-reduce the last type variable. In other
+  words, if you have a instance of the form:
+
+  @
+  data family Family a1 ... an t
+  data instance Family e1 ... e2 v = ...
+  @
+
+  Then the following conditions must hold:
+
+  1. @v@ must be a type variable.
+  2. @v@ must not be mentioned in any of @e1@, ..., @e2@.
+
+* In GHC 7.8, a bug exists that can cause problems when a data family declaration and
+  one of its data instances use different type variables, e.g.,
+
+  @
+  data family Foo a b c
+  data instance Foo Int y z = Foo Int y z
+  $(deriveShow1 'Foo)
+  @
+
+  To avoid this issue, it is recommened that you use the same type variables in the
+  same positions in which they appeared in the data family declaration:
+
+  @
+  data family Foo a b c
+  data instance Foo Int b c = Foo Int b c
+  $(deriveShow 'Foo)
+  @
+
+-}
+
+-- | Generates a 'Show1' instance declaration for the given data type or data
+-- family instance.
+--
+-- /Since: 1/
+deriveShow1 :: Name -> Q [Dec]
+deriveShow1 = deriveShowClass Show1
+
+{- $deriveShow2
+
+'deriveShow2' automatically generates a 'Show2' instance declaration for a @data@
+type, a @newtype@, or a data family instance that has at least two type variables.
+This emulates what would (hypothetically) happen if you could attach a @deriving
+'Show2'@ clause to the end of a data declaration. Examples:
+
+@
+&#123;-&#35; LANGUAGE TemplateHaskell &#35;-&#125;
+import Text.Show.Text.TH (deriveShow2)
+
+data OneOrNone a b = OneL a | OneR b | None
+$('deriveShow2' ''OneOrNone)        -- instance Show2 OneOrNone where ...
+
+newtype WrappedBifunctor f a b = WrapBifunctor (f a b)
+$('deriveShow2' ''WrappedBifunctor) -- instance Show2 f => Show2 (WrappedBifunctor f) where ...
+@
+
+The same restrictions that apply to 'deriveShow' and 'deriveShow1' also apply to
+'deriveShow2', with some caveats:
+
+* With 'deriveShow2', the last type variables must both be of kind @*@. For other ones,
+  type variables of kind @*@ are assumed to require a 'T.Show' constraint, type
+  variables of kind @* -> *@ are assumed to require a 'Show1' constraint, and type
+  variables of kind @* -> * -> *@ are assumed to require a 'Show2' constraint. For more
+  complicated scenarios, use 'mkShowbPrecWith2'.
+
+* If using @DatatypeContexts@, a datatype constraint cannot mention either of the last
+  two type variables. For example, @data Show a => Illegal a b = Illegal a b@ cannot
+  have a derived 'Show2' instance.
+
+* If either of the last two type variables is used within a data field of a constructor,
+  it must only be used in the last two arguments of the data type constructor. For
+  example, @data Legal a b = Legal (Int, Int, a, b)@ can have a derived 'Show2'
+  instance, but @data Illegal a b = Illegal (a, b, a, b)@ cannot.
+
+* Data family instances must be able to eta-reduce the last two type variables. In other
+  words, if you have a instance of the form:
+
+  @
+  data family Family a1 ... an t1 t2
+  data instance Family e1 ... e2 v1 v2 = ...
+  @
+
+  Then the following conditions must hold:
+
+  1. @v1@ and @v2@ must be distinct type variables.
+  2. Neither @v1@ not @v2@ must be mentioned in any of @e1@, ..., @e2@.
+
+-}
+
+-- | Generates a 'Show2' instance declaration for the given data type or data
+-- family instance.
+--
+-- /Since: 1/
+deriveShow2 :: Name -> Q [Dec]
+deriveShow2 = deriveShowClass Show2
+
+{- $mk
+
+There may be scenarios in which you want to show an arbitrary data type or data
+family instance 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` [| zero |]
+  where
+    -- To prevent the generated TH code from having a type ascription
+    zero :: Int
+    zero = 0
+
+-- | Generates a lambda expression which behaves like 'T.showPrec' (without requiring a
+-- 'T.Show' instance).
+--
+-- /Since: 0.3.1/
+mkShowbPrec :: Name -> Q Exp
+mkShowbPrec = mkShowbPrecClass Show
+
+-- | Generates a lambda expression which behaves like 'T.showbPrecWith' (without
+-- requiring a 'Show1' instance).
+--
+-- /Since: 1/
+mkShowbPrecWith :: Name -> Q Exp
+mkShowbPrecWith = mkShowbPrecClass Show1
+
+-- | Generates a lambda expression which behaves like 'T.showbPrec1' (without
+-- requiring a 'Show1' instance).
+--
+-- /Since: 1/
+mkShowbPrec1 :: Name -> Q Exp
+mkShowbPrec1 name = [| $(mkShowbPrecWith name) showbPrec |]
+
+-- | Generates a lambda expression which behaves like 'T.showbPrecWith2' (without
+-- requiring a 'Show2' instance).
+--
+-- /Since: 1/
+mkShowbPrecWith2 :: Name -> Q Exp
+mkShowbPrecWith2 = mkShowbPrecClass Show2
+
+-- | Generates a lambda expression which behaves like 'T.showbPrecWith2' (without
+-- requiring a 'Show2' instance).
+--
+-- /Since: 1/
+mkShowbPrec2 :: Name -> Q Exp
+mkShowbPrec2 name = [| $(mkShowbPrecWith2 name) showbPrec showbPrec |]
+
+-- | 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) |]
+
+-------------------------------------------------------------------------------
+-- Code generation
+-------------------------------------------------------------------------------
+
+-- | Derive a Show/Show1/Show2 instance declaration (depending on the ShowClass
+-- argument's value).
+deriveShowClass :: ShowClass -> Name -> Q [Dec]
+deriveShowClass sClass tyConName = do
+    info <- reify tyConName
+    case info of
+        TyConI{} -> deriveShowPlainTy sClass tyConName
+#if MIN_VERSION_template_haskell(2,7,0)
+        DataConI{} -> deriveShowDataFamInst sClass tyConName
+        FamilyI (FamilyD DataFam _ _ _) _ ->
+            error $ ns ++ "Cannot use a data family name. Use a data family instance constructor instead."
+        FamilyI (FamilyD TypeFam _ _ _) _ ->
+            error $ ns ++ "Cannot use a type family name."
+        _ -> error $ ns ++ "The name must be of a plain type constructor or data family instance constructor."
+#else
+        DataConI{} -> dataConIError
+        _          -> error $ ns ++ "The name must be of a plain type constructor."
+#endif
+  where
+    ns :: String
+    ns = "Text.Show.Text.TH.deriveShow: "
+
+-- | Generates a Show/Show1/Show2 instance declaration for a plain type constructor.
+deriveShowPlainTy :: ShowClass -> Name -> Q [Dec]
+deriveShowPlainTy sClass tyConName =
+    withTyCon tyConName fromCons
+  where
+    className :: Name
+    className = showClassNameTable sClass
+
+    fromCons :: Cxt -> [TyVarBndr] -> [Con] -> Q [Dec]
+    fromCons ctxt tvbs cons = (:[]) <$>
+        instanceD (return instanceCxt)
+                  (return $ AppT (ConT className) instanceType)
+                  (showbPrecDecs droppedNbs cons)
+      where
+        (instanceCxt, instanceType, droppedNbs) =
+            cxtAndTypePlainTy sClass tyConName ctxt tvbs
+
+#if MIN_VERSION_template_haskell(2,7,0)
+-- | Generates a Show/Show1/Show2 instance declaration for a data family instance
+-- constructor.
+deriveShowDataFamInst :: ShowClass -> Name -> Q [Dec]
+deriveShowDataFamInst sClass dataFamInstName =
+    withDataFamInstCon dataFamInstName fromDec
+  where
+    className :: Name
+    className = showClassNameTable sClass
+
+    fromDec :: [TyVarBndr] -> Cxt -> Name -> [Type] -> [Con] -> Q [Dec]
+    fromDec famTvbs ctxt parentName instTys cons = (:[]) <$>
+        instanceD (return instanceCxt)
+                  (return $ AppT (ConT className) instanceType)
+                  (showbPrecDecs droppedNbs cons)
+      where
+        (instanceCxt, instanceType, droppedNbs) =
+            cxtAndTypeDataFamInstCon sClass parentName ctxt famTvbs instTys
+#endif
+
+-- | Generates a declaration defining the primary function corresponding to a
+-- particular class (showbPrec for Show, showbPrecWith for Show1, and showbPrecWith2
+-- for Show2).
+showbPrecDecs :: [NameBase] -> [Con] -> [Q Dec]
+showbPrecDecs nbs cons =
+    [ funD classFuncName
+           [ clause []
+                    (normalB $ mkShowForCons nbs cons)
+                    []
+           ]
+    ]
+  where
+    classFuncName :: Name
+    classFuncName  = showbPrecNameTable . toEnum $ length nbs
+
+-- | Generates a lambda expression which behaves like showbPrec (for Show),
+-- showbPrecWith (for Show1), or showbPrecWth2 (for Show2).
+mkShowbPrecClass :: ShowClass -> Name -> Q Exp
+mkShowbPrecClass sClass tyConName = do
+    info <- reify tyConName
+    case info of
+        TyConI{} -> withTyCon tyConName $ \ctxt tvbs decs ->
+            let (_, _, nbs) = cxtAndTypePlainTy sClass tyConName ctxt tvbs
+             in mkShowForCons nbs decs
+#if MIN_VERSION_template_haskell(2,7,0)
+        DataConI{} -> withDataFamInstCon tyConName $ \famTvbs ctxt parentName instTys cons ->
+            let (_, _, nbs) = cxtAndTypeDataFamInstCon sClass parentName ctxt famTvbs instTys
+             in mkShowForCons nbs cons
+        FamilyI (FamilyD DataFam _ _ _) _ ->
+            error $ ns ++ "Cannot use a data family name. Use a data family instance constructor instead."
+        FamilyI (FamilyD TypeFam _ _ _) _ ->
+            error $ ns ++ "Cannot use a type family name."
+        _ -> error $ ns ++ "The name must be of a plain type constructor or data family instance constructor."
+#else
+        DataConI{} -> dataConIError
+        _          -> error $ ns ++ "The name must be of a plain type constructor."
+#endif
+  where
+    ns :: String
+    ns = "Text.Show.Text.TH.mkShowbPrec: "
+
+-- | Generates a lambda expression for showbPrec(With)(2) for the given constructors.
+-- All constructors must be from the same type.
+mkShowForCons :: [NameBase] -> [Con] -> Q Exp
+mkShowForCons _   []   = error "Must have at least one data constructor"
+mkShowForCons nbs cons = do
+    p     <- newName "p"
+    value <- newName "value"
+    sps   <- newNameList "sp" $ length nbs
+    let tvis   = zip nbs sps
+        sClass = toEnum $ length nbs
+    lamE (map varP $ sps ++ [p, value])
+        . appsE
+        $ [ varE $ showbPrecConstNameTable sClass
+          , caseE (varE value) $ map (mkShowForCon p sClass tvis) cons
+          ] ++ map varE sps
+            ++ [varE p, varE value]
+
+-- | Generates a lambda expression for showbPrec(With)(2) for a single constructor.
+mkShowForCon :: Name -> ShowClass -> [TyVarInfo] -> Con -> Q Match
+mkShowForCon _ _ _ (NormalC conName [])
+    = match (conP conName [])
+            (normalB [| fromString $(stringE (parenInfixConName conName "")) |])
+            []
+mkShowForCon p sClass tvis (NormalC conName [(_, argTy)]) = do
+    arg <- newName "arg"
+
+    let showArg  = mkShowForArg appPrec1 sClass (nameBase conName) tvis argTy arg
+        namedArg = [| fromString $(stringE (parenInfixConName conName " ")) <> $(showArg) |]
+
+    match (conP conName [varP arg])
+          (normalB [| showbParen ($(varE p) > $(lift appPrec)) $(namedArg) |])
+          []
+mkShowForCon p sClass tvis (NormalC conName ts) = do
+    args <- newNameList "arg" $ length ts
+
+    if isNonUnitTuple conName
+       then do
+           let showArgs       = map (\(arg, (_, argTy)) -> mkShowForArg 0 sClass (nameBase conName) tvis argTy arg)
+                                    (zip args ts)
+               parenCommaArgs = [| singleton '(' |] : intersperse [| singleton ',' |] showArgs
+               mappendArgs    = foldr (`infixApp` [| (<>) |])
+                                      [| singleton ')' |]
+                                      parenCommaArgs
+
+           match (conP conName $ map varP args)
+                 (normalB mappendArgs)
+                 []
+       else do
+           let showArgs = map (\(arg, (_, argTy)) -> mkShowForArg appPrec1 sClass (nameBase conName) tvis argTy arg)
+                              (zip args ts)
+               mappendArgs = foldr1 (\v q -> [| $(v) <> showbSpace <> $(q) |]) showArgs
+               namedArgs   = [| fromString $(stringE (parenInfixConName conName " ")) <> $(mappendArgs) |]
+
+           match (conP conName $ map varP args)
+                 (normalB [| showbParen ($(varE p) > $(lift appPrec)) $(namedArgs) |])
+                 []
+mkShowForCon p sClass tvis (RecC conName []) = mkShowForCon p sClass tvis $ NormalC conName []
+mkShowForCon _p sClass tvis (RecC conName ts) = do
+    args <- newNameList "arg" $ length ts
+
+    let showArgs       = concatMap (\(arg, (argName, _, argTy))
+                                      -> [ [| fromString $(stringE (nameBase argName ++ " = ")) |]
+                                         , mkShowForArg 0 sClass (nameBase conName) tvis argTy arg
+                                         , [| fromString ", "                                   |]
+                                         ]
+                                   )
+                                   (zip args ts)
+        braceCommaArgs = [| singleton '{' |] : take (length showArgs - 1) showArgs
+        mappendArgs    = foldr (`infixApp` [| (<>) |])
+                           [| singleton '}' |]
+                           braceCommaArgs
+        namedArgs      = [| fromString $(stringE (parenInfixConName conName " ")) <> $(mappendArgs) |]
+
+    match (conP conName $ map varP args)
+          (normalB
+#if __GLASGOW_HASKELL__ >= 711
+                    namedArgs
+#else
+                    [| showbParen ($(varE _p) > $(lift appPrec)) $(namedArgs) |]
+#endif
+          )
+          []
+mkShowForCon p sClass tvis (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.mkShowForCon: Unsupported type: " ++ S.show other
+        opName   = nameBase conName
+        infixOpE = if isInfixTypeCon opName
+                      then [| fromString $(stringE $ " "  ++ opName ++ " " ) |]
+                      else [| fromString $(stringE $ " `" ++ opName ++ "` ") |]
+
+    match (infixP (varP al) conName (varP ar))
+          (normalB $ appE [| showbParen ($(varE p) > conPrec) |]
+                          [| $(mkShowForArg (conPrec + 1) sClass opName tvis alTy al)
+                          <> $(infixOpE)
+                          <> $(mkShowForArg (conPrec + 1) sClass opName tvis arTy ar)
+                          |]
+          )
+          []
+mkShowForCon p sClass tvis (ForallC tvbs _ con) = mkShowForCon p sClass (removeForalled tvbs tvis) con
+
+-- | Generates a lambda expression for showbPrec(With)(2) for an argument of a
+-- constructor.
+mkShowForArg :: Int
+            -> ShowClass
+            -> String
+            -> [TyVarInfo]
+            -> Type
+            -> Name
+            -> Q Exp
+mkShowForArg p sClass conName tvis ty tyExpName = do
+    ty' <- expandSyn ty
+    mkShowForArg' p sClass conName tvis ty' tyExpName
+
+-- | Generates a lambda expression for showbPrec(With)(2) for an argument of a
+-- constructor, after expanding all type synonyms.
+mkShowForArg' :: Int
+              -> ShowClass
+              -> String
+              -> [TyVarInfo]
+              -> Type
+              -> Name
+              -> Q Exp
+mkShowForArg' p _ _ _ (ConT tyName) tyExpName =
+#if __GLASGOW_HASKELL__ >= 711
+-- 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.
+    showE
+  where
+    tyVarE :: Q Exp
+    tyVarE = varE tyExpName
+
+    showE :: Q Exp
+    showE | tyName == ''Char#   = [| showbPrec 0 (C# $(tyVarE)) <> singleton '#'   |]
+          | tyName == ''Double# = [| showbPrec 0 (D# $(tyVarE)) <> fromString "##" |]
+          | tyName == ''Float#  = [| showbPrec 0 (F# $(tyVarE)) <> singleton '#'   |]
+          | tyName == ''Int#    = [| showbPrec 0 (I# $(tyVarE)) <> singleton '#'   |]
+          | tyName == ''Word#   = [| showbPrec 0 (W# $(tyVarE)) <> fromString "##" |]
+          | otherwise = [| showbPrec p $(tyVarE) |]
+#else
+    [| showbPrec p $(expr) |]
+  where
+    tyVarE :: Q Exp
+    tyVarE = varE tyExpName
+
+    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
+mkShowForArg' p sClass conName tvis ty tyExpName =
+    [| $(mkShowForType sClass conName tvis ty) p $(varE tyExpName) |]
+
+-- | Generates a lambda expression for showbPrec(With)(2) for a specific type.
+-- The generated expression depends on the number of type variables.
+--
+-- 1. If the type is of kind * (T), apply showbPrec.
+-- 2. If the type is of kind * -> * (T a), apply showbPrecWith $(mkShowbForType a)
+-- 3. If the type is of kind * -> * -> * (T a b), apply
+--    showbPrecWith2 $(mkShowbForType a) $(mkShowbForType b)
+mkShowForType :: ShowClass
+              -> String
+              -> [TyVarInfo]
+              -> Type
+              -> Q Exp
+mkShowForType _ _ tvis (VarT tyName) =
+    case lookup (NameBase tyName) tvis of
+         Just spExp -> varE spExp
+         Nothing    -> [| showbPrec |]
+mkShowForType sClass conName tvis (SigT ty _)         = mkShowForType sClass conName tvis ty
+mkShowForType sClass conName tvis (ForallT tvbs _ ty) = mkShowForType sClass conName (removeForalled tvbs tvis) ty
+mkShowForType sClass conName tvis ty = do
+    let tyArgs :: [Type]
+        tyCon :| tyArgs = unapplyTy ty
+
+        numLastArgs :: Int
+        numLastArgs = min (fromEnum sClass) (length tyArgs)
+
+        lhsArgs, rhsArgs :: [Type]
+        (lhsArgs, rhsArgs) = splitAt (length tyArgs - numLastArgs) tyArgs
+
+        tyVarNameBases :: [NameBase]
+        tyVarNameBases = map fst tvis
+
+    itf <- isTyFamily tyCon
+    if any (`mentionsNameBase` tyVarNameBases) lhsArgs
+          || itf && any (`mentionsNameBase` tyVarNameBases) tyArgs
+       then outOfPlaceTyVarError conName tyVarNameBases numLastArgs
+       else appsE $ [ varE . showbPrecNameTable $ toEnum numLastArgs]
+                    ++ map (mkShowForType sClass conName tvis) rhsArgs
+
+-------------------------------------------------------------------------------
+-- Template Haskell reifying and AST manipulation
+-------------------------------------------------------------------------------
+
+-- | Extracts a plain type constructor's information.
+withTyCon :: Name -- ^ Name of the plain type constructor
+            -> (Cxt -> [TyVarBndr] -> [Con] -> Q a)
+            -> Q a
+withTyCon name f = do
+    info <- reify name
+    case info of
+        TyConI dec ->
+            case dec of
+                DataD    ctxt _ tvbs cons _ -> f ctxt tvbs cons
+                NewtypeD ctxt _ tvbs con  _ -> f ctxt 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 -- ^ Name of the data family
+            -> ([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 of the data family instance constructor
+                   -> ([TyVarBndr] -> Cxt -> Name -> [Type] -> [Con] -> 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 $ \famTvbs decs ->
+                    let sameDefDec = 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."
+
+                        (ctxt, instTys, cons) = case sameDefDec of
+                              Just (DataInstD    ctxt' _ instTys' cons' _) -> (ctxt', instTys', cons')
+                              Just (NewtypeInstD ctxt' _ instTys' con   _) -> (ctxt', instTys', [con])
+                              _ -> error $ ns ++ "Could not find data or newtype instance constructor."
+
+                    in f famTvbs ctxt parentName instTys cons
+                _ -> 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
+
+-- | Deduces the Show/Show1/Show2 instance context, instance head, and eta-reduced
+-- type variables for a plain data type constructor.
+cxtAndTypePlainTy :: ShowClass   -- Show, Show1, or Show2
+                  -> Name        -- The datatype's name
+                  -> Cxt         -- The datatype context
+                  -> [TyVarBndr] -- The type variables
+                  -> (Cxt, Type, [NameBase])
+cxtAndTypePlainTy sClass tyConName dataCxt tvbs =
+    if remainingLength < 0 || not (wellKinded droppedKinds) -- If we have enough well-kinded type variables
+       then derivingKindError sClass tyConName
+    else if any (`predMentionsNameBase` droppedNbs) dataCxt -- If the last type variable(s) are mentioned in a datatype context
+       then datatypeContextError sClass instanceType
+    else (instanceCxt, instanceType, droppedNbs)
+  where
+    instanceCxt :: Cxt
+    instanceCxt = map (applyShowConstraint)
+                $ filter (needsConstraint sClass . tvbKind) remaining
+
+    instanceType :: Type
+    instanceType = applyTyCon tyConName $ map (VarT . tvbName) remaining
+
+    remainingLength :: Int
+    remainingLength = length tvbs - fromEnum sClass
+
+    remaining, dropped :: [TyVarBndr]
+    (remaining, dropped) = splitAt remainingLength tvbs
+
+    droppedKinds :: [Kind]
+    droppedKinds = map tvbKind dropped
+
+    droppedNbs :: [NameBase]
+    droppedNbs = map (NameBase . tvbName) dropped
+
+#if MIN_VERSION_template_haskell(2,7,0)
+-- | Deduces the Show/Show1/Show2 instance context, instance head, and eta-reduced
+-- type variables for a data family instnce constructor.
+cxtAndTypeDataFamInstCon :: ShowClass   -- Show, Show1, or Show2
+                         -> Name        -- The data family name
+                         -> Cxt         -- The datatype context
+                         -> [TyVarBndr] -- The data family declaration's type variables
+                         -> [Type]      -- The data family instance types
+                         -> (Cxt, Type, [NameBase])
+cxtAndTypeDataFamInstCon sClass parentName dataCxt famTvbs instTysAndKinds =
+    if remainingLength < 0 || not (wellKinded droppedKinds) -- If we have enough well-kinded type variables
+       then derivingKindError sClass parentName
+    else if any (`predMentionsNameBase` droppedNbs) dataCxt -- If the last type variable(s) are mentioned in a datatype context
+       then datatypeContextError sClass instanceType
+    else if canEtaReduce remaining dropped -- If it is safe to drop the type variables
+       then (instanceCxt, instanceType, droppedNbs)
+    else etaReductionError instanceType
+  where
+    instanceCxt :: Cxt
+    instanceCxt = map (applyShowConstraint)
+                $ filter (needsConstraint sClass . tvbKind) lhsTvbs
+
+    -- We need to make sure that type variables in the instance head which have
+    -- Show constrains aren't poly-kinded, e.g.,
+    --
+    -- @
+    -- instance Show a => Show (Foo (a :: k)) where
+    -- @
+    --
+    -- To do this, we remove every kind ascription (i.e., strip off every 'SigT').
+    instanceType :: Type
+    instanceType = applyTyCon parentName
+                 $ map unSigT remaining
+
+    remainingLength :: Int
+    remainingLength = length famTvbs - fromEnum sClass
+
+    remaining, dropped :: [Type]
+    (remaining, dropped) = splitAt remainingLength rhsTypes
+
+    droppedKinds :: [Kind]
+    droppedKinds = map tvbKind . snd $ splitAt remainingLength famTvbs
+
+    droppedNbs :: [NameBase]
+    droppedNbs = map varTToNameBase dropped
+
+    -- We need to mindful of an old GHC bug which causes kind variables appear in
+    -- @instTysAndKinds@ (as the name suggests) if (1) @PolyKinds@ is enabled, and
+    -- (2) either GHC 7.6 or 7.8 is being used (for more info, see
+    -- https://ghc.haskell.org/trac/ghc/ticket/9692).
+    --
+    -- Since Template Haskell doesn't seem to have a mechanism for detecting which
+    -- language extensions are enabled, we do the next-best thing by counting
+    -- the number of distinct kind variables in the data family declaration, and
+    -- then dropping that number of entries from @instTysAndKinds@
+    instTypes :: [Type]
+    instTypes =
+# if __GLASGOW_HASKELL__ >= 710 || !(MIN_VERSION_template_haskell(2,8,0))
+        instTysAndKinds
+# else
+        drop (Set.size . Set.unions $ map (distinctKindVars . tvbKind) famTvbs)
+             instTysAndKinds
+# endif
+
+    lhsTvbs :: [TyVarBndr]
+    lhsTvbs = map (uncurry replaceTyVarName)
+            . filter (isTyVar . snd)
+            . take remainingLength
+            $ zip famTvbs rhsTypes
+
+    -- In GHC 7.8, only the @Type@s up to the rightmost non-eta-reduced type variable
+    -- in @instTypes@ are provided (as a result of this extremely annoying bug:
+    -- https://ghc.haskell.org/trac/ghc/ticket/9692). This is pretty inconvenient,
+    -- as it makes it impossible to come up with the correct 'Show1' or 'Show2'
+    -- instances in some cases. For example, consider the following code:
+    --
+    -- @
+    -- data family Foo a b c
+    -- data instance Foo Int y z = Foo Int y z
+    -- $(deriveShow2 'Foo)
+    -- @
+    --
+    -- Due to the aformentioned bug, Template Haskell doesn't tell us the names of
+    -- either of type variables in the data instance (@y@ and @z@). As a result, we
+    -- won't know which fields of the 'Foo' constructor to apply the show functions,
+    -- which will result in an incorrect instance. Urgh.
+    --
+    -- A workaround is to ensure that you use the exact same type variables, in the
+    -- exact same order, in the data family declaration and any data or newtype
+    -- instances:
+    --
+    -- @
+    -- data family Foo a b c
+    -- data instance Foo Int b c = Foo Int b c
+    -- $(deriveShow2 'Foo)
+    -- @
+    --
+    -- Thankfully, other versions of GHC don't seem to have this bug.
+    rhsTypes :: [Type]
+    rhsTypes =
+# if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+            instTypes ++ map tvbToType
+                             (drop (length instTypes)
+                                   famTvbs)
+# else
+            instTypes
+# endif
+#endif
+
+-- | Given a TyVarBndr, apply a Show, Show1, or Show2 constraint to it, depending
+-- on its kind.
+applyShowConstraint :: TyVarBndr -> Pred
+applyShowConstraint (PlainTV  name)      = applyClass ''T.Show  name
+applyShowConstraint (KindedTV name kind) = applyClass className name
+  where
+    className :: Name
+    className = showClassNameTable . toEnum $ numKindArrows kind
+
+-- | Can a kind signature inhabit a Show constraint?
+--
+-- Show:  Kind k
+-- Show1: Kind k1 -> k2
+-- Show2: Kind k1 -> k2 -> k3
+needsConstraint :: ShowClass -> Kind -> Bool
+needsConstraint sClass kind =
+       sClass >= toEnum (numKindArrows kind)
+    && canRealizeKindStarChain kind
+
+-------------------------------------------------------------------------------
+-- Error messages
+-------------------------------------------------------------------------------
+
+-- | Either the given data type doesn't have enough type variables, or one of
+-- the type variables to be eta-reduced cannot realize kind *.
+derivingKindError :: ShowClass -> Name -> a
+derivingKindError sClass tyConName = error
+    . showString "Cannot derive well-kinded instance of form ‘"
+    . showString className
+    . showChar ' '
+    . showParen True
+      ( showString (nameBase tyConName)
+      . showString " ..."
+      )
+    . showString "‘\n\tClass "
+    . showString className
+    . showString " expects an argument of kind "
+    . showString (pprint . createKindChain $ fromEnum sClass)
+    $ ""
+  where
+    className :: String
+    className = nameBase $ showClassNameTable sClass
+
+-- | One of the last type variables cannot be eta-reduced (see the canEtaReduce
+-- function for the criteria it would have to meet).
+etaReductionError :: Type -> a
+etaReductionError instanceType = error $
+    "Cannot eta-reduce to an instance of form \n\tinstance (...) => "
+    ++ pprint instanceType
+
+-- | The data type has a DatatypeContext which mentions one of the eta-reduced
+-- type variables.
+datatypeContextError :: ShowClass -> Type -> a
+datatypeContextError sClass instanceType = error
+    . showString "Can't make a derived instance of ‘"
+    . showString (pprint instanceType)
+    . showString "‘:\n\tData type ‘"
+    . showString className
+    . showString "‘ must not have a class context involving the last type argument(s)"
+    $ ""
+  where
+    className :: String
+    className = nameBase $ showClassNameTable sClass
+
+-- | The data type mentions one of the n eta-reduced type variables in a place other
+-- than the last nth positions of a data type in a constructor's field.
+outOfPlaceTyVarError :: String -> [NameBase] -> Int -> a
+outOfPlaceTyVarError conName tyVarNames numLastArgs = error
+    . showString "Constructor ‘"
+    . showString conName
+    . showString "‘ must use the type variable"
+    . plural id (showChar 's')
+    . showString " "
+    . showsPrec 0 tyVarNames
+    . showString " only in the last "
+    . plural id (showsPrec 0 numLastArgs)
+    . showString "argument"
+    . plural id (showChar 's')
+    . showString " of a data type"
+    $ ""
+    where
+      plural :: ShowS -> ShowS -> ShowS
+      plural one many = case numLastArgs of
+          1 -> one
+          _ -> many
+
+#if !(MIN_VERSION_template_haskell(2,7,0))
+-- | Template Haskell didn't list all of a data family's instances upon reification
+-- until template-haskell-2.7.0.0, which is necessary for a derived Show instance
+-- to work.
+dataConIError :: a
+dataConIError = error
+    . showString "Cannot use a data constructor."
+    . showString "\n\t(Note: if you are trying to derive Show for a type family,"
+    . showString "\n\tuse GHC >= 7.4 instead.)"
+    $ ""
+#endif
+
+-------------------------------------------------------------------------------
+-- Expanding type synonyms
+-------------------------------------------------------------------------------
+
+-- | Expands all type synonyms in a type. Written by Dan Rosén in the
+-- @genifunctors@ package (licensed under BSD3).
+expandSyn :: Type -> Q Type
+expandSyn (ForallT tvs ctx t) = fmap (ForallT tvs ctx) $ expandSyn t
+expandSyn t@AppT{}            = expandSynApp t []
+expandSyn t@ConT{}            = expandSynApp t []
+expandSyn (SigT t _)          = expandSyn t   -- Ignore kind synonyms
+expandSyn t                   = return t
+
+expandSynApp :: Type -> [Type] -> Q Type
+expandSynApp (AppT t1 t2) ts = do
+    t2' <- expandSyn t2
+    expandSynApp t1 (t2':ts)
+expandSynApp (ConT n) ts | nameBase n == "[]" = return $ foldl' AppT ListT ts
+expandSynApp t@(ConT n) ts = do
+    info <- reify n
+    case info of
+        TyConI (TySynD _ tvs rhs) ->
+            let (ts', ts'') = splitAt (length tvs) ts
+                subs = mkSubst tvs ts'
+                rhs' = subst subs rhs
+             in expandSynApp rhs' ts''
+        _ -> return $ foldl' AppT t ts
+expandSynApp t ts = do
+    t' <- expandSyn t
+    return $ foldl' AppT t' ts
+
+type Subst = Map Name Type
+
+mkSubst :: [TyVarBndr] -> [Type] -> Subst
+mkSubst vs ts =
+   let vs' = map un vs
+       un (PlainTV v) = v
+       un (KindedTV v _) = v
+   in Map.fromList $ zip vs' ts
+
+subst :: Subst -> Type -> Type
+subst subs (ForallT v c t) = ForallT v c $ subst subs t
+subst subs t@(VarT n)      = fromMaybe t $ Map.lookup n subs
+subst subs (AppT t1 t2)    = AppT (subst subs t1) (subst subs t2)
+subst subs (SigT t k)      = SigT (subst subs t) k
+subst _ t                  = t
+
+-------------------------------------------------------------------------------
+-- Class-specific constants
+-------------------------------------------------------------------------------
+
+-- | A representation of which @Show@ variant is being derived.
+data ShowClass = Show | Show1 | Show2
+  deriving (Enum, Eq, Ord)
+
+showbPrecConstNameTable :: ShowClass -> Name
+showbPrecConstNameTable Show  = 'showbPrecConst
+showbPrecConstNameTable Show1 = 'showbPrecWithConst
+showbPrecConstNameTable Show2 = 'showbPrecWith2Const
+
+showClassNameTable :: ShowClass -> Name
+showClassNameTable Show  = ''T.Show
+showClassNameTable Show1 = ''Show1
+showClassNameTable Show2 = ''Show2
+
+showbPrecNameTable :: ShowClass -> Name
+showbPrecNameTable Show  = 'showbPrec
+showbPrecNameTable Show1 = 'showbPrecWith
+showbPrecNameTable Show2 = 'showbPrecWith2
+
+-- | 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@.
+showbPrecConst :: Builder -> Int -> a -> Builder
+showbPrecConst = const . const
+{-# INLINE showbPrecConst #-}
+
+showbPrecWithConst :: Builder -> (Int -> a -> Builder) -> Int -> f a -> Builder
+showbPrecWithConst = const . const . const
+{-# INLINE showbPrecWithConst #-}
+
+showbPrecWith2Const :: Builder -> (Int -> a -> Builder) -> (Int -> b -> Builder)
+                    -> Int -> f a b -> Builder
+showbPrecWith2Const = const . const . const . const
+{-# INLINE showbPrecWith2Const #-}
+
+-------------------------------------------------------------------------------
+-- NameBase
+-------------------------------------------------------------------------------
+
+-- | A wrapper around Name which only uses the 'nameBase' (not the entire Name)
+-- to compare for equality. For example, if you had two Names a_123 and a_456,
+-- they are not equal as Names, but they are equal as NameBases.
+--
+-- This is useful when inspecting type variables, since a type variable in an
+-- instance context may have a distinct Name from a type variable within an
+-- actual constructor declaration, but we'd want to treat them as the same
+-- if they have the same 'nameBase' (since that's what the programmer uses to
+-- begin with).
+newtype NameBase = NameBase { getName :: Name }
+
+getNameBase :: NameBase -> String
+getNameBase = nameBase . getName
+
+instance Eq NameBase where
+    (==) = (==) `on` getNameBase
+
+instance Ord NameBase where
+    compare = compare `on` getNameBase
+
+instance S.Show NameBase where
+    showsPrec p = showsPrec p . getNameBase
+
+-- | A NameBase paired with the name of its show function. For example, in a
+-- Show2 declaration, a list of TyVarInfos might look like [(a, 'sp1), (b, 'sp2)].
+type TyVarInfo = (NameBase, Name)
+
+-------------------------------------------------------------------------------
+-- Assorted utilities
+-------------------------------------------------------------------------------
+
+-- | Generate a list of fresh names with a common prefix, and numbered suffixes.
+newNameList :: String -> Int -> Q [Name]
+newNameList prefix n = mapM (newName . (prefix ++) . S.show) [1..n]
+
+-- | Remove any occurrences of a forall-ed type variable from a list of @TyVarInfo@s.
+removeForalled :: [TyVarBndr] -> [TyVarInfo] -> [TyVarInfo]
+removeForalled tvbs = filter (not . foralled tvbs)
+  where
+    foralled :: [TyVarBndr] -> TyVarInfo -> Bool
+    foralled tvbs' tvi = fst tvi `elem` map (NameBase . tvbName) tvbs'
+
+-- | Checks if a 'Name' represents a tuple type constructor (other than '()')
+isNonUnitTuple :: Name -> Bool
+isNonUnitTuple = isTupleString . nameBase
+
+-- | Parenthesize an infix constructor name if it is being applied as a prefix
+-- function (e.g., data Amp a = (:&) a a)
+parenInfixConName :: Name -> ShowS
+parenInfixConName conName =
+    let conNameBase = nameBase conName
+     in showParen (isInfixTypeCon conNameBase) $ showString conNameBase
+
+-- | Extracts the name from a TyVarBndr.
+tvbName :: TyVarBndr -> Name
+tvbName (PlainTV  name)   = name
+tvbName (KindedTV name _) = name
+
+-- | Extracts the kind from a TyVarBndr.
+tvbKind :: TyVarBndr -> Kind
+tvbKind (PlainTV  _)   = starK
+tvbKind (KindedTV _ k) = k
+
+-- | Replace the Name of a TyVarBndr with one from a Type (if the Type has a Name).
+replaceTyVarName :: TyVarBndr -> Type -> TyVarBndr
+replaceTyVarName tvb            (SigT t _) = replaceTyVarName tvb t
+replaceTyVarName (PlainTV  _)   (VarT n)   = PlainTV  n
+replaceTyVarName (KindedTV _ k) (VarT n)   = KindedTV n k
+replaceTyVarName tvb            _          = tvb
+
+-- | Applies a typeclass constraint to a type.
+applyClass :: Name -> Name -> Pred
+#if MIN_VERSION_template_haskell(2,10,0)
+applyClass con t = AppT (ConT con) (VarT t)
+#else
+applyClass con t = ClassP con [VarT t]
+#endif
+
+-- | Checks to see if the last types in a data family instance can be safely eta-
+-- reduced (i.e., dropped), given the other types. This checks for three conditions:
+--
+-- (1) All of the dropped types are type variables
+-- (2) All of the dropped types are distinct
+-- (3) None of the remaining types mention any of the dropped types
+canEtaReduce :: [Type] -> [Type] -> Bool
+canEtaReduce remaining dropped =
+       all isTyVar dropped
+    && allDistinct nbs -- Make sure not to pass something of type [Type], since Type
+                       -- didn't have an Ord instance until template-haskell-2.10.0.0
+    && not (any (`mentionsNameBase` nbs) remaining)
+  where
+    nbs :: [NameBase]
+    nbs = map varTToNameBase dropped
+
+-- | Extract the Name from a type variable.
+varTToName :: Type -> Name
+varTToName (VarT n)   = n
+varTToName (SigT t _) = varTToName t
+varTToName _          = error "Not a type variable!"
+
+-- | Extract the NameBase from a type variable.
+varTToNameBase :: Type -> NameBase
+varTToNameBase = NameBase . varTToName
+
+-- | Peel off a kind signature from a Type (if it has one).
+unSigT :: Type -> Type
+unSigT (SigT t _) = t
+unSigT t          = t
+
+-- | Is the given type a variable?
+isTyVar :: Type -> Bool
+isTyVar (VarT _)   = True
+isTyVar (SigT t _) = isTyVar t
+isTyVar _          = False
+
+-- | Is the given type a type family constructor (and not a data family constructor)?
+isTyFamily :: Type -> Q Bool
+isTyFamily (ConT n) = do
+    info <- reify n
+    return $ case info of
+#if MIN_VERSION_template_haskell(2,7,0)
+         FamilyI (FamilyD TypeFam _ _ _) _ -> True
+#else
+         TyConI  (FamilyD TypeFam _ _ _)   -> True
+#endif
+         _ -> False
+isTyFamily _ = return False
+
+-- | Are all of the items in a list (which have an ordering) distinct?
+--
+-- This uses Set (as opposed to nub) for better asymptotic time complexity.
+allDistinct :: Ord a => [a] -> Bool
+allDistinct = allDistinct' Set.empty
+  where
+    allDistinct' :: Ord a => Set a -> [a] -> Bool
+    allDistinct' uniqs (x:xs)
+        | x `Set.member` uniqs = False
+        | otherwise            = allDistinct' (Set.insert x uniqs) xs
+    allDistinct' _ _           = True
+
+-- | Does the given type mention any of the NameBases in the list?
+mentionsNameBase :: Type -> [NameBase] -> Bool
+mentionsNameBase = go Set.empty
+  where
+    go :: Set NameBase -> Type -> [NameBase] -> Bool
+    go foralls (ForallT tvbs _ t) nbs =
+        go (foralls `Set.union` Set.fromList (map (NameBase . tvbName) tvbs)) t nbs
+    go foralls (AppT t1 t2) nbs = go foralls t1 nbs || go foralls t2 nbs
+    go foralls (SigT t _)   nbs = go foralls t nbs
+    go foralls (VarT n)     nbs = varNb `elem` nbs && not (varNb `Set.member` foralls)
+      where
+        varNb = NameBase n
+    go _       _            _   = False
+
+-- | Does an instance predicate mention any of the NameBases in the list?
+predMentionsNameBase :: Pred -> [NameBase] -> Bool
+#if MIN_VERSION_template_haskell(2,10,0)
+predMentionsNameBase = mentionsNameBase
+#else
+predMentionsNameBase (ClassP _ tys) nbs = any (`mentionsNameBase` nbs) tys
+predMentionsNameBase (EqualP t1 t2) nbs = mentionsNameBase t1 nbs || mentionsNameBase t2 nbs
+#endif
+
+-- | The number of arrows that compose the spine of a kind signature
+-- (e.g., (* -> *) -> k -> * has two arrows on its spine).
+numKindArrows :: Kind -> Int
+numKindArrows k = length (uncurryKind k) - 1
+
+-- | Construct a type via curried application.
+applyTy :: Type -> [Type] -> Type
+applyTy = foldl' AppT
+
+-- | Fully applies a type constructor to its type variables.
+applyTyCon :: Name -> [Type] -> Type
+applyTyCon = applyTy . ConT
+
+-- | Split an applied type into its individual components. For example, this:
+--
+-- @
+-- Either Int Char
+-- @
+--
+-- would split to this:
+--
+-- @
+-- [Either, Int, Char]
+-- @
+unapplyTy :: Type -> NonEmpty Type
+unapplyTy = NE.reverse . go
+  where
+    go :: Type -> NonEmpty Type
+    go (AppT t1 t2) = t2 <| go t1
+    go (SigT t _)   = go t
+    go t            = t :| []
+
+-- | Split a type signature by the arrows on its spine. For example, this:
+--
+-- @
+-- (Int -> String) -> Char -> ()
+-- @
+--
+-- would split to this:
+--
+-- @
+-- [Int -> String, Char, ()]
+-- @
+uncurryTy :: Type -> NonEmpty Type
+uncurryTy (AppT (AppT ArrowT t1) t2) = t1 <| uncurryTy t2
+uncurryTy (SigT t _)                 = uncurryTy t
+uncurryTy t                          = t :| []
+
+-- | Like uncurryType, except on a kind level.
+uncurryKind :: Kind -> NonEmpty Kind
+#if MIN_VERSION_template_haskell(2,8,0)
+uncurryKind = uncurryTy
+#else
+uncurryKind (ArrowK k1 k2) = k1 <| uncurryKind k2
+uncurryKind k              = k :| []
+#endif
+
+wellKinded :: [Kind] -> Bool
+wellKinded = all canRealizeKindStar
+
+-- | Of form k1 -> k2 -> ... -> kn, where k is either a single kind variable or *.
+canRealizeKindStarChain :: Kind -> Bool
+canRealizeKindStarChain = all canRealizeKindStar . uncurryKind
+
+canRealizeKindStar :: Kind -> Bool
+canRealizeKindStar k = case uncurryKind k of
+    k' :| [] -> case k' of
+#if MIN_VERSION_template_haskell(2,8,0)
+                     StarT    -> True
+                     (VarT _) -> True -- Kind k can be instantiated with *
+#else
+                     StarK    -> True
+#endif
+                     _ -> False
+    _ -> False
+
+createKindChain :: Int -> Kind
+createKindChain = go starK
+  where
+    go :: Kind -> Int -> Kind
+    go k !0 = k
+#if MIN_VERSION_template_haskell(2,8,0)
+    go k !n = go (AppT (AppT ArrowT StarT) k) (n - 1)
+#else
+    go k !n = go (ArrowK StarK k) (n - 1)
+#endif
+
+# if MIN_VERSION_template_haskell(2,8,0) && __GLASGOW_HASKELL__ < 710
+distinctKindVars :: Kind -> Set Name
+distinctKindVars (AppT k1 k2) = distinctKindVars k1 `Set.union` distinctKindVars k2
+distinctKindVars (SigT k _)   = distinctKindVars k
+distinctKindVars (VarT k)     = Set.singleton k
+distinctKindVars _            = Set.empty
+#endif
+
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+tvbToType :: TyVarBndr -> Type
+tvbToType (PlainTV n)    = VarT n
+tvbToType (KindedTV n k) = SigT (VarT n) k
+#endif
+
+#if MIN_VERSION_template_haskell(2,7,0)
+-- | 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
+#endif
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:   Provisional
+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), showbUnaryWith)
+#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)   = showbUnaryWith showbPrec "Char"   p c
+showbLexemePrec p (String s) = showbUnaryWith showbPrec "String" p s
+showbLexemePrec p (Punc pun) = showbUnaryWith showbPrec "Punc"   p pun
+showbLexemePrec p (Ident i)  = showbUnaryWith showbPrec "Ident"  p i
+showbLexemePrec p (Symbol s) = showbUnaryWith showbPrec "Symbol" p s
+#if MIN_VERSION_base(4,6,0)
+showbLexemePrec p (Number n) = showbUnaryWith showbPrec "Number" p $ FromStringShow n
+#else
+showbLexemePrec p (Int i)    = showbUnaryWith showbPrec "Int" p i
+showbLexemePrec p (Rat r)    = showbUnaryWith showbPrec "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,85 +1,80 @@-{-# 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)-import Data.Text (Text)-import Data.Monoid.Compat ((<>))-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 ()-import Prelude.Compat hiding (length)---- | Unsafe conversion for decimal digits.-i2d :: Int -> Char-i2d (I# i#) = C# (chr# (ord# '0'# +# i#))-{-# INLINE i2d #-}---- | 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 MagicHash #-}
+
+{-|
+Module:      Text.Show.Text.Utils
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Miscellaneous utility functions.
+-}
+module Text.Show.Text.Utils where
+
+import Data.Int (Int64)
+import Data.Text (Text)
+import Data.Monoid.Compat ((<>))
+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 ()
+import Prelude.Compat hiding (length)
+
+-- | Unsafe conversion for decimal digits.
+i2d :: Int -> Char
+i2d (I# i#) = C# (chr# (ord# '0'# +# i#))
+{-# INLINE i2d #-}
+
+-- | 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 #-}
+
+-- | 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 <> singleton '\n' <> unlinesB bs
+unlinesB []     = mempty
+
+-- | Merges several 'Builder's, separating them by spaces.
+--
+-- /Since: 0.1/
+unwordsB :: [Builder] -> Builder
+unwordsB (b:bs@(_:_)) = b <> singleton ' ' <> unwordsB bs
+unwordsB [b]          = b
+unwordsB []           = mempty
− tests/Derived.hs
@@ -1,463 +0,0 @@-{-# LANGUAGE CPP                        #-}-{-# LANGUAGE ExistentialQuantification  #-}-{-# LANGUAGE FlexibleContexts           #-}-{-# LANGUAGE FlexibleInstances          #-}-{-# LANGUAGE GADTs                      #-}-{-# LANGUAGE MagicHash                  #-}-{-# LANGUAGE MultiParamTypeClasses      #-}-{-# LANGUAGE StandaloneDeriving         #-}-{-# LANGUAGE TypeOperators              #-}-{-# LANGUAGE UndecidableInstances       #-}--#if __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE DeriveGeneric              #-}-#endif--#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--#if __GLASGOW_HASKELL__ >= 709 || \-   (__GLASGOW_HASKELL__ == 708 && \-    defined(__GLASGOW_HASKELL_PATCHLEVEL1__) && \-    __GLASGOW_HASKELL_PATCHLEVEL1__ == 4)--- Workaround for https://ghc.haskell.org/trac/ghc/ticket/9563-# define LANGUAGE_DeriveGeneric1TypeFamilies-#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(..)-    , NormalGADT(..)-    , ExistentialGADT(..)-    , 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--#if __GLASGOW_HASKELL__ >= 702-import           GHC.Generics (Generic)-# if __GLASGOW_HASKELL__ >= 706-import           GHC.Generics (Generic1)-# endif-#endif-import           GHC.Prim (Char#, Double#, Float#, Int#, Word#)--import           Prelude hiding (Show)--import           Test.QuickCheck (Arbitrary)--import qualified Text.Show as S (Show)-import qualified Text.Show.Text as T (Show)--data Nullary = Nullary-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-#endif-           )--data PhantomNullary a = PhantomNullary-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-# if __GLASGOW_HASKELL__ >= 708--- Won't work on GHC 7.6 due to a PolyKinds-related bug-           , Generic1-# endif-#endif-           )--newtype MonomorphicUnary = MonomorphicUnary Int-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-#endif-           )--newtype PolymorphicUnary a b = PolymorphicUnary b-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-#endif-           )--data MonomorphicProduct = MonomorphicProduct Char Double Int-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-#endif-           )--data PolymorphicProduct a b c d = PolymorphicProduct a b d-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-#endif-           )--data MonomorphicRecord = MonomorphicRecord {-    monomorphicRecord1 :: Char-  , monomorphicRecord2 :: Double-  , monomorphicRecord3 :: Int-} deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-#endif-           )--infixr 5 :%%%:-data PolymorphicRecord a b c d = (:%%%:) {-    polymorphicRecord1 :: a-  , polymorphicRecord2 :: b-  , polymorphicRecord3 :: d-} deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-#endif-           )--infix 7 :/:-data MonomorphicInfix = Int :/: Double-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-#endif-           )--infix 8 `PolyInf`-data PolymorphicInfix a b c = a `PolyInf` c-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-#endif-           )--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)--infixr 1 :.-data NormalGADT where-    (:.)  :: Int -> Int -> NormalGADT-    (:..) :: Int -> Int -> NormalGADT-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-#endif-           )--data ExistentialGADT a b c where-    GADTCon1 ::           ExistentialGADT Char   b      c-    GADTCon2 :: Double -> ExistentialGADT Double Double c-    GADTCon3 :: Int    -> ExistentialGADT Int    String c-    GADTCon4 :: a      -> ExistentialGADT a      b      c-    GADTCon5 :: b      -> ExistentialGADT b      b      c-deriving instance (S.Show a, S.Show b) => S.Show (ExistentialGADT 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-#if __GLASGOW_HASKELL__ >= 702-           , Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-#endif-           )--infixl 5 :>:-data RightAssocTree a = RightAssocLeaf a-                      | RightAssocTree a :>: RightAssocTree a-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-#endif-           )--infix 4 :?:-data a :?: b = (:?:) a b-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-#endif-           )--newtype HigherKindedTypeParams f a = HigherKindedTypeParams (f a)-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-# if __GLASGOW_HASKELL__ >= 708--- Won't work on GHC 7.6 due to a PolyKinds-related bug-           , Generic1-# endif-#endif-           )--newtype Restriction a = Restriction a-#if __GLASGOW_HASKELL__ >= 702-  deriving ( Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-           )-#endif-deriving instance (Read a, S.Show a) => S.Show (Restriction a)--newtype RestrictedContext a = RestrictedContext (Restriction a)-  deriving ( S.Show-#if __GLASGOW_HASKELL__ >= 702-           , Generic-# if __GLASGOW_HASKELL__ >= 706-           , Generic1-# endif-#endif-           )--newtype Fix f = Fix (f (Fix f))-#if __GLASGOW_HASKELL__ >= 702-  deriving (Generic)-#endif-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-           , Generic-#  if defined(LANGUAGE_DeriveGeneric1TypeFamilies)-           , Generic1-#  endif-# endif-           )-newtype instance AllShow Int b c d = ASUnary Int-  deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-           , Generic-#  if defined(LANGUAGE_DeriveGeneric1TypeFamilies)-           , Generic1-#  endif-# endif-           )-data instance AllShow Bool Bool c d = ASProduct Bool Bool-  deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-           , Generic-#  if defined(LANGUAGE_DeriveGeneric1TypeFamilies)-           , Generic1-#  endif-# endif-           )-data instance AllShow Char Double c d = ASRecord {-    asRecord1 :: Char-  , asRecord2 :: Double-  , asRecord3 :: c-  } deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-             , Generic-#  if defined(LANGUAGE_DeriveGeneric1TypeFamilies)-           , Generic1-#  endif-# endif-             )-data instance AllShow Float Ordering c d = Float `ASInfix` Ordering-  deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-           , Generic-#  if defined(LANGUAGE_DeriveGeneric1TypeFamilies)-           , Generic1-#  endif-# 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-           , Generic-#  if defined(LANGUAGE_DeriveGeneric1TypeFamilies)-           , Generic1-#  endif-# 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-           , Generic-#  if defined(LANGUAGE_DeriveGeneric1TypeFamilies)-           , Generic1-#  endif-# endif-           )--class AssocClass1 a where-    data AssocData1 a :: *-instance AssocClass1 () where-    newtype AssocData1 () = AssocCon1 Int-      deriving ( S.Show-# if __GLASGOW_HASKELL__ >= 706-               , 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-               , Generic-# endif-               )---- TODO: Uncomment this when smarter the typeclass instance context solver is implemented--- --- 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---                , Generic--- #  if defined(LANGUAGE_DeriveGeneric1TypeFamilies)---                , Generic1--- #  endif--- # 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/Derived/DataFamilies.hs view
@@ -0,0 +1,112 @@+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE FlexibleInstances          #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MultiParamTypeClasses      #-}
+{-# LANGUAGE TemplateHaskell            #-}
+{-# LANGUAGE TypeFamilies               #-}
+
+#if __GLASGOW_HASKELL__ >= 702
+{-# LANGUAGE DeriveGeneric              #-}
+#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.DataFamilies
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Defines corner case-provoking data families.
+-}
+module Derived.DataFamilies (
+      NotAllShow(..)
+# if __GLASGOW_HASKELL__ >= 708
+    , NullaryClass(..)
+    , NullaryData(..)
+#endif
+    ) where
+
+#include "generic.h"
+
+#if __GLASGOW_HASKELL__ >= 706
+import GHC.Generics (Generic)
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+import GHC.Generics (Generic1)
+# endif
+#endif
+import GHC.Show (appPrec, appPrec1, showSpace)
+
+import Prelude ()
+import Prelude.Compat hiding (Show)
+
+import Test.QuickCheck (Arbitrary(..), oneof)
+
+import Text.Show as S
+#if MIN_VERSION_template_haskell(2,7,0)
+import Text.Show.Text.TH (deriveShow, deriveShow1, deriveShow2)
+#endif
+
+import TransformersCompat as S
+
+-------------------------------------------------------------------------------
+
+data family NotAllShow
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKEL__ < 710
+    a b c d :: *
+#else
+    w x y z :: *
+#endif
+
+data instance NotAllShow ()  ()  () d = NASNoShow
+data instance NotAllShow Int b   c  d = NASShow1 c b
+                                      | NASShow2 d
+  deriving ( S.Show
+#if __GLASGOW_HASKELL__ >= 706
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+instance (Arbitrary b, Arbitrary c, Arbitrary d) => Arbitrary (NotAllShow Int b c d) where
+    arbitrary = oneof [ NASShow1 <$> arbitrary <*> arbitrary
+                      , NASShow2 <$> arbitrary
+                      ]
+
+instance (S.Show b, S.Show c) => S.Show1 (NotAllShow Int b c) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show b => S.Show2 (NotAllShow Int b) where
+    showsPrecWith2 sp1 _ p (NASShow1 c b) = showParen (p > appPrec) $
+          showString "NASShow1 "
+        . sp1 appPrec1 c . showSpace
+        . showsPrec appPrec1 b
+    showsPrecWith2 _ sp2 p (NASShow2 d) = showParen (p > appPrec) $
+          showString "NASShow2 "
+        . sp2 appPrec1 d
+
+#if MIN_VERSION_template_haskell(2,7,0)
+$(deriveShow  'NASShow1)
+$(deriveShow1 'NASShow2)
+$(deriveShow2 'NASShow1)
+#endif
+
+-------------------------------------------------------------------------------
+
+# if __GLASGOW_HASKELL__ >= 708
+class NullaryClass where
+    data NullaryData :: *
+
+instance NullaryClass where
+    newtype NullaryData = NullaryCon Int
+      deriving (Arbitrary, S.Show, Generic)
+
+$(deriveShow 'NullaryCon)
+# endif
+ tests/Derived/DatatypeContexts.hs view
@@ -0,0 +1,98 @@+{-# LANGUAGE CPP              #-}
+{-# LANGUAGE DatatypeContexts #-}
+{-# LANGUAGE TemplateHaskell  #-}
+{-# LANGUAGE TypeFamilies     #-}
+{-# OPTIONS_GHC -w #-}
+
+{-|
+Module:      Derived.DatatypeContexts
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Defines data types with DatatypeContexts (which are gross, but still possible).
+-}
+module Derived.DatatypeContexts (TyCon(..), TyFamily(..)) where
+
+import GHC.Show (appPrec, appPrec1, showSpace)
+
+import Prelude ()
+import Prelude.Compat hiding (Show)
+
+import Test.QuickCheck (Arbitrary(..))
+
+import Text.Show as S
+import Text.Show.Text as T
+import Text.Show.Text.TH (mkShowbPrec, mkShowbPrecWith, mkShowbPrecWith2)
+
+import TransformersCompat as S
+
+-------------------------------------------------------------------------------
+
+data Ord a => TyCon a b c = TyCon a b c
+  deriving S.Show
+
+-------------------------------------------------------------------------------
+
+data family TyFamily
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+    a b c :: *
+#else
+    x y z :: *
+#endif
+
+data instance Ord a => TyFamily a b c = TyFamily a b c
+  deriving S.Show
+
+-------------------------------------------------------------------------------
+
+instance (Ord a, Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (TyCon a b c) where
+    arbitrary = TyCon <$> arbitrary <*> arbitrary <*> arbitrary
+
+instance (Ord a, Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (TyFamily a b c) where
+    arbitrary = TyFamily <$> arbitrary <*> arbitrary <*> arbitrary
+
+-------------------------------------------------------------------------------
+
+instance (Ord a, S.Show a, S.Show b) => S.Show1 (TyCon a b) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance (Ord a, S.Show a) => S.Show2 (TyCon a) where
+    showsPrecWith2 sp1 sp2 p (TyCon a b c) =
+        showsThree sp1 sp2 "TyCon" p a b c
+
+instance (Ord a, S.Show a, S.Show b) => S.Show1 (TyFamily a b) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance (Ord a, S.Show a) => S.Show2 (TyFamily a) where
+    showsPrecWith2 sp1 sp2 p (TyFamily a b c) =
+        showsThree sp1 sp2 "TyFamily" p a b c
+
+showsThree :: S.Show a
+           => (Int -> b -> ShowS) -> (Int -> c -> ShowS)
+           -> String -> Int -> a -> b -> c -> ShowS
+showsThree sp1 sp2 name p a b c = showParen (p > appPrec) $
+      showString name      . showSpace
+    . showsPrec appPrec1 a . showSpace
+    . sp1 appPrec1 b       . showSpace
+    . sp2 appPrec1 c
+
+-------------------------------------------------------------------------------
+
+$(return [])
+
+instance (Ord a, T.Show a, T.Show b, T.Show c) => T.Show (TyCon a b c) where
+    showbPrec = $(mkShowbPrec ''TyCon)
+instance (Ord a, T.Show a, T.Show b) => T.Show1 (TyCon a b) where
+    showbPrecWith = $(mkShowbPrecWith ''TyCon)
+instance (Ord a, T.Show a) => T.Show2 (TyCon a) where
+    showbPrecWith2 = $(mkShowbPrecWith2 ''TyCon)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+instance (Ord a, T.Show a, T.Show b, T.Show c) => T.Show (TyFamily a b c) where
+    showbPrec = $(mkShowbPrec 'TyFamily)
+instance (Ord a, T.Show a, T.Show b) => T.Show1 (TyFamily a b) where
+    showbPrecWith = $(mkShowbPrecWith 'TyFamily)
+instance (Ord a, T.Show a) => T.Show2 (TyFamily a) where
+    showbPrecWith2 = $(mkShowbPrecWith2 'TyFamily)
+#endif
+ tests/Derived/ExistentialQuantification.hs view
@@ -0,0 +1,146 @@+{-# LANGUAGE CPP                       #-}
+{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE GADTs                     #-}
+{-# LANGUAGE StandaloneDeriving        #-}
+{-# LANGUAGE TemplateHaskell           #-}
+{-# LANGUAGE TypeFamilies              #-}
+
+{-|
+Module:      Derived.ExistentialQuantification
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Defines data types with existentially quantified type variables.
+-}
+module Derived.ExistentialQuantification (TyCon(..), TyFamily(..)) where
+
+import GHC.Show (appPrec, appPrec1, showSpace)
+
+import Prelude ()
+import Prelude.Compat hiding (Show)
+
+import Test.QuickCheck (Arbitrary(..), Gen, oneof)
+
+import Text.Show as S (Show)
+import Text.Show.Text as T (Show)
+import Text.Show.Text.TH (deriveShow, deriveShow1, deriveShow2)
+
+import TransformersCompat as S (Show1(..), Show2(..), showsBinaryWith)
+
+-------------------------------------------------------------------------------
+
+data TyCon a b c d where
+    TyConClassConstraints    :: (Ord m, Ord n, Ord o, Ord p)
+                             => m -> n -> o -> p
+                             -> TyCon m n o p
+
+    TyConEqualityConstraints :: (e ~ g, f ~ h, e ~ f)
+                                => e -> f -> g -> h
+                             -> TyCon e f g h
+
+    TyConTypeRefinement      :: Int -> z
+                             -> TyCon Int z Int z
+
+    TyConForalls             :: forall p q r s t u.
+                                (Arbitrary p, S.Show p, T.Show p,
+                                 Arbitrary q, S.Show q, T.Show q)
+                             => p -> q -> u -> t
+                             -> TyCon r s t u
+
+-------------------------------------------------------------------------------
+
+data family TyFamily
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+    a b c d :: *
+#else
+    w x y z :: *
+#endif
+
+data instance TyFamily a b c d where
+    TyFamilyClassConstraints    :: (Ord m, Ord n, Ord o, Ord p)
+                                => m -> n -> o -> p
+                                -> TyFamily m n o p
+
+    TyFamilyEqualityConstraints :: (e ~ g, f ~ h, e ~ f)
+                                => e -> f -> g -> h
+                                -> TyFamily e f g h
+
+    TyFamilyTypeRefinement      :: Int -> z
+                                -> TyFamily Int z Int z
+
+    TyFamilyForalls             :: forall p q r s t u.
+                                   (Arbitrary p, S.Show p, T.Show p,
+                                    Arbitrary q, S.Show q, T.Show q)
+                                => p -> q -> u -> t
+                                -> TyFamily r s t u
+
+-------------------------------------------------------------------------------
+
+instance (a ~ Int, b ~ Int, c ~ Int, d ~ Int) => Arbitrary (TyCon a b c d) where
+    arbitrary = oneof [ TyConClassConstraints    <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+                      , TyConEqualityConstraints <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+                      , TyConTypeRefinement      <$> arbitrary <*> arbitrary
+                      , TyConForalls             <$> (arbitrary :: Gen Int) <*> (arbitrary :: Gen Int)
+                                                 <*> arbitrary              <*> arbitrary
+                      ]
+
+instance (a ~ Int, b ~ Int, c ~ Int, d ~ Int) => Arbitrary (TyFamily a b c d) where
+    arbitrary = oneof [ TyFamilyClassConstraints    <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+                      , TyFamilyEqualityConstraints <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+                      , TyFamilyTypeRefinement      <$> arbitrary <*> arbitrary
+                      , TyFamilyForalls             <$> (arbitrary :: Gen Int) <*> (arbitrary :: Gen Int)
+                                                    <*> arbitrary              <*> arbitrary
+                      ]
+
+-------------------------------------------------------------------------------
+
+deriving instance (S.Show a, S.Show b, S.Show c, S.Show d) => S.Show (TyCon a b c d)
+instance (S.Show a, S.Show b, S.Show c) => S.Show1 (TyCon a b c) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance (S.Show a, S.Show b) => S.Show2 (TyCon a b) where
+    showsPrecWith2 sp1 sp2 p (TyConClassConstraints a b c d) =
+        showsFour sp1 sp2 "TyConClassConstraints" p a b c d
+    showsPrecWith2 sp1 sp2 p (TyConEqualityConstraints a b c d) =
+        showsFour sp1 sp2 "TyConEqualityConstraints" p a b c d
+    showsPrecWith2 _   sp2 p (TyConTypeRefinement i d) =
+        showsBinaryWith showsPrec sp2 "TyConTypeRefinement" p i d
+    showsPrecWith2 sp1 sp2 p (TyConForalls p' q d c) =
+        showsFour sp2 sp1 "TyConForalls" p p' q d c
+
+deriving instance (S.Show a, S.Show b, S.Show c, S.Show d) => S.Show (TyFamily a b c d)
+instance (S.Show a, S.Show b, S.Show c) => S.Show1 (TyFamily a b c) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance (S.Show a, S.Show b) => S.Show2 (TyFamily a b) where
+    showsPrecWith2 sp1 sp2 p (TyFamilyClassConstraints a b c d) =
+        showsFour sp1 sp2 "TyFamilyClassConstraints" p a b c d
+    showsPrecWith2 sp1 sp2 p (TyFamilyEqualityConstraints a b c d) =
+        showsFour sp1 sp2 "TyFamilyEqualityConstraints" p a b c d
+    showsPrecWith2 _ sp2 p (TyFamilyTypeRefinement i d) =
+        showsBinaryWith showsPrec sp2 "TyFamilyTypeRefinement" p i d
+    showsPrecWith2 sp1 sp2 p (TyFamilyForalls p' q d c) =
+        showsFour sp2 sp1 "TyFamilyForalls" p p' q d c
+
+showsFour :: (S.Show a, S.Show b)
+          => (Int -> c -> ShowS) -> (Int -> d -> ShowS)
+          -> String -> Int -> a -> b -> c -> d -> ShowS
+showsFour sp1 sp2 name p a b c d = showParen (p > appPrec) $
+      showString name      . showSpace
+    . showsPrec appPrec1 a . showSpace
+    . showsPrec appPrec1 b . showSpace
+    . sp1 appPrec1 c       . showSpace
+    . sp2 appPrec1 d
+
+-------------------------------------------------------------------------------
+
+$(deriveShow  ''TyCon)
+$(deriveShow1 ''TyCon)
+$(deriveShow2 ''TyCon)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+$(deriveShow  'TyFamilyClassConstraints)
+$(deriveShow1 'TyFamilyEqualityConstraints)
+$(deriveShow2 'TyFamilyTypeRefinement)
+#endif
+ tests/Derived/Infix.hs view
@@ -0,0 +1,232 @@+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE GADTs           #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeFamilies    #-}
+
+#if __GLASGOW_HASKELL__ >= 702
+{-# LANGUAGE DeriveGeneric   #-}
+#endif
+
+{-|
+Module:      Derived.Infix
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Defines data types with infix constructors.
+-}
+module Derived.Infix (
+      TyConPlain(..)
+    , TyConGADT(..)
+    , TyFamilyPlain(..)
+    , TyFamilyGADT(..)
+    ) where
+
+#include "generic.h"
+
+#if __GLASGOW_HASKELL__ >= 702
+import GHC.Generics (Generic)
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+import GHC.Generics (Generic1)
+# endif
+#endif
+import GHC.Show (appPrec, appPrec1, showSpace)
+
+import Prelude ()
+import Prelude.Compat hiding (Show(..))
+
+import Test.QuickCheck (Arbitrary(..), oneof)
+
+import Text.Show as S (Show(..))
+import Text.Show.Text.TH (deriveShow, deriveShow1, deriveShow2)
+
+import TransformersCompat as S (Show1(..), Show2(..), showsBinaryWith)
+
+-------------------------------------------------------------------------------
+
+infixl 3 :!:
+infix  4 :@:
+infixr 5 `TyConPlain`
+data TyConPlain a b = (:!:) a b
+                    | a :@: b
+                    | a `TyConPlain` b
+  deriving ( S.Show
+#if __GLASGOW_HASKELL__ >= 702
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+-------------------------------------------------------------------------------
+
+infixr 1 :., :..., :....
+data TyConGADT a b where
+    (:.)    ::           c ->       d        -> TyConGADT c d
+    (:..)   ::           e ->       f        -> TyConGADT e f
+    (:...)  ::           g ->       h -> Int -> TyConGADT g h
+    (:....) :: { tcg1 :: i, tcg2 :: j }      -> TyConGADT i j
+  deriving ( S.Show
+#if __GLASGOW_HASKELL__ >= 706
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+-------------------------------------------------------------------------------
+
+data family TyFamilyPlain
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+                          a b :: *
+#else
+                          y z :: *
+#endif
+
+infixl 3 :#:
+infix  4 :$:
+infixr 5 `TyFamilyPlain`
+data instance TyFamilyPlain a b = (:#:) a b
+                                | a :$: b
+                                | a `TyFamilyPlain` b
+  deriving ( S.Show
+#if __GLASGOW_HASKELL__ >= 706
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+-------------------------------------------------------------------------------
+
+data family TyFamilyGADT
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+                         a b :: *
+#else
+                         y z :: *
+#endif
+
+infixr 1 :*, :***, :****
+data instance TyFamilyGADT a b where
+    (:*)    ::           c ->       d        -> TyFamilyGADT c d
+    (:**)   ::           e ->       f        -> TyFamilyGADT e f
+    (:***)  ::           g ->       h -> Int -> TyFamilyGADT g h
+    (:****) :: { tfg1 :: i, tfg2 :: j }      -> TyFamilyGADT i j
+  deriving ( S.Show
+#if __GLASGOW_HASKELL__ >= 706
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+-------------------------------------------------------------------------------
+
+instance (Arbitrary a, Arbitrary b) => Arbitrary (TyConPlain a b) where
+    arbitrary = oneof (map pure [(:!:), (:@:), TyConPlain]) <*> arbitrary <*> arbitrary
+
+instance (Arbitrary a, Arbitrary b) => Arbitrary (TyConGADT a b) where
+    arbitrary = oneof [ pure (:.)
+                      , pure (:..)
+                      , flip (flip . (:...)) <$> arbitrary
+                      , pure (:....)
+                      ]
+                <*> arbitrary <*> arbitrary
+
+instance (Arbitrary a, Arbitrary b) => Arbitrary (TyFamilyPlain a b) where
+    arbitrary = oneof (map pure [(:#:), (:$:), TyFamilyPlain]) <*> arbitrary <*> arbitrary
+
+instance (Arbitrary a, Arbitrary b) => Arbitrary (TyFamilyGADT a b) where
+    arbitrary = oneof [ pure (:*)
+                      , pure (:**)
+                      , flip (flip . (:***)) <$> arbitrary
+                      , pure (:****)
+                      ]
+                <*> arbitrary <*> arbitrary
+
+-------------------------------------------------------------------------------
+
+instance S.Show a => S.Show1 (TyConPlain a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show2 TyConPlain where
+    showsPrecWith2 sp1 sp2 p (a :!: b) =
+        showsBinaryWith sp1 sp2 "(:!:)" p a b
+    showsPrecWith2 sp1 sp2 p (a :@: b) =
+        showsInfix sp1 sp2 ":@:" p 4 a b
+    showsPrecWith2 sp1 sp2 p (TyConPlain a b) =
+        showsInfix sp1 sp2 "`TyConPlain`" p 5 a b
+
+instance S.Show a => S.Show1 (TyConGADT a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show2 TyConGADT where
+    showsPrecWith2 sp1 sp2 p (a :. b) =
+        showsInfix sp1 sp2 ":." p 1 a b
+    showsPrecWith2 sp1 sp2 p (a :.. b) =
+        showsBinaryWith sp1 sp2 "(:..)" p a b
+    showsPrecWith2 sp1 sp2 p ((:...) a b i) =
+        showsTernaryWith sp1 sp2 "(:...)" p a b i
+    showsPrecWith2 sp1 sp2 p (a :.... b) =
+        showsBinaryWith sp1 sp2 "(:....)" p a b
+
+instance S.Show a => S.Show1 (TyFamilyPlain a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show2 TyFamilyPlain where
+    showsPrecWith2 sp1 sp2 p (a :#: b) =
+        showsBinaryWith sp1 sp2 "(:#:)" p a b
+    showsPrecWith2 sp1 sp2 p (a :$: b) =
+        showsInfix sp1 sp2 ":$:" p 4 a b
+    showsPrecWith2 sp1 sp2 p (TyFamilyPlain a b) =
+        showsInfix sp1 sp2 "`TyFamilyPlain`" p 5 a b
+
+instance S.Show a => S.Show1 (TyFamilyGADT a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show2 TyFamilyGADT where
+    showsPrecWith2 sp1 sp2 p (a :* b) =
+        showsInfix sp1 sp2 ":*" p 1 a b
+    showsPrecWith2 sp1 sp2 p (a :** b) =
+        showsBinaryWith sp1 sp2 "(:**)" p a b
+    showsPrecWith2 sp1 sp2 p ((:***) a b i) =
+        showsTernaryWith sp1 sp2 "(:***)" p a b i
+    showsPrecWith2 sp1 sp2 p (a :**** b) =
+        showsBinaryWith sp1 sp2 "(:****)" p a b
+
+showsInfix :: (Int -> a -> ShowS) -> (Int -> b -> ShowS)
+           -> String -> Int -> Int -> a -> b -> ShowS
+showsInfix sp1 sp2 name p infixPrec a b = showParen (p > infixPrec) $
+      sp1 (infixPrec + 1) a . showSpace
+    . showString name       . showSpace
+    . sp2 (infixPrec + 1) b
+
+showsTernaryWith :: (Int -> a -> ShowS) -> (Int -> b -> ShowS)
+                 -> String -> Int -> a -> b -> Int -> ShowS
+showsTernaryWith sp1 sp2 name p a b i = showParen (p > appPrec) $
+      showString name . showSpace
+    . sp1 appPrec1 a  . showSpace
+    . sp2 appPrec1 b  . showSpace
+    . showsPrec appPrec1 i
+
+-------------------------------------------------------------------------------
+
+$(deriveShow  ''TyConPlain)
+$(deriveShow1 ''TyConPlain)
+$(deriveShow2 ''TyConPlain)
+
+$(deriveShow  ''TyConGADT)
+$(deriveShow1 ''TyConGADT)
+$(deriveShow2 ''TyConGADT)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+$(deriveShow  '(:#:))
+$(deriveShow1 '(:$:))
+$(deriveShow2 'TyFamilyPlain)
+
+$(deriveShow  '(:*))
+$(deriveShow1 '(:***))
+$(deriveShow2 '(:****))
+#endif
+ tests/Derived/MagicHash.hs view
@@ -0,0 +1,71 @@+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE MagicHash       #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeFamilies    #-}
+
+{-|
+Module:      Derived.MagicHash
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Defines data types with fields that have unlifted types.
+-}
+module Derived.MagicHash (TyCon#(..), TyFamily#(..)) where
+
+import GHC.Exts
+
+import Prelude ()
+import Prelude.Compat hiding (Show)
+
+import Test.QuickCheck (Arbitrary(..))
+
+import Text.Show as S (Show)
+import Text.Show.Text.TH (deriveShow)
+
+-------------------------------------------------------------------------------
+
+data TyCon# = TyCon# {
+    tcInt#    :: Int#
+  , tcFloat#  :: Float#
+  , tcDouble# :: Double#
+  , tcChar#   :: Char#
+  , tcWord#   :: Word#
+} deriving S.Show
+$(deriveShow ''TyCon#)
+
+-------------------------------------------------------------------------------
+
+data family TyFamily#
+data instance TyFamily# = TyFamily# {
+    tfInt#    :: Int#
+  , tfFloat#  :: Float#
+  , tfDouble# :: Double#
+  , tfChar#   :: Char#
+  , tfWord#   :: Word#
+} deriving S.Show
+#if MIN_VERSION_template_haskell(2,7,0)
+$(deriveShow 'TyFamily#)
+#endif
+
+-------------------------------------------------------------------------------
+
+instance Arbitrary TyCon# where
+    arbitrary = do
+        I# i# <- arbitrary
+        F# f# <- arbitrary
+        D# d# <- arbitrary
+        C# c# <- arbitrary
+        W# w# <- arbitrary
+        pure $ TyCon# i# f# d# c# w#
+
+instance Arbitrary TyFamily# where
+    arbitrary = do
+        I# i# <- arbitrary
+        F# f# <- arbitrary
+        D# d# <- arbitrary
+        C# c# <- arbitrary
+        W# w# <- arbitrary
+        pure $ TyFamily# i# f# d# c# w#
+ tests/Derived/PolyKinds.hs view
@@ -0,0 +1,246 @@+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE KindSignatures             #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# LANGUAGE TemplateHaskell            #-}
+{-# LANGUAGE TypeFamilies               #-}
+{-# LANGUAGE UndecidableInstances       #-}
+
+#if __GLASGOW_HASKELL__ >= 702
+{-# LANGUAGE DeriveGeneric              #-}
+#endif
+
+#if __GLASGOW_HASKELL__ >= 706
+{-# LANGUAGE PolyKinds                  #-}
+#endif
+
+{-|
+Module:      Derived.PolyKinds
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Defines data types with poly-kinded type variables.
+-}
+module Derived.PolyKinds (
+      TyConCompose(..)
+    , TyConProxy(..)
+    , TyFamilyCompose(..)
+    , TyFamilyProxy(..)
+    ) where
+
+#include "generic.h"
+
+#if __GLASGOW_HASKELL__ >= 702
+import           GHC.Generics (Generic)
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+import           GHC.Generics (Generic1)
+# endif
+#else
+import qualified Generics.Deriving.TH as Generics (deriveAll)
+#endif
+import           GHC.Show (appPrec, appPrec1, showSpace)
+
+import           Prelude hiding (Show)
+
+import           Test.QuickCheck (Arbitrary)
+
+import           Text.Show as S (Show)
+import           Text.Show.Text as T (Show(..), Show1(..))
+import           Text.Show.Text.TH (deriveShow2, mkShowbPrec, mkShowbPrecWith)
+
+import           TransformersCompat as S (Show1(..), Show2(..))
+
+-------------------------------------------------------------------------------
+
+newtype TyConCompose f g h j k a b =
+    TyConCompose (f (g (j a) (k a)) (h (j a) (k b)))
+#if __GLASGOW_HASKELL__ >= 702
+  deriving Generic
+#endif
+
+deriving instance Arbitrary (f (g (j a) (k a)) (h (j a) (k b))) =>
+  Arbitrary (TyConCompose f g h j k a b)
+
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+deriving instance ( Functor (f (g (j a) (k a)))
+                  , Functor (h (j a))
+                  ) => Generic1 (TyConCompose f g h j k a)
+# endif
+
+deriving instance S.Show (f (g (j a) (k a)) (h (j a) (k b))) =>
+  S.Show (TyConCompose f g h j k a b)
+
+-------------------------------------------------------------------------------
+
+newtype TyConProxy a b = TyConProxy ()
+  deriving ( Arbitrary
+           , S.Show
+#if __GLASGOW_HASKELL__ >= 702
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+-------------------------------------------------------------------------------
+
+data family TyFamilyCompose
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+                            (f :: k1 -> k2 -> *)
+                            (g :: k3 -> k4 -> k1)
+                            (h :: k3 -> k4 -> k2)
+                            (j :: k5 -> k3)
+                            (k :: k5 -> k4)
+                            (a :: k5)
+                            (b :: k5)
+#elif __GLASGOW_HASKELL__ >= 706
+                            (t :: k1 -> k2 -> *)
+                            (u :: k3 -> k4 -> k1)
+                            (v :: k3 -> k4 -> k2)
+                            (w :: k5 -> k3)
+                            (x :: k5 -> k4)
+                            (y :: k5)
+                            (z :: k5)
+#else
+                            (t :: * -> * -> *)
+                            (u :: * -> * -> *)
+                            (v :: * -> * -> *)
+                            (w :: * -> *)
+                            (x :: * -> *)
+                            (y :: *)
+                            (z :: *)
+#endif
+                            :: *
+newtype instance TyFamilyCompose f g h j k a b =
+    TyFamilyCompose (f (g (j a) (k a)) (h (j a) (k b)))
+#if __GLASGOW_HASKELL__ >= 706
+  deriving Generic
+#endif
+
+deriving instance Arbitrary (f (g (j a) (k a)) (h (j a) (k b))) =>
+  Arbitrary (TyFamilyCompose f g h j k a b)
+
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+deriving instance ( Functor (f (g (j a) (k a)))
+                  , Functor (h (j a))
+                  ) => Generic1 (TyFamilyCompose f g h j k a)
+# endif
+
+deriving instance S.Show (f (g (j a) (k a)) (h (j a) (k b))) =>
+  S.Show (TyFamilyCompose f g h j k a b)
+
+-------------------------------------------------------------------------------
+
+data family TyFamilyProxy
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+                          (a :: k1) (b :: k2) :: *
+#elif __GLASGOW_HASKELL__ >= 706
+                          (x :: k1) (y :: k2) :: *
+#else
+                          (x :: *)  (y :: *)  :: *
+#endif
+
+
+newtype instance TyFamilyProxy a b = TyFamilyProxy ()
+  deriving ( Arbitrary
+           , S.Show
+#if __GLASGOW_HASKELL__ >= 706
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+-------------------------------------------------------------------------------
+
+instance (S.Show1 (f (g (j a) (k a))), S.Show1 (h (j a)), S.Show1 k) =>
+  S.Show1 (TyConCompose f g h j k a) where
+    showsPrecWith sp p (TyConCompose x) =
+        showsPrecCompose sp "TyConCompose" p x
+instance (S.Show2 f, S.Show2 g, S.Show2 h, S.Show1 j, S.Show1 k) =>
+  S.Show2 (TyConCompose f g h j k) where
+    showsPrecWith2 sp1 sp2 p (TyConCompose x) =
+        showsPrecCompose2 sp1 sp2 "TyConCompose" p x
+
+instance S.Show1 (TyConProxy (a :: *)) where
+    showsPrecWith = showsPrecWith2 undefined
+instance S.Show2 TyConProxy where
+    showsPrecWith2 _ _ p (TyConProxy x) = showParen (p > appPrec) $
+          showString "TyConProxy "
+        . showsPrec appPrec1 x
+
+instance (S.Show1 (f (g (j a) (k a))), S.Show1 (h (j a)), S.Show1 k) =>
+  S.Show1 (TyFamilyCompose f g h j k a) where
+    showsPrecWith sp p (TyFamilyCompose x) =
+        showsPrecCompose sp "TyFamilyCompose" p x
+instance (S.Show2 f, S.Show2 g, S.Show2 h, S.Show1 j, S.Show1 k) =>
+  S.Show2 (TyFamilyCompose f g h j k) where
+    showsPrecWith2 sp1 sp2 p (TyFamilyCompose x) =
+        showsPrecCompose2 sp1 sp2 "TyFamilyCompose" p x
+
+instance S.Show1 (TyFamilyProxy (a :: *)) where
+    showsPrecWith = showsPrecWith2 undefined
+instance S.Show2 TyFamilyProxy where
+    showsPrecWith2 _ _ p (TyFamilyProxy x) = showParen (p > appPrec) $
+          showString "TyFamilyProxy "
+        . showsPrec appPrec1 x
+
+showsPrecCompose :: (S.Show1 (f (g (j a) (k a))), S.Show1 (h (j a)), S.Show1 k)
+                 => (Int -> b -> ShowS) -> String
+                 -> Int -> f (g (j a) (k a)) (h (j a) (k b)) -> ShowS
+showsPrecCompose sp name p x = showParen (p > appPrec) $
+      showString name . showSpace
+    . showsPrecWith (showsPrecWith (showsPrecWith sp)) appPrec1 x
+
+showsPrecCompose2 :: (S.Show2 f, S.Show2 g, S.Show2 h, S.Show1 j, S.Show1 k)
+                  => (Int -> a -> ShowS) -> (Int -> b -> ShowS)
+                  -> String -> Int -> f (g (j a) (k a)) (h (j a) (k b)) -> ShowS
+showsPrecCompose2 sp1 sp2 name p x = showParen (p > appPrec) $
+      showString name . showSpace
+    . showsPrecWith2 (showsPrecWith2 (showsPrecWith sp1) (showsPrecWith sp1))
+                     (showsPrecWith2 (showsPrecWith sp1) (showsPrecWith sp2))
+                     appPrec1 x
+
+-------------------------------------------------------------------------------
+
+$(return [])
+
+instance T.Show (f (g (j a) (k a)) (h (j a) (k b))) =>
+  T.Show (TyConCompose f g h j k a b) where
+    showbPrec = $(mkShowbPrec ''TyConCompose)
+instance (T.Show1 (f (g (j a) (k a))), T.Show1 (h (j a)), T.Show1 k) =>
+  T.Show1 (TyConCompose f g h j k a) where
+    showbPrecWith = $(mkShowbPrecWith ''TyConCompose)
+$(deriveShow2 ''TyConCompose)
+
+instance T.Show (TyConProxy a b) where
+    showbPrec = $(mkShowbPrec ''TyConProxy)
+instance T.Show1 (TyConProxy a) where
+    showbPrecWith = $(mkShowbPrecWith ''TyConProxy)
+$(deriveShow2 ''TyConProxy)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+instance T.Show (f (g (j a) (k a)) (h (j a) (k b))) =>
+  T.Show (TyFamilyCompose f g h j k a b) where
+    showbPrec = $(mkShowbPrec 'TyFamilyCompose)
+instance (T.Show1 (f (g (j a) (k a))), T.Show1 (h (j a)), T.Show1 k) =>
+  T.Show1 (TyFamilyCompose f g h j k a) where
+    showbPrecWith = $(mkShowbPrecWith 'TyFamilyCompose)
+$(deriveShow2 'TyFamilyCompose)
+
+instance T.Show (TyFamilyProxy a b) where
+    showbPrec = $(mkShowbPrec 'TyFamilyProxy)
+instance T.Show1 (TyFamilyProxy a) where
+    showbPrecWith = $(mkShowbPrecWith 'TyFamilyProxy)
+$(deriveShow2 'TyFamilyProxy)
+#endif
+
+#if __GLASGOW_HASKELL__ < 702
+$(Generics.deriveAll ''TyConCompose)
+$(Generics.deriveAll ''TyConProxy)
+#endif
+ tests/Derived/RankNTypes.hs view
@@ -0,0 +1,130 @@+{-# LANGUAGE CPP                #-}
+{-# LANGUAGE FlexibleInstances  #-}
+{-# LANGUAGE OverloadedStrings  #-}
+{-# LANGUAGE RankNTypes         #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TemplateHaskell    #-}
+{-# LANGUAGE TypeFamilies       #-}
+{-# OPTIONS_GHC -fno-warn-orphans        #-}
+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+
+{-|
+Module:      Derived.RankNTypes
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Defines data types with rank-n voodoo.
+-}
+module Derived.RankNTypes (TyCon(..), TyFamily(..)) where
+
+import Prelude ()
+import Prelude.Compat hiding (Show(..))
+
+import Test.QuickCheck (Arbitrary(..))
+
+import Text.Show as S (Show(..))
+import Text.Show.Text as T (Show(..), Show1(..), Show2(..))
+import Text.Show.Text.TH (deriveShow, deriveShow1, deriveShow2,
+                          mkShowbPrec, mkShowbPrecWith, mkShowbPrecWith2)
+
+import TransformersCompat as S (Show1(..), Show2(..), showsUnaryWith, showsBinaryWith)
+
+-------------------------------------------------------------------------------
+
+data TyCon a b = TyCon (forall a. Tagged2 a Int b)
+                       (forall b. Tagged2 b a   a)
+
+deriving instance (S.Show a, S.Show b) => S.Show (TyCon a b)
+
+-------------------------------------------------------------------------------
+
+data family TyFamily
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+                     a b :: *
+#else
+                     x y :: *
+#endif
+
+data instance TyFamily a b = TyFamily (forall a. Tagged2 a Int b)
+                                      (forall b. Tagged2 b a   a)
+
+deriving instance (S.Show a, S.Show b) => S.Show (TyFamily a b)
+
+-------------------------------------------------------------------------------
+
+newtype Tagged2 s t c = Tagged2 c
+  deriving S.Show
+
+-------------------------------------------------------------------------------
+
+-- There's so much rank-n voodoo going on that we can't have a more generalized
+-- Arbitrary instances. Oh well, this is close enough.
+instance Arbitrary (TyCon Int Int) where
+    arbitrary = do
+        i1 <- arbitrary
+        i2 <- arbitrary
+        pure $ TyCon (Tagged2 i1) (Tagged2 i2)
+
+instance Arbitrary (TyFamily Int Int) where
+    arbitrary = do
+        i1 <- arbitrary
+        i2 <- arbitrary
+        pure $ TyFamily (Tagged2 i1) (Tagged2 i2)
+
+-------------------------------------------------------------------------------
+
+instance S.Show a => S.Show1 (TyCon a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show2 TyCon where
+    showsPrecWith2 sp1 sp2 p (TyCon b a) =
+        showsForall sp1 sp2 "TyCon" p b a
+
+instance S.Show a => S.Show1 (TyFamily a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show2 TyFamily where
+    showsPrecWith2 sp1 sp2 p (TyFamily b a) =
+        showsForall sp1 sp2 "TyFamily" p b a
+
+showsForall :: (Int -> a -> ShowS) -> (Int -> b -> ShowS)
+            -> String -> Int
+            -> (forall a. Tagged2 a Int b)
+            -> (forall b. Tagged2 b a a)
+            -> ShowS
+showsForall sp1 sp2 name p b a =
+        showsBinaryWith (showsPrecWith2 showsPrec sp2)
+                        (showsPrecWith2 sp1       sp1)
+                        name p b a
+
+-------------------------------------------------------------------------------
+
+$(deriveShow  ''TyCon)
+$(deriveShow1 ''TyCon)
+$(deriveShow2 ''TyCon)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+$(deriveShow  'TyFamily)
+$(deriveShow1 'TyFamily)
+$(deriveShow2 'TyFamily)
+#endif
+
+-------------------------------------------------------------------------------
+
+$(return [])
+
+instance S.Show1 (Tagged2 s t) where
+    showsPrecWith sp p (Tagged2 b) = showsUnaryWith sp "Tagged2" p b
+
+instance S.Show2 (Tagged2 s) where
+    showsPrecWith2 _ = showsPrecWith
+
+instance T.Show c => T.Show (Tagged2 s t c) where
+    showbPrec = $(mkShowbPrec ''Tagged2)
+
+instance T.Show1 (Tagged2 s t) where
+    showbPrecWith = $(mkShowbPrecWith ''Tagged2)
+
+instance T.Show2 (Tagged2 s) where
+    showbPrecWith2 = $(mkShowbPrecWith2 ''Tagged2)
+ tests/Derived/Records.hs view
@@ -0,0 +1,131 @@+{-# LANGUAGE CPP             #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeFamilies    #-}
+
+#if __GLASGOW_HASKELL__ >= 702
+{-# LANGUAGE DeriveGeneric   #-}
+#endif
+
+{-|
+Module:      Derived.Records
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Defines data types with record syntax.
+-}
+module Derived.Records (TyCon(..), TyFamily(..)) where
+
+#include "generic.h"
+
+#if __GLASGOW_HASKELL__ >= 702
+import GHC.Generics (Generic)
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+import GHC.Generics (Generic1)
+# endif
+#endif
+import GHC.Show (showSpace)
+#if __GLASGOW_HASKELL__ < 711
+import GHC.Show (appPrec)
+#endif
+
+import Prelude ()
+import Prelude.Compat hiding (Show)
+
+import Test.QuickCheck (Arbitrary(..), oneof)
+
+import Text.Show as S
+import Text.Show.Text.TH (deriveShow, deriveShow1, deriveShow2)
+
+import TransformersCompat as S
+
+-------------------------------------------------------------------------------
+
+infixl 4 :@:
+data TyCon a b = TyConPrefix { tc1 :: a, tc2 :: b }
+               | (:@:)       { tc3 :: b, tc4 :: a }
+  deriving ( S.Show
+#if __GLASGOW_HASKELL__ >= 702
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+-------------------------------------------------------------------------------
+
+data family TyFamily
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+    a b :: *
+#else
+    y z :: *
+#endif
+
+infixl 4 :!:
+data instance TyFamily a b = TyFamilyPrefix { tf1 :: a, tf2 :: b }
+                           | (:!:)          { tf3 :: b, tf4 :: a }
+  deriving ( S.Show
+#if __GLASGOW_HASKELL__ >= 706
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+-------------------------------------------------------------------------------
+
+instance (Arbitrary a, Arbitrary b) => Arbitrary (TyCon a b) where
+    arbitrary = oneof [ TyConPrefix <$> arbitrary <*> arbitrary
+                      , (:@:)       <$> arbitrary <*> arbitrary
+                      ]
+
+instance (Arbitrary a, Arbitrary b) => Arbitrary (TyFamily a b) where
+    arbitrary = oneof [ TyFamilyPrefix <$> arbitrary <*> arbitrary
+                      , (:!:)          <$> arbitrary <*> arbitrary
+                      ]
+
+-------------------------------------------------------------------------------
+
+instance S.Show a => S.Show1 (TyCon a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show2 TyCon where
+    showsPrecWith2 sp1 sp2 p (TyConPrefix a b) =
+        showsRecord sp1 sp2 "TyConPrefix" "tc1" "tc2" p a b
+    showsPrecWith2 sp1 sp2 p (a :@: b) =
+        showsRecord sp2 sp1 "(:@:)" "tc3" "tc4" p a b
+
+instance S.Show a => S.Show1 (TyFamily a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show2 TyFamily where
+    showsPrecWith2 sp1 sp2 p (TyFamilyPrefix a b) =
+        showsRecord sp1 sp2 "TyFamilyPrefix" "tf1" "tf2" p a b
+    showsPrecWith2 sp1 sp2 p (a :!: b) =
+        showsRecord sp2 sp1 "(:!:)" "tf3" "tf4" p a b
+
+showsRecord :: (Int -> a -> ShowS) -> (Int -> b -> ShowS)
+            -> String -> String -> String -> Int -> a -> b -> ShowS
+showsRecord sp1 sp2 con rec1 rec2 _p a b =
+#if __GLASGOW_HASKELL__ < 711
+    showParen (_p > appPrec) $
+#endif
+          showString con . showSpace
+        . showChar '{'
+        . showString rec1 . showString " = " . sp1 0 a . showString ", "
+        . showString rec2 . showString " = " . sp2 0 b
+        . showChar '}'
+
+-------------------------------------------------------------------------------
+
+$(deriveShow  ''TyCon)
+$(deriveShow1 ''TyCon)
+$(deriveShow2 ''TyCon)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+$(deriveShow  'TyFamilyPrefix)
+$(deriveShow1 '(:!:))
+$(deriveShow2 'TyFamilyPrefix)
+#endif
+ tests/Derived/TypeSynonyms.hs view
@@ -0,0 +1,137 @@+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE TemplateHaskell            #-}
+{-# LANGUAGE TypeFamilies               #-}
+
+#if __GLASGOW_HASKELL__ >= 702
+{-# LANGUAGE DeriveGeneric              #-}
+#endif
+
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Derived.TypeSynonyms
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Defines data types that use type synonyms.
+-}
+module Derived.TypeSynonyms (TyCon(..), TyFamily(..)) where
+
+#include "generic.h"
+
+#if __GLASGOW_HASKELL__ >= 702
+import           GHC.Generics (Generic)
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+import           GHC.Generics (Generic1)
+# endif
+#else
+import qualified Generics.Deriving.TH as Generics (deriveAll)
+#endif
+
+import           Prelude hiding (Show(..))
+
+import           Test.QuickCheck (Arbitrary)
+
+import           Text.Show as S (Show(..))
+import           Text.Show.Text.TH (deriveShow, deriveShow1, deriveShow2)
+
+import           TransformersCompat as S (Show1(..), Show2(..), showsUnaryWith)
+
+-------------------------------------------------------------------------------
+
+type FakeOut a = Int
+type Id a = a
+type Flip f a b = f b a
+
+-- Needed for the Generic1 instances
+instance Functor ((,,,) a b c) where
+    fmap f (a, b, c, d) = (a, b, c, f d)
+
+instance (S.Show a, S.Show b) => S.Show2 ((,,,) a b) where
+    showsPrecWith2 sp1 sp2 _ (a, b, c, d) =
+                          showChar '('
+        . showsPrec 0 a . showChar ','
+        . showsPrec 0 b . showChar ','
+        . sp1       0 c . showChar ','
+        . sp2       0 d . showChar ')'
+
+-------------------------------------------------------------------------------
+
+newtype TyCon a b = TyCon
+    ( Id (FakeOut (Id a))
+    , Id (FakeOut (Id b))
+    , Id (Flip Either (Id a) (Id Int))
+    , Id (Flip Either (Id b) (Id a))
+    )
+  deriving ( Arbitrary
+           , S.Show
+#if __GLASGOW_HASKELL__ >= 702
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+-------------------------------------------------------------------------------
+
+data family TyFamily
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+                     a b :: *
+#else
+                     y z :: *
+#endif
+
+newtype instance TyFamily a b = TyFamily
+    ( Id (FakeOut (Id a))
+    , Id (FakeOut (Id b))
+    , Id (Flip Either (Id a) (Id Int))
+    , Id (Flip Either (Id b) (Id a))
+    )
+  deriving ( Arbitrary
+           , S.Show
+#if __GLASGOW_HASKELL__ >= 706
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           )
+
+-------------------------------------------------------------------------------
+
+instance S.Show a => S.Show1 (TyCon a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show2 TyCon where
+    showsPrecWith2 sp1 sp2 p (TyCon x) =
+        showsUnaryWith (showsPrecWith2 (showsPrecWith2 showsPrec sp1)
+                                       (showsPrecWith2 sp1       sp2)
+                       ) "TyCon" p x
+
+instance S.Show a => S.Show1 (TyFamily a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+instance S.Show2 TyFamily where
+    showsPrecWith2 sp1 sp2 p (TyFamily x) =
+        showsUnaryWith (showsPrecWith2 (showsPrecWith2 showsPrec sp1)
+                                       (showsPrecWith2 sp1       sp2)
+                       ) "TyFamily" p x
+
+-------------------------------------------------------------------------------
+
+$(deriveShow  ''TyCon)
+$(deriveShow1 ''TyCon)
+$(deriveShow2 ''TyCon)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+$(deriveShow  'TyFamily)
+$(deriveShow1 'TyFamily)
+$(deriveShow2 'TyFamily)
+#endif
+
+#if __GLASGOW_HASKELL__ < 702
+$(Generics.deriveAll ''TyCon)
+#endif
tests/Instances/Control/Applicative.hs view
@@ -1,21 +1,21 @@-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Control.Applicative-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "Control.Applicative" module.--}-module Instances.Control.Applicative () where--import Control.Applicative (Const(..), ZipList(..))-import Test.QuickCheck (Arbitrary)--deriving instance Arbitrary a => Arbitrary (Const a b)-deriving instance Arbitrary a => Arbitrary (ZipList a)+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Control.Applicative
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "Control.Applicative" module.
+-}
+module Instances.Control.Applicative () where
+
+import Control.Applicative (Const(..), ZipList(..))
+import Test.QuickCheck (Arbitrary)
+
+deriving instance Arbitrary a => Arbitrary (Const a b)
+deriving instance Arbitrary a => Arbitrary (ZipList a)
tests/Instances/Control/Concurrent.hs view
@@ -1,33 +1,33 @@-{-# LANGUAGE StandaloneDeriving #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Control.Concurrent-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "Control.Concurrent" module.--}-module Instances.Control.Concurrent () where--import GHC.Conc (BlockReason(..), ThreadStatus(..))--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof)--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-                      ]+{-# LANGUAGE StandaloneDeriving #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Control.Concurrent
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "Control.Concurrent" module.
+-}
+module Instances.Control.Concurrent () where
+
+import GHC.Conc (BlockReason(..), ThreadStatus(..))
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof)
+
+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
+                      ]
tests/Instances/Control/Exception.hs view
@@ -1,108 +1,108 @@-{-# LANGUAGE CPP                #-}-{-# LANGUAGE StandaloneDeriving #-}--{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Control.Exception-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "Control.Exception" module.--}-module Instances.Control.Exception () where--import Control.Exception--import GHC.IO.Exception (IOException(..), IOErrorType(..))--import Instances.Foreign.C.Types ()-import Instances.System.IO ()--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..), Gen, arbitraryBoundedEnum, oneof)--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+{-# LANGUAGE CPP                #-}
+{-# LANGUAGE StandaloneDeriving #-}
+
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Control.Exception
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "Control.Exception" module.
+-}
+module Instances.Control.Exception () where
+
+import Control.Exception
+
+import GHC.IO.Exception (IOException(..), IOErrorType(..))
+
+import Instances.Foreign.C.Types ()
+import Instances.System.IO ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..), Gen, arbitraryBoundedEnum, oneof)
+
+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
tests/Instances/Control/Monad/ST.hs view
@@ -1,23 +1,23 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Control.Monad.ST-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'ST'.--}-module Instances.Control.Monad.ST () where--import Control.Monad.ST (ST, fixST)--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance Arbitrary (ST s a) where-    arbitrary = pure $ fixST undefined+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Control.Monad.ST
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'ST'.
+-}
+module Instances.Control.Monad.ST () where
+
+import Control.Monad.ST (ST, fixST)
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance Arbitrary (ST s a) where
+    arbitrary = pure $ fixST undefined
tests/Instances/Data/ByteString.hs view
@@ -1,23 +1,23 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.ByteString-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'ShortByteString'.--}-module Instances.Data.ByteString () where--import Data.ByteString.Short (ShortByteString, pack)--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance Arbitrary ShortByteString where-    arbitrary = pack <$> arbitrary+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.ByteString
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'ShortByteString'.
+-}
+module Instances.Data.ByteString () where
+
+import Data.ByteString.Short (ShortByteString, pack)
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance Arbitrary ShortByteString where
+    arbitrary = pack <$> arbitrary
tests/Instances/Data/Char.hs view
@@ -1,19 +1,19 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Char-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'GeneralCategory'.--}-module Instances.Data.Char () where--import Data.Char (GeneralCategory)-import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum)--instance Arbitrary GeneralCategory where-    arbitrary = arbitraryBoundedEnum+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Char
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'GeneralCategory'.
+-}
+module Instances.Data.Char () where
+
+import Data.Char (GeneralCategory)
+import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum)
+
+instance Arbitrary GeneralCategory where
+    arbitrary = arbitraryBoundedEnum
tests/Instances/Data/Data.hs view
@@ -1,48 +1,48 @@-{-# LANGUAGE StandaloneDeriving #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Data-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "Data.Data" module.--}-module Instances.Data.Data () where--import Data.Data (Constr, ConstrRep(..), DataRep(..), DataType,-                  Fixity(..), mkConstr, mkDataType)--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof)--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 Fixity-deriving instance Enum Fixity-instance Arbitrary Fixity where-    arbitrary = arbitraryBoundedEnum+{-# LANGUAGE StandaloneDeriving #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Data
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "Data.Data" module.
+-}
+module Instances.Data.Data () where
+
+import Data.Data (Constr, ConstrRep(..), DataRep(..), DataType,
+                  Fixity(..), mkConstr, mkDataType)
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof)
+
+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 Fixity
+deriving instance Enum Fixity
+instance Arbitrary Fixity where
+    arbitrary = arbitraryBoundedEnum
tests/Instances/Data/Dynamic.hs view
@@ -1,23 +1,23 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Dynamic-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'Dynamic'.--}-module Instances.Data.Dynamic () where--import Data.Dynamic (Dynamic, toDyn)--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..), Gen)--instance Arbitrary Dynamic where-    arbitrary = toDyn <$> (arbitrary :: Gen Int)+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Dynamic
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'Dynamic'.
+-}
+module Instances.Data.Dynamic () where
+
+import Data.Dynamic (Dynamic, toDyn)
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..), Gen)
+
+instance Arbitrary Dynamic where
+    arbitrary = toDyn <$> (arbitrary :: Gen Int)
tests/Instances/Data/Floating.hs view
@@ -1,22 +1,22 @@-{-# LANGUAGE CPP                #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Floating-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'FPFormat'.--}-module Instances.Data.Floating () where--import Data.Text.Lazy.Builder.RealFloat (FPFormat(..))-import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum)--deriving instance Bounded FPFormat-instance Arbitrary FPFormat where-    arbitrary = arbitraryBoundedEnum+{-# LANGUAGE CPP                #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Floating
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'FPFormat'.
+-}
+module Instances.Data.Floating () where
+
+import Data.Text.Lazy.Builder.RealFloat (FPFormat(..))
+import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum)
+
+deriving instance Bounded FPFormat
+instance Arbitrary FPFormat where
+    arbitrary = arbitraryBoundedEnum
tests/Instances/Data/Functor/Identity.hs view
@@ -1,20 +1,20 @@-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Functor.Identity-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'Identity'.--}-module Instances.Data.Functor.Identity () where--import Data.Functor.Identity (Identity(..))-import Test.QuickCheck (Arbitrary)--deriving instance Arbitrary a => Arbitrary (Identity a)+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Functor.Identity
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'Identity'.
+-}
+module Instances.Data.Functor.Identity () where
+
+import Data.Functor.Identity (Identity(..))
+import Test.QuickCheck (Arbitrary)
+
+deriving instance Arbitrary a => Arbitrary (Identity a)
tests/Instances/Data/Monoid.hs view
@@ -1,35 +1,35 @@-{-# LANGUAGE CPP                        #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}--#if MIN_VERSION_base(4,8,0)-{-# LANGUAGE FlexibleContexts           #-}-#endif--{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Monoid-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "Data.Monoid" module.--}-module Instances.Data.Monoid () where--import Data.Monoid-import Test.QuickCheck (Arbitrary)--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+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+
+#if MIN_VERSION_base(4,8,0)
+{-# LANGUAGE FlexibleContexts           #-}
+#endif
+
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Monoid
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "Data.Monoid" module.
+-}
+module Instances.Data.Monoid () where
+
+import Data.Monoid
+import Test.QuickCheck (Arbitrary)
+
+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
tests/Instances/Data/OldTypeable.hs view
@@ -1,37 +1,37 @@-{-# LANGUAGE CPP #-}--#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-{-# OPTIONS_GHC -fno-warn-orphans               #-}-{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}-#endif--{-|-Module:      Instances.Data.OldTypeable-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "Data.OldTypeable" module.--}-module Instances.Data.OldTypeable () where--#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-import Data.OldTypeable.Internal (TyCon(..), TypeRep(..))--import Instances.GHC.Fingerprint ()-import Instances.Utils ((<@>))--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance Arbitrary TypeRep where-    arbitrary = TypeRep <$> arbitrary <*> arbitrary <@> []---     arbitrary = TypeRep <$> arbitrary <*> arbitrary <*> arbitrary--instance Arbitrary TyCon where-    arbitrary = TyCon <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-#endif+{-# LANGUAGE CPP #-}
+
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+{-# OPTIONS_GHC -fno-warn-orphans               #-}
+{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
+#endif
+
+{-|
+Module:      Instances.Data.OldTypeable
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "Data.OldTypeable" module.
+-}
+module Instances.Data.OldTypeable () where
+
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+import Data.OldTypeable.Internal (TyCon(..), TypeRep(..))
+
+import Instances.GHC.Fingerprint ()
+import Instances.Utils ((<@>))
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance Arbitrary TypeRep where
+    arbitrary = TypeRep <$> arbitrary <*> arbitrary <@> []
+--     arbitrary = TypeRep <$> arbitrary <*> arbitrary <*> arbitrary
+
+instance Arbitrary TyCon where
+    arbitrary = TyCon <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+#endif
tests/Instances/Data/Ord.hs view
@@ -1,23 +1,23 @@-{-# LANGUAGE CPP                        #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Ord-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'Down'.--}-module Instances.Data.Ord () where--#if MIN_VERSION_base(4,6,0)-import Data.Ord (Down(..))-import Test.QuickCheck (Arbitrary)--deriving instance Arbitrary a => Arbitrary (Down a)-#endif+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Ord
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'Down'.
+-}
+module Instances.Data.Ord () where
+
+#if MIN_VERSION_base(4,6,0)
+import Data.Ord (Down(..))
+import Test.QuickCheck (Arbitrary)
+
+deriving instance Arbitrary a => Arbitrary (Down a)
+#endif
tests/Instances/Data/Proxy.hs view
@@ -1,23 +1,23 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Proxy-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for 'Proxy'.--}-module Instances.Data.Proxy () where--import Data.Proxy (Proxy(..))--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance Arbitrary (Proxy s) where-    arbitrary = pure Proxy+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Proxy
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for 'Proxy'.
+-}
+module Instances.Data.Proxy () where
+
+import Data.Proxy (Proxy(..))
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance Arbitrary (Proxy s) where
+    arbitrary = pure Proxy
tests/Instances/Data/Text.hs view
@@ -1,54 +1,54 @@-{-# LANGUAGE CPP                #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Text-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the @text@ library.--}-module Instances.Data.Text () where--import Data.Text.Encoding.Error (UnicodeException(..))-import Data.Text.Foreign (I16)-import Data.Text.Lazy.Builder (Builder, fromString)--#if MIN_VERSION_text(1,0,0)-import Data.Text.Encoding (Decoding(..))-import Instances.Utils ((<@>))-#endif--#if MIN_VERSION_text(1,1,0)-import Data.Text.Internal.Fusion.Size (Size, exactSize)-import Test.QuickCheck (getNonNegative)-#endif--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum)-import Test.QuickCheck.Instances ()--instance Arbitrary Builder where-    arbitrary = fromString <$> arbitrary--instance Arbitrary I16 where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary UnicodeException where-    arbitrary = DecodeError <$> arbitrary <*> arbitrary--#if MIN_VERSION_text(1,0,0)-instance Arbitrary Decoding where-    arbitrary = Some <$> arbitrary <*> arbitrary <@> undefined-#endif--#if MIN_VERSION_text(1,1,0)-instance Arbitrary Size where-    arbitrary = exactSize . getNonNegative <$> arbitrary-#endif+{-# LANGUAGE CPP                #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Text
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the @text@ library.
+-}
+module Instances.Data.Text () where
+
+import Data.Text.Encoding.Error (UnicodeException(..))
+import Data.Text.Foreign (I16)
+import Data.Text.Lazy.Builder (Builder, fromString)
+
+#if MIN_VERSION_text(1,0,0)
+import Data.Text.Encoding (Decoding(..))
+import Instances.Utils ((<@>))
+#endif
+
+#if MIN_VERSION_text(1,1,0)
+import Data.Text.Internal.Fusion.Size (Size, exactSize)
+import Test.QuickCheck (getNonNegative)
+#endif
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum)
+import Test.QuickCheck.Instances ()
+
+instance Arbitrary Builder where
+    arbitrary = fromString <$> arbitrary
+
+instance Arbitrary I16 where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary UnicodeException where
+    arbitrary = DecodeError <$> arbitrary <*> arbitrary
+
+#if MIN_VERSION_text(1,0,0)
+instance Arbitrary Decoding where
+    arbitrary = Some <$> arbitrary <*> arbitrary <@> undefined
+#endif
+
+#if MIN_VERSION_text(1,1,0)
+instance Arbitrary Size where
+    arbitrary = exactSize . getNonNegative <$> arbitrary
+#endif
tests/Instances/Data/Tuple.hs view
@@ -1,215 +1,179 @@-{-# LANGUAGE CPP                #-}--#if __GLASGOW_HASKELL__ >= 704-{-# LANGUAGE DeriveGeneric      #-}-{-# LANGUAGE StandaloneDeriving #-}-#endif--{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Tuple-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for tuple types.--}-module Instances.Data.Tuple () where--#if __GLASGOW_HASKELL__ >= 704-import GHC.Generics (Generic)-# if __GLASGOW_HASKELL__ >= 706-import GHC.Generics (Generic1)-# endif-#endif--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance ( Arbitrary a-         , Arbitrary b-         , Arbitrary c-         , Arbitrary d-         , Arbitrary e-         , Arbitrary f-         ) => Arbitrary (a, b, c, d, e, f) where-    arbitrary = (,,,,,)-        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary--instance ( Arbitrary a-         , Arbitrary b-         , Arbitrary c-         , Arbitrary d-         , Arbitrary e-         , Arbitrary f-         , Arbitrary g-         ) => Arbitrary (a, b, c, d, e, f, g) where-    arbitrary = (,,,,,,)-        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary--instance ( Arbitrary a-         , Arbitrary b-         , Arbitrary c-         , Arbitrary d-         , Arbitrary e-         , Arbitrary f-         , Arbitrary g-         , Arbitrary h-         ) => Arbitrary (a, b, c, d, e, f, g, h) where-    arbitrary = (,,,,,,,)-        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary--instance ( Arbitrary a-         , Arbitrary b-         , Arbitrary c-         , Arbitrary d-         , Arbitrary e-         , Arbitrary f-         , Arbitrary g-         , Arbitrary h-         , Arbitrary i-         ) => Arbitrary (a, b, c, d, e, f, g, h, i) where-    arbitrary = (,,,,,,,,)-        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary--instance ( Arbitrary a-         , Arbitrary b-         , Arbitrary c-         , Arbitrary d-         , Arbitrary e-         , Arbitrary f-         , Arbitrary g-         , Arbitrary h-         , Arbitrary i-         , Arbitrary j-         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j) where-    arbitrary = (,,,,,,,,,)-        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary--instance ( Arbitrary a-         , Arbitrary b-         , Arbitrary c-         , Arbitrary d-         , Arbitrary e-         , Arbitrary f-         , Arbitrary g-         , Arbitrary h-         , Arbitrary i-         , Arbitrary j-         , Arbitrary k-         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j, k) where-    arbitrary = (,,,,,,,,,,)-        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary--instance ( Arbitrary a-         , Arbitrary b-         , Arbitrary c-         , Arbitrary d-         , Arbitrary e-         , Arbitrary f-         , Arbitrary g-         , Arbitrary h-         , Arbitrary i-         , Arbitrary j-         , Arbitrary k-         , Arbitrary l-         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j, k, l) where-    arbitrary = (,,,,,,,,,,,)-        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary--instance ( Arbitrary a-         , Arbitrary b-         , Arbitrary c-         , Arbitrary d-         , Arbitrary e-         , Arbitrary f-         , Arbitrary g-         , Arbitrary h-         , Arbitrary i-         , Arbitrary j-         , Arbitrary k-         , Arbitrary l-         , Arbitrary m-         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j, k, l, m) where-    arbitrary = (,,,,,,,,,,,,)-        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary--instance ( Arbitrary a-         , Arbitrary b-         , Arbitrary c-         , Arbitrary d-         , Arbitrary e-         , Arbitrary f-         , Arbitrary g-         , Arbitrary h-         , Arbitrary i-         , Arbitrary j-         , Arbitrary k-         , Arbitrary l-         , Arbitrary m-         , Arbitrary n-         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j, k, l, m, n) where-    arbitrary = (,,,,,,,,,,,,,)-        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary--instance ( Arbitrary a-         , Arbitrary b-         , Arbitrary c-         , Arbitrary d-         , Arbitrary e-         , Arbitrary f-         , Arbitrary g-         , Arbitrary h-         , Arbitrary i-         , Arbitrary j-         , Arbitrary k-         , Arbitrary l-         , Arbitrary m-         , Arbitrary n-         , Arbitrary o-         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) where-    arbitrary = (,,,,,,,,,,,,,,)-        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary--#if __GLASGOW_HASKELL__ >= 704-deriving instance Generic (a, b, c, d, e, f, g, h)-deriving instance Generic (a, b, c, d, e, f, g, h, i)-deriving instance Generic (a, b, c, d, e, f, g, h, i, j)-deriving instance Generic (a, b, c, d, e, f, g, h, i, j, k)-deriving instance Generic (a, b, c, d, e, f, g, h, i, j, k, l)-deriving instance Generic (a, b, c, d, e, f, g, h, i, j, k, l, m)-deriving instance Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n)-deriving instance Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)--# if __GLASGOW_HASKELL__ >= 706-deriving instance Generic1 ((,,,,,,,)         a b c d e f g)-deriving instance Generic1 ((,,,,,,,,)        a b c d e f g h)-deriving instance Generic1 ((,,,,,,,,,)       a b c d e f g h i)-deriving instance Generic1 ((,,,,,,,,,,)      a b c d e f g h i j)-deriving instance Generic1 ((,,,,,,,,,,,)     a b c d e f g h i j k)-deriving instance Generic1 ((,,,,,,,,,,,,)    a b c d e f g h i j k l)-deriving instance Generic1 ((,,,,,,,,,,,,,)   a b c d e f g h i j k l m)-deriving instance Generic1 ((,,,,,,,,,,,,,,)  a b c d e f g h i j k l m n)-deriving instance Generic1 ((,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o)-# endif-#endif+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Tuple
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for tuple types.
+-}
+module Instances.Data.Tuple () where
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance ( Arbitrary a
+         , Arbitrary b
+         , Arbitrary c
+         , Arbitrary d
+         , Arbitrary e
+         , Arbitrary f
+         ) => Arbitrary (a, b, c, d, e, f) where
+    arbitrary = (,,,,,)
+        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary
+
+instance ( Arbitrary a
+         , Arbitrary b
+         , Arbitrary c
+         , Arbitrary d
+         , Arbitrary e
+         , Arbitrary f
+         , Arbitrary g
+         ) => Arbitrary (a, b, c, d, e, f, g) where
+    arbitrary = (,,,,,,)
+        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary
+
+instance ( Arbitrary a
+         , Arbitrary b
+         , Arbitrary c
+         , Arbitrary d
+         , Arbitrary e
+         , Arbitrary f
+         , Arbitrary g
+         , Arbitrary h
+         ) => Arbitrary (a, b, c, d, e, f, g, h) where
+    arbitrary = (,,,,,,,)
+        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary
+
+instance ( Arbitrary a
+         , Arbitrary b
+         , Arbitrary c
+         , Arbitrary d
+         , Arbitrary e
+         , Arbitrary f
+         , Arbitrary g
+         , Arbitrary h
+         , Arbitrary i
+         ) => Arbitrary (a, b, c, d, e, f, g, h, i) where
+    arbitrary = (,,,,,,,,)
+        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+
+instance ( Arbitrary a
+         , Arbitrary b
+         , Arbitrary c
+         , Arbitrary d
+         , Arbitrary e
+         , Arbitrary f
+         , Arbitrary g
+         , Arbitrary h
+         , Arbitrary i
+         , Arbitrary j
+         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j) where
+    arbitrary = (,,,,,,,,,)
+        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+
+instance ( Arbitrary a
+         , Arbitrary b
+         , Arbitrary c
+         , Arbitrary d
+         , Arbitrary e
+         , Arbitrary f
+         , Arbitrary g
+         , Arbitrary h
+         , Arbitrary i
+         , Arbitrary j
+         , Arbitrary k
+         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j, k) where
+    arbitrary = (,,,,,,,,,,)
+        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary
+
+instance ( Arbitrary a
+         , Arbitrary b
+         , Arbitrary c
+         , Arbitrary d
+         , Arbitrary e
+         , Arbitrary f
+         , Arbitrary g
+         , Arbitrary h
+         , Arbitrary i
+         , Arbitrary j
+         , Arbitrary k
+         , Arbitrary l
+         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j, k, l) where
+    arbitrary = (,,,,,,,,,,,)
+        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary
+
+instance ( Arbitrary a
+         , Arbitrary b
+         , Arbitrary c
+         , Arbitrary d
+         , Arbitrary e
+         , Arbitrary f
+         , Arbitrary g
+         , Arbitrary h
+         , Arbitrary i
+         , Arbitrary j
+         , Arbitrary k
+         , Arbitrary l
+         , Arbitrary m
+         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j, k, l, m) where
+    arbitrary = (,,,,,,,,,,,,)
+        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary
+
+instance ( Arbitrary a
+         , Arbitrary b
+         , Arbitrary c
+         , Arbitrary d
+         , Arbitrary e
+         , Arbitrary f
+         , Arbitrary g
+         , Arbitrary h
+         , Arbitrary i
+         , Arbitrary j
+         , Arbitrary k
+         , Arbitrary l
+         , Arbitrary m
+         , Arbitrary n
+         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j, k, l, m, n) where
+    arbitrary = (,,,,,,,,,,,,,)
+        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+
+instance ( Arbitrary a
+         , Arbitrary b
+         , Arbitrary c
+         , Arbitrary d
+         , Arbitrary e
+         , Arbitrary f
+         , Arbitrary g
+         , Arbitrary h
+         , Arbitrary i
+         , Arbitrary j
+         , Arbitrary k
+         , Arbitrary l
+         , Arbitrary m
+         , Arbitrary n
+         , Arbitrary o
+         ) => Arbitrary (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) where
+    arbitrary = (,,,,,,,,,,,,,,)
+        <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+        <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
tests/Instances/Data/Type/Coercion.hs view
@@ -1,27 +1,27 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Type.Coercion-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'Coercion'.--}-module Instances.Data.Type.Coercion () where--#if MIN_VERSION_base(4,7,0)-import Data.Coerce (Coercible)-import Data.Type.Coercion (Coercion(..))--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance Coercible a b => Arbitrary (Coercion a b) where-    arbitrary = pure Coercion-#endif+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Type.Coercion
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'Coercion'.
+-}
+module Instances.Data.Type.Coercion () where
+
+#if MIN_VERSION_base(4,7,0)
+import Data.Coerce (Coercible)
+import Data.Type.Coercion (Coercion(..))
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance Coercible a b => Arbitrary (Coercion a b) where
+    arbitrary = pure Coercion
+#endif
tests/Instances/Data/Type/Equality.hs view
@@ -1,28 +1,28 @@-{-# LANGUAGE CPP           #-}-{-# LANGUAGE TypeFamilies  #-}-{-# LANGUAGE TypeOperators #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Type.Equality-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for '(:~:)'.--}-module Instances.Data.Type.Equality () where--#if MIN_VERSION_base(4,7,0)-import Data.Type.Equality ((:~:)(..))--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance a ~ b => Arbitrary (a :~: b) where-    arbitrary = pure Refl-#endif+{-# LANGUAGE CPP           #-}
+{-# LANGUAGE TypeFamilies  #-}
+{-# LANGUAGE TypeOperators #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Type.Equality
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for '(:~:)'.
+-}
+module Instances.Data.Type.Equality () where
+
+#if MIN_VERSION_base(4,7,0)
+import Data.Type.Equality ((:~:)(..))
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance a ~ b => Arbitrary (a :~: b) where
+    arbitrary = pure Refl
+#endif
tests/Instances/Data/Typeable.hs view
@@ -1,49 +1,49 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Typeable-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "Data.Typeable" module.--}-module Instances.Data.Typeable () where--#if MIN_VERSION_base(4,4,0)-import Data.Typeable.Internal (TyCon(..), TypeRep(..))-import Instances.Utils ((<@>))-#else-import Data.Typeable (TyCon, TypeRep, mkTyCon, typeOf)-import Test.QuickCheck (Gen)-#endif--import Instances.GHC.Fingerprint ()--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance Arbitrary TypeRep where-#if MIN_VERSION_base(4,4,0)-    arbitrary = TypeRep <$> arbitrary-                        <*> arbitrary-# if MIN_VERSION_base(4,8,0)-                        <@> [] <@> []-# else-                        <@> []-# endif-#else-    arbitrary = typeOf <$> (arbitrary :: Gen Int)-#endif--instance Arbitrary TyCon where-#if MIN_VERSION_base(4,4,0)-    arbitrary = TyCon <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-#else-    arbitrary = mkTyCon <$> arbitrary-#endif+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Typeable
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "Data.Typeable" module.
+-}
+module Instances.Data.Typeable () where
+
+#if MIN_VERSION_base(4,4,0)
+import Data.Typeable.Internal (TyCon(..), TypeRep(..))
+import Instances.Utils ((<@>))
+#else
+import Data.Typeable (TyCon, TypeRep, mkTyCon, typeOf)
+import Test.QuickCheck (Gen)
+#endif
+
+import Instances.GHC.Fingerprint ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance Arbitrary TypeRep where
+#if MIN_VERSION_base(4,4,0)
+    arbitrary = TypeRep <$> arbitrary
+                        <*> arbitrary
+# if MIN_VERSION_base(4,8,0)
+                        <@> [] <@> []
+# else
+                        <@> []
+# endif
+#else
+    arbitrary = typeOf <$> (arbitrary :: Gen Int)
+#endif
+
+instance Arbitrary TyCon where
+#if MIN_VERSION_base(4,4,0)
+    arbitrary = TyCon <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+#else
+    arbitrary = mkTyCon <$> arbitrary
+#endif
tests/Instances/Data/Version.hs view
@@ -1,23 +1,23 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Data.Version-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'Version'.--}-module Instances.Data.Version () where--import Data.Version (Version(..))--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance Arbitrary Version where-    arbitrary = Version <$> arbitrary <*> arbitrary+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Data.Version
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'Version'.
+-}
+module Instances.Data.Version () where
+
+import Data.Version (Version(..))
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance Arbitrary Version where
+    arbitrary = Version <$> arbitrary <*> arbitrary
− tests/Instances/Derived.hs
@@ -1,380 +0,0 @@-{-# 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               #-}-#if __GLASGOW_HASKELL__ >= 711--- The TH deriving mechanism isn't smart enough at the moment to eliminate--- redundant constraints in Show instance declarations.-{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}-#endif-{-|-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-    , showbNormalGADTPrec-    , showbExistentialGADTPrec-    , 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--import Derived--import GHC.Exts (Char(..), Double(..), Float(..), Int(..), Word(..))--import Prelude ()-import Prelude.Compat hiding (Show)--import Test.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--showbNormalGADTPrec :: Int -> NormalGADT -> Builder-showbNormalGADTPrec = showbPrec--showbExistentialGADTPrec :: (Show a, Show b, Show c) => Int -> ExistentialGADT a b c -> Builder-showbExistentialGADTPrec = 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---- TODO: Uncomment when these type signatures are generated via Template Haskell--- --- 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 b => Arbitrary (PolymorphicUnary a b)--$(deriveShow ''MonomorphicProduct)-instance Arbitrary MonomorphicProduct where-    arbitrary = MonomorphicProduct <$> arbitrary <*> arbitrary <*> arbitrary--$(deriveShow ''PolymorphicProduct)-instance (Arbitrary a, Arbitrary b, Arbitrary d) => 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 d) => Arbitrary (PolymorphicRecord a b c d) where-    arbitrary = (:%%%:) <$> arbitrary <*> arbitrary <*> arbitrary--$(deriveShow ''MonomorphicInfix)-instance Arbitrary MonomorphicInfix where-    arbitrary = (:/:) <$> arbitrary <*> arbitrary--$(deriveShow ''PolymorphicInfix)-instance (Arbitrary a, Arbitrary c) => 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 ''NormalGADT)-instance Arbitrary NormalGADT where-    arbitrary = oneof [ (:.)  <$> arbitrary <*> arbitrary-                      , (:..) <$> arbitrary <*> arbitrary-                      ]--$(deriveShow ''ExistentialGADT)-instance __OVERLAPPING__  Arbitrary (ExistentialGADT Char b c) where-    arbitrary = pure GADTCon1-instance __OVERLAPPING__  Arbitrary (ExistentialGADT Double Double c) where-    arbitrary = GADTCon2 <$> arbitrary-instance __OVERLAPPING__  Arbitrary (ExistentialGADT Int String c) where-    arbitrary = GADTCon3 <$> arbitrary-instance __OVERLAPPABLE__ Arbitrary a => Arbitrary (ExistentialGADT a b c) where-    arbitrary = GADTCon4 <$> arbitrary-instance __OVERLAPPING__  Arbitrary b => Arbitrary (ExistentialGADT 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/Foreign/C/Types.hs view
@@ -1,142 +1,142 @@-{-# LANGUAGE CPP                        #-}--#if MIN_VERSION_base(4,5,0)-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-#endif--{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Foreign.C.Types-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "Foreign.C.Types" module.--}-module Instances.Foreign.C.Types () where--import Foreign.C.Types-import Test.QuickCheck (Arbitrary(..))--#if !(MIN_VERSION_base(4,5,0))-import Data.Int-# if MIN_VERSION_base(4,4,0)-import Data.Word-# endif--import Test.QuickCheck (Gen, arbitrarySizedBoundedIntegral, arbitrarySizedFractional)-import Unsafe.Coerce (unsafeCoerce)--# include "HsBaseConfig.h"-#endif--#if MIN_VERSION_base(4,5,0)-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-# if MIN_VERSION_base(4,4,0)-deriving instance Arbitrary CUSeconds-deriving instance Arbitrary CSUSeconds-# endif-deriving instance Arbitrary CIntPtr-deriving instance Arbitrary CUIntPtr-deriving instance Arbitrary CIntMax-deriving instance Arbitrary CUIntMax-#else-instance Arbitrary CChar where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CSChar where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CUChar where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CShort where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CUShort where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CInt where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CUInt where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CLong where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CULong where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CLLong where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CULLong where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CFloat where-    arbitrary = arbitrarySizedFractional--instance Arbitrary CDouble where-    arbitrary = arbitrarySizedFractional--instance Arbitrary CPtrdiff where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CSize where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CWchar where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CSigAtomic where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CClock where-    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_CLOCK_T)--instance Arbitrary CTime where-    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_TIME_T)--# if MIN_VERSION_base(4,4,0)-instance Arbitrary CUSeconds where-    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_USECONDS_T)--instance Arbitrary CSUSeconds where-    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_SUSECONDS_T)-# endif--instance Arbitrary CIntPtr where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CUIntPtr where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CIntMax where-    arbitrary = arbitrarySizedBoundedIntegral--instance Arbitrary CUIntMax where-    arbitrary = arbitrarySizedBoundedIntegral-#endif+{-# LANGUAGE CPP                        #-}
+
+#if MIN_VERSION_base(4,5,0)
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+#endif
+
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Foreign.C.Types
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "Foreign.C.Types" module.
+-}
+module Instances.Foreign.C.Types () where
+
+import Foreign.C.Types
+import Test.QuickCheck (Arbitrary(..))
+
+#if !(MIN_VERSION_base(4,5,0))
+import Data.Int
+# if MIN_VERSION_base(4,4,0)
+import Data.Word
+# endif
+
+import Test.QuickCheck (Gen, arbitrarySizedBoundedIntegral, arbitrarySizedFractional)
+import Unsafe.Coerce (unsafeCoerce)
+
+# include "HsBaseConfig.h"
+#endif
+
+#if MIN_VERSION_base(4,5,0)
+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
+# if MIN_VERSION_base(4,4,0)
+deriving instance Arbitrary CUSeconds
+deriving instance Arbitrary CSUSeconds
+# endif
+deriving instance Arbitrary CIntPtr
+deriving instance Arbitrary CUIntPtr
+deriving instance Arbitrary CIntMax
+deriving instance Arbitrary CUIntMax
+#else
+instance Arbitrary CChar where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CSChar where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CUChar where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CShort where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CUShort where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CInt where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CUInt where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CLong where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CULong where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CLLong where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CULLong where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CFloat where
+    arbitrary = arbitrarySizedFractional
+
+instance Arbitrary CDouble where
+    arbitrary = arbitrarySizedFractional
+
+instance Arbitrary CPtrdiff where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CSize where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CWchar where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CSigAtomic where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CClock where
+    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_CLOCK_T)
+
+instance Arbitrary CTime where
+    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_TIME_T)
+
+# if MIN_VERSION_base(4,4,0)
+instance Arbitrary CUSeconds where
+    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_USECONDS_T)
+
+instance Arbitrary CSUSeconds where
+    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_SUSECONDS_T)
+# endif
+
+instance Arbitrary CIntPtr where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CUIntPtr where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CIntMax where
+    arbitrary = arbitrarySizedBoundedIntegral
+
+instance Arbitrary CUIntMax where
+    arbitrary = arbitrarySizedBoundedIntegral
+#endif
tests/Instances/Foreign/Ptr.hs view
@@ -1,34 +1,34 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Foreign.Ptr-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for pointer data types.--}-module Instances.Foreign.Ptr () where--import Foreign.Ptr (FunPtr, IntPtr, Ptr, WordPtr,-                    castPtrToFunPtr, nullPtr, plusPtr,-                    ptrToIntPtr, ptrToWordPtr)--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (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+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Foreign.Ptr
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for pointer data types.
+-}
+module Instances.Foreign.Ptr () where
+
+import Foreign.Ptr (FunPtr, IntPtr, Ptr, WordPtr,
+                    castPtrToFunPtr, nullPtr, plusPtr,
+                    ptrToIntPtr, ptrToWordPtr)
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (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
tests/Instances/FromStringTextShow.hs view
@@ -1,21 +1,21 @@-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.FromStringTextShow-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances 'FromStringShow' and 'FromTextShow'--}-module Instances.FromStringTextShow () where--import Test.QuickCheck (Arbitrary)-import Text.Show.Text (FromStringShow(..), FromTextShow(..))--deriving instance Arbitrary a => Arbitrary (FromStringShow a)-deriving instance Arbitrary a => Arbitrary (FromTextShow a)+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.FromStringTextShow
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances 'FromStringShow' and 'FromTextShow'
+-}
+module Instances.FromStringTextShow () where
+
+import Test.QuickCheck (Arbitrary)
+import Text.Show.Text (FromStringShow(..), FromTextShow(..))
+
+deriving instance Arbitrary a => Arbitrary (FromStringShow a)
+deriving instance Arbitrary a => Arbitrary (FromTextShow a)
tests/Instances/GHC/Conc/Windows.hs view
@@ -1,24 +1,24 @@-{-# LANGUAGE CPP                #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.GHC.Conc.Windows-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'ConsoleEvent'.--}-module Instances.GHC.Conc.Windows () where--#if !defined(__GHCJS__) && defined(mingw32_HOST_OS)-import GHC.Conc.Windows (ConsoleEvent(..))-import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum)--deriving instance Bounded ConsoleEvent-instance Arbitrary ConsoleEvent where-    arbitrary = arbitraryBoundedEnum-#endif+{-# LANGUAGE CPP                #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.GHC.Conc.Windows
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'ConsoleEvent'.
+-}
+module Instances.GHC.Conc.Windows () where
+
+#if !defined(__GHCJS__) && defined(mingw32_HOST_OS)
+import GHC.Conc.Windows (ConsoleEvent(..))
+import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum)
+
+deriving instance Bounded ConsoleEvent
+instance Arbitrary ConsoleEvent where
+    arbitrary = arbitraryBoundedEnum
+#endif
tests/Instances/GHC/Event.hs view
@@ -1,28 +1,28 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.GHC.Event-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "GHC.Event" module.--}-module Instances.GHC.Event () where--#if !defined(__GHCJS__) && !defined(mingw32_HOST_OS) && MIN_VERSION_base(4,4,0)-import GHC.Event (Event, evtRead, evtWrite)--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..), oneof)--instance Arbitrary Event where-    arbitrary = oneof $ map pure [evtRead, evtWrite]---- TODO: instance Arbitrary FdKey-#endif+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.GHC.Event
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "GHC.Event" module.
+-}
+module Instances.GHC.Event () where
+
+#if !defined(__GHCJS__) && !defined(mingw32_HOST_OS) && MIN_VERSION_base(4,4,0)
+import GHC.Event (Event, evtRead, evtWrite)
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..), oneof)
+
+instance Arbitrary Event where
+    arbitrary = oneof $ map pure [evtRead, evtWrite]
+
+-- TODO: instance Arbitrary FdKey
+#endif
tests/Instances/GHC/Fingerprint.hs view
@@ -1,26 +1,26 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.GHC.Fingerprint-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'Fingerprint'.--}-module Instances.GHC.Fingerprint () where--#if MIN_VERSION_base(4,4,0)-import GHC.Fingerprint.Type (Fingerprint(..))--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance Arbitrary Fingerprint where-    arbitrary = Fingerprint <$> arbitrary <*> arbitrary-#endif+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.GHC.Fingerprint
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'Fingerprint'.
+-}
+module Instances.GHC.Fingerprint () where
+
+#if MIN_VERSION_base(4,4,0)
+import GHC.Fingerprint.Type (Fingerprint(..))
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance Arbitrary Fingerprint where
+    arbitrary = Fingerprint <$> arbitrary <*> arbitrary
+#endif
tests/Instances/GHC/Generics.hs view
@@ -1,60 +1,52 @@-{-# LANGUAGE CPP                        #-}--#if __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE FlexibleContexts           #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}-{-# LANGUAGE TypeOperators              #-}-#endif--{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.GHC.Generics-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "GHC.Generics" module.--}-module Instances.GHC.Generics () where--#if __GLASGOW_HASKELL__ >= 702-import GHC.Generics (U1(..), Par1(..), Rec1(..), K1(..),-                     M1(..), (:+:)(..), (:*:)(..), (:.:)(..),-                     Fixity(..), Associativity(..), Arity(..))--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof)--instance Arbitrary (U1 p) where-    arbitrary = pure U1--deriving instance Arbitrary p => Arbitrary (Par1 p)-deriving instance Arbitrary (f p) => Arbitrary (Rec1 f p)-deriving instance Arbitrary c => Arbitrary (K1 i c p)-deriving instance Arbitrary (f p) => Arbitrary (M1 i c f p)--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--deriving instance Arbitrary (f (g p)) => Arbitrary ((f :.: g) p)--instance Arbitrary Fixity where-    arbitrary = oneof [pure Prefix, 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]-#endif+{-# LANGUAGE FlexibleContexts           #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# LANGUAGE TypeOperators              #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.GHC.Generics
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "GHC.Generics" module.
+-}
+module Instances.GHC.Generics () where
+
+import Generics.Deriving.Base (U1(..), Par1(..), Rec1(..), K1(..),
+                               M1(..), (:+:)(..), (:*:)(..), (:.:)(..),
+                               Fixity(..), Associativity(..), Arity(..))
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof)
+
+instance Arbitrary (U1 p) where
+    arbitrary = pure U1
+
+deriving instance Arbitrary p         => Arbitrary (Par1 p)
+deriving instance Arbitrary (f p)     => Arbitrary (Rec1 f p)
+deriving instance Arbitrary c         => Arbitrary (K1 i c p)
+deriving instance Arbitrary (f p)     => Arbitrary (M1 i c f p)
+deriving instance Arbitrary (f (g p)) => Arbitrary ((f :.: g) p)
+
+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 Fixity where
+    arbitrary = oneof [pure Prefix, 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]
tests/Instances/GHC/RTS/Flags.hs view
@@ -1,35 +1,35 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.GHC.RTS.Flags-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "GHC.RTS.Flags" module.--}-module Instances.GHC.RTS.Flags () where--#if MIN_VERSION_base(4,8,0)-import GHC.RTS.Flags-import Test.QuickCheck (Arbitrary(..))--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-#endif+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.GHC.RTS.Flags
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "GHC.RTS.Flags" module.
+-}
+module Instances.GHC.RTS.Flags () where
+
+#if MIN_VERSION_base(4,8,0)
+import GHC.RTS.Flags
+import Test.QuickCheck (Arbitrary(..))
+
+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
+#endif
tests/Instances/GHC/StaticPtr.hs view
@@ -1,22 +1,22 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.GHC.StaticPtr-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'StaticPtrInfo'.--}-module Instances.GHC.StaticPtr () where--#if MIN_VERSION_base(4,8,0)-import GHC.StaticPtr (StaticPtrInfo(..))-import Test.QuickCheck (Arbitrary(..))--instance Arbitrary StaticPtrInfo where-    arbitrary = StaticPtrInfo <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary-#endif +{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.GHC.StaticPtr
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'StaticPtrInfo'.
+-}
+module Instances.GHC.StaticPtr () where
+
+#if MIN_VERSION_base(4,8,0)
+import GHC.StaticPtr (StaticPtrInfo(..))
+import Test.QuickCheck (Arbitrary(..))
+
+instance Arbitrary StaticPtrInfo where
+    arbitrary = StaticPtrInfo <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
+#endif 
tests/Instances/GHC/Stats.hs view
@@ -1,31 +1,31 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.GHC.Stats-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'GCStats'.--}-module Instances.GHC.Stats () where--#if MIN_VERSION_base(4,5,0)-import GHC.Stats (GCStats(..))--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--instance Arbitrary GCStats where-    arbitrary = GCStats <$> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary-                        <*> arbitrary <*> arbitrary <*> arbitrary-#endif+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.GHC.Stats
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'GCStats'.
+-}
+module Instances.GHC.Stats () where
+
+#if MIN_VERSION_base(4,5,0)
+import GHC.Stats (GCStats(..))
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+instance Arbitrary GCStats where
+    arbitrary = GCStats <$> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+                        <*> arbitrary <*> arbitrary <*> arbitrary
+#endif
tests/Instances/GHC/TypeLits.hs view
@@ -1,53 +1,53 @@-{-# LANGUAGE CPP       #-}--#if MIN_VERSION_base(4,6,0) && !(MIN_VERSION_base(4,7,0))-{-# LANGUAGE PolyKinds #-}-#endif--{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.GHC.TypeLits-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "GHC.TypeLits" module.--}-module Instances.GHC.TypeLits () where--#if MIN_VERSION_base(4,6,0)-import GHC.TypeLits--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..))--# if MIN_VERSION_base(4,7,0)-import Test.QuickCheck (getNonNegative)-# endif-#endif--#if MIN_VERSION_base(4,7,0)-instance Arbitrary SomeNat where-    arbitrary = do-        nat <- getNonNegative <$> arbitrary-        case someNatVal nat of-             Just sn -> pure sn-             Nothing -> fail "Negative natural number" -- Should never happen--instance Arbitrary SomeSymbol where-    arbitrary = someSymbolVal <$> arbitrary-#elif MIN_VERSION_base(4,6,0)-instance SingI a => Arbitrary (Sing a) where-    arbitrary = pure sing--instance SingI n => Arbitrary (IsZero n) where-    arbitrary = pure $ isZero sing--instance SingI n => Arbitrary (IsEven n) where-    arbitrary = pure $ isEven sing-#endif+{-# LANGUAGE CPP       #-}
+
+#if MIN_VERSION_base(4,6,0) && !(MIN_VERSION_base(4,7,0))
+{-# LANGUAGE PolyKinds #-}
+#endif
+
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.GHC.TypeLits
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "GHC.TypeLits" module.
+-}
+module Instances.GHC.TypeLits () where
+
+#if MIN_VERSION_base(4,6,0)
+import GHC.TypeLits
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..))
+
+# if MIN_VERSION_base(4,7,0)
+import Test.QuickCheck (getNonNegative)
+# endif
+#endif
+
+#if MIN_VERSION_base(4,7,0)
+instance Arbitrary SomeNat where
+    arbitrary = do
+        nat <- getNonNegative <$> arbitrary
+        case someNatVal nat of
+             Just sn -> pure sn
+             Nothing -> fail "Negative natural number" -- Should never happen
+
+instance Arbitrary SomeSymbol where
+    arbitrary = someSymbolVal <$> arbitrary
+#elif MIN_VERSION_base(4,6,0)
+instance SingI a => Arbitrary (Sing a) where
+    arbitrary = pure sing
+
+instance SingI n => Arbitrary (IsZero n) where
+    arbitrary = pure $ isZero sing
+
+instance SingI n => Arbitrary (IsEven n) where
+    arbitrary = pure $ isEven sing
+#endif
tests/Instances/Generic.hs view
@@ -1,28 +1,25 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Generic-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'ConType'.--}-module Instances.Generic () where--#if __GLASGOW_HASKELL__ >= 702-import Instances.Data.Text ()--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..), oneof)--import Text.Show.Text.Generic (ConType(..))--instance Arbitrary ConType where-    arbitrary = oneof [pure Rec, pure Tup, pure Pref, Inf <$> arbitrary]-#endif+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Generic
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'ConType'.
+-}
+module Instances.Generic () where
+
+import Instances.Data.Text ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..), oneof)
+
+import Text.Show.Text.Generic (ConType(..))
+
+instance Arbitrary ConType where
+    arbitrary = oneof [pure Rec, pure Tup, pure Pref, Inf <$> arbitrary]
tests/Instances/Numeric/Natural.hs view
@@ -1,35 +1,35 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Numeric.Natural-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance 'Natural' (if one isn't already defined).--}-module Instances.Numeric.Natural () where---- Copied from @QuickCheck@--#if !(MIN_VERSION_QuickCheck(2,8,0)) || !(MIN_VERSION_base(4,8,0))-import Numeric.Natural (Natural)-import Test.QuickCheck (Arbitrary(..), Gen,-                        choose, shrinkIntegral, sized, suchThat)--instance Arbitrary Natural where-    arbitrary = arbitrarySizedNatural-    shrink    = shrinkIntegral---- | Generates a natural number. The number's maximum value depends on--- the size parameter.-arbitrarySizedNatural :: Integral a => Gen a-arbitrarySizedNatural = sized $ \n ->-    inBounds fromInteger (choose (0, toInteger n))--inBounds :: Integral a => (Integer -> a) -> Gen Integer -> Gen a-inBounds fi g = fmap fi (g `suchThat` (\x -> toInteger (fi x) == x))-#endif+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Numeric.Natural
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance 'Natural' (if one isn't already defined).
+-}
+module Instances.Numeric.Natural () where
+
+-- Copied from @QuickCheck@
+
+#if !(MIN_VERSION_QuickCheck(2,8,0)) || !(MIN_VERSION_base(4,8,0))
+import Numeric.Natural (Natural)
+import Test.QuickCheck (Arbitrary(..), Gen,
+                        choose, shrinkIntegral, sized, suchThat)
+
+instance Arbitrary Natural where
+    arbitrary = arbitrarySizedNatural
+    shrink    = shrinkIntegral
+
+-- | Generates a natural number. The number's maximum value depends on
+-- the size parameter.
+arbitrarySizedNatural :: Integral a => Gen a
+arbitrarySizedNatural = sized $ \n ->
+    inBounds fromInteger (choose (0, toInteger n))
+
+inBounds :: Integral a => (Integer -> a) -> Gen Integer -> Gen a
+inBounds fi g = fmap fi (g `suchThat` (\x -> toInteger (fi x) == x))
+#endif
tests/Instances/System/Exit.hs view
@@ -1,23 +1,23 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.System.Exit-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instance for 'ExitCode'.--}-module Instances.System.Exit () where--import Prelude ()-import Prelude.Compat--import System.Exit (ExitCode(..))--import Test.QuickCheck (Arbitrary(..), oneof)--instance Arbitrary ExitCode where-    arbitrary = oneof [pure ExitSuccess, ExitFailure <$> arbitrary]+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.System.Exit
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instance for 'ExitCode'.
+-}
+module Instances.System.Exit () where
+
+import Prelude ()
+import Prelude.Compat
+
+import System.Exit (ExitCode(..))
+
+import Test.QuickCheck (Arbitrary(..), oneof)
+
+instance Arbitrary ExitCode where
+    arbitrary = oneof [pure ExitSuccess, ExitFailure <$> arbitrary]
tests/Instances/System/IO.hs view
@@ -1,70 +1,70 @@-{-# LANGUAGE CPP                #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.System.IO-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "System.IO" module.--}-module Instances.System.IO () where--#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 Prelude ()-import Prelude.Compat--import System.IO (BufferMode(..), IOMode(..), Newline(..), NewlineMode(..),-                  SeekMode(..), Handle, stdin, stdout, stderr)--import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof)--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--#if MIN_VERSION_base(4,4,0)-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-#endif--deriving instance Bounded Newline-deriving instance Enum Newline-instance Arbitrary Newline where-    arbitrary = arbitraryBoundedEnum--instance Arbitrary NewlineMode where-    arbitrary = NewlineMode <$> arbitrary <*> arbitrary+{-# LANGUAGE CPP                #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.System.IO
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "System.IO" module.
+-}
+module Instances.System.IO () where
+
+#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 Prelude ()
+import Prelude.Compat
+
+import System.IO (BufferMode(..), IOMode(..), Newline(..), NewlineMode(..),
+                  SeekMode(..), Handle, stdin, stdout, stderr)
+
+import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof)
+
+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
+
+#if MIN_VERSION_base(4,4,0)
+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
+#endif
+
+deriving instance Bounded Newline
+deriving instance Enum Newline
+instance Arbitrary Newline where
+    arbitrary = arbitraryBoundedEnum
+
+instance Arbitrary NewlineMode where
+    arbitrary = NewlineMode <$> arbitrary <*> arbitrary
tests/Instances/System/Posix/Types.hs view
@@ -1,126 +1,126 @@-{-# LANGUAGE CPP                        #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE StandaloneDeriving         #-}--{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.System.Posix.Types-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "System.Posix.Types" module.--}-module Instances.System.Posix.Types () where--import Instances.Foreign.C.Types ()-import System.Posix.Types-import Test.QuickCheck (Arbitrary(..))--#if !(MIN_VERSION_base(4,5,0))-import Data.Word-import Test.QuickCheck (Gen, arbitrarySizedBoundedIntegral)-import Unsafe.Coerce (unsafeCoerce)-#endif--#include "HsBaseConfig.h"--#if MIN_VERSION_base(4,5,0)-# 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-#else-# if defined(HTYPE_DEV_T)-instance Arbitrary CDev where-    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_DEV_T)-# endif-# if defined(HTYPE_INO_T)-instance Arbitrary CIno where-    arbitrary = arbitrarySizedBoundedIntegral-# endif-# if defined(HTYPE_MODE_T)-instance Arbitrary CMode where-    arbitrary = arbitrarySizedBoundedIntegral-# endif-# if defined(HTYPE_OFF_T)-instance Arbitrary COff where-    arbitrary = arbitrarySizedBoundedIntegral-# endif-# if defined(HTYPE_PID_T)-instance Arbitrary CPid where-    arbitrary = arbitrarySizedBoundedIntegral-# endif-# if defined(HTYPE_SSIZE_T)-instance Arbitrary CSsize where-    arbitrary = arbitrarySizedBoundedIntegral-# endif-# if defined(HTYPE_GID_T)-instance Arbitrary CGid where-    arbitrary = arbitrarySizedBoundedIntegral-# endif-# if defined(HTYPE_NLINK_T)-instance Arbitrary CNlink where-    arbitrary = arbitrarySizedBoundedIntegral-# endif-# if defined(HTYPE_UID_T)-instance Arbitrary CUid where-    arbitrary = arbitrarySizedBoundedIntegral-# endif-# if defined(HTYPE_CC_T)-instance Arbitrary CCc where-    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_CC_T)-# endif-# if defined(HTYPE_SPEED_T)-instance Arbitrary CSpeed where-    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_SPEED_T)-# endif-# if defined(HTYPE_TCFLAG_T)-instance Arbitrary CTcflag where-    arbitrary = arbitrarySizedBoundedIntegral-# endif-# if defined(HTYPE_RLIM_T)-instance Arbitrary CRLim where-    arbitrary = arbitrarySizedBoundedIntegral-# endif-#endif--deriving instance Arbitrary Fd+{-# LANGUAGE CPP                        #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.System.Posix.Types
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "System.Posix.Types" module.
+-}
+module Instances.System.Posix.Types () where
+
+import Instances.Foreign.C.Types ()
+import System.Posix.Types
+import Test.QuickCheck (Arbitrary(..))
+
+#if !(MIN_VERSION_base(4,5,0))
+import Data.Word
+import Test.QuickCheck (Gen, arbitrarySizedBoundedIntegral)
+import Unsafe.Coerce (unsafeCoerce)
+#endif
+
+#include "HsBaseConfig.h"
+
+#if MIN_VERSION_base(4,5,0)
+# 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
+#else
+# if defined(HTYPE_DEV_T)
+instance Arbitrary CDev where
+    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_DEV_T)
+# endif
+# if defined(HTYPE_INO_T)
+instance Arbitrary CIno where
+    arbitrary = arbitrarySizedBoundedIntegral
+# endif
+# if defined(HTYPE_MODE_T)
+instance Arbitrary CMode where
+    arbitrary = arbitrarySizedBoundedIntegral
+# endif
+# if defined(HTYPE_OFF_T)
+instance Arbitrary COff where
+    arbitrary = arbitrarySizedBoundedIntegral
+# endif
+# if defined(HTYPE_PID_T)
+instance Arbitrary CPid where
+    arbitrary = arbitrarySizedBoundedIntegral
+# endif
+# if defined(HTYPE_SSIZE_T)
+instance Arbitrary CSsize where
+    arbitrary = arbitrarySizedBoundedIntegral
+# endif
+# if defined(HTYPE_GID_T)
+instance Arbitrary CGid where
+    arbitrary = arbitrarySizedBoundedIntegral
+# endif
+# if defined(HTYPE_NLINK_T)
+instance Arbitrary CNlink where
+    arbitrary = arbitrarySizedBoundedIntegral
+# endif
+# if defined(HTYPE_UID_T)
+instance Arbitrary CUid where
+    arbitrary = arbitrarySizedBoundedIntegral
+# endif
+# if defined(HTYPE_CC_T)
+instance Arbitrary CCc where
+    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_CC_T)
+# endif
+# if defined(HTYPE_SPEED_T)
+instance Arbitrary CSpeed where
+    arbitrary = unsafeCoerce (arbitrary :: Gen HTYPE_SPEED_T)
+# endif
+# if defined(HTYPE_TCFLAG_T)
+instance Arbitrary CTcflag where
+    arbitrary = arbitrarySizedBoundedIntegral
+# endif
+# if defined(HTYPE_RLIM_T)
+instance Arbitrary CRLim where
+    arbitrary = arbitrarySizedBoundedIntegral
+# endif
+#endif
+
+deriving instance Arbitrary Fd
tests/Instances/Text/Read.hs view
@@ -1,65 +1,65 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}--{-|-Module:      Instances.Text.Read-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--'Arbitrary' instances for data types in the "Text.Read" module.--}-module Instances.Text.Read () where--import Prelude ()-import Prelude.Compat--import Test.QuickCheck (Arbitrary(..), oneof)--import Text.Read (Lexeme(..))--#if MIN_VERSION_base(4,7,0)-import Data.Fixed (Fixed, E12)-import Numeric (showEFloat, showFFloat, showGFloat, showHex, showOct)-import Test.QuickCheck (Gen, getNonNegative)-import Text.Read.Lex (Number)-#endif--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 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+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+{-|
+Module:      Instances.Text.Read
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+'Arbitrary' instances for data types in the "Text.Read" module.
+-}
+module Instances.Text.Read () where
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.QuickCheck (Arbitrary(..), oneof)
+
+import Text.Read (Lexeme(..))
+
+#if MIN_VERSION_base(4,7,0)
+import Data.Fixed (Fixed, E12)
+import Numeric (showEFloat, showFFloat, showGFloat, showHex, showOct)
+import Test.QuickCheck (Gen, getNonNegative)
+import Text.Read.Lex (Number)
+#endif
+
+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 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
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-f <@> x = fmap ($ x) f+{-|
+Module:      Properties.Instances
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+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/Spec.hs view
@@ -1,1 +1,1 @@-{-# OPTIONS_GHC -F -pgmF hspec-discover #-}+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
tests/Spec/BuilderSpec.hs view
@@ -1,50 +1,55 @@-{-|-Module:      Spec.BuilderSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for functions that manipulate 'Builder's.--}-module Spec.BuilderSpec (main, spec) where--import Instances.Data.Text ()--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--import Text.Show.Text (Builder, fromString, fromText, lengthB,-                       toString, toText, unlinesB, unwordsB)--main :: IO ()-main = hspec spec---- | 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)--spec :: Spec-spec = parallel . describe "Builder-related functions" $ do-    prop "lengthB output"             prop_lengthB-    prop "fromString . toString = id" prop_toString-    prop "fromText . toText = id"     prop_toText-    prop "unlinesB output"            prop_unlinesB-    prop "unwordsB output"            prop_unwordsB+{-|
+Module:      Spec.BuilderSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for functions that manipulate 'Builder's.
+-}
+module Spec.BuilderSpec (main, spec) where
+
+import Instances.Data.Text ()
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+import Text.Show.Text (Builder, fromString, fromText, lengthB,
+                       toString, toText, unlinesB, unwordsB)
+
+main :: IO ()
+main = hspec spec
+
+-- | 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)
+
+spec :: Spec
+spec = parallel $ do
+    describe "lengthB" $
+        prop "has the same output as length"  prop_lengthB
+    describe "toString" $
+        prop "fromString . toString = id"     prop_toString
+    describe "toText" $
+        prop "fromText . toText = id"         prop_toText
+    describe "unlinesB" $
+        prop "has the same output as unlines" prop_unlinesB
+    describe "unwordsB" $
+        prop "has the same output as unwords" prop_unwordsB
tests/Spec/Control/ApplicativeSpec.hs view
@@ -1,38 +1,37 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Control.ApplicativeSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "Control.Applicative" module.--}-module Spec.Control.ApplicativeSpec (main, spec) where--import Control.Applicative (Const, ZipList)--import Data.Orphans ()--import Instances.Control.Applicative ()--import Spec.Utils (prop_matchesShow)-#if __GLASGOW_HASKELL__ >= 702-import Spec.Utils (prop_genericShow)-#endif--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Control.Applicative" $ do-    prop "Const Int Int instance"   (prop_matchesShow :: Int -> Const Int Int -> Bool)-    prop "ZipList Int instance"     (prop_matchesShow :: Int -> ZipList Int -> Bool)-#if __GLASGOW_HASKELL__ >= 702-    prop "ZipList Int generic show" (prop_genericShow :: Int -> ZipList Int -> Bool)-#endif+{-|
+Module:      Spec.Control.ApplicativeSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "Control.Applicative" module.
+-}
+module Spec.Control.ApplicativeSpec (main, spec) where
+
+import Control.Applicative (Const, ZipList)
+
+import Data.Orphans ()
+
+import Generics.Deriving.Instances ()
+
+import Instances.Control.Applicative ()
+
+import Spec.Utils (prop_matchesShow, prop_matchesShow2,
+                   prop_genericShow, prop_genericShow1)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Const Int Int" $
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> Const Int Int -> Bool)
+    describe "ZipList Int" $ do
+        prop "Show instance"  (prop_matchesShow  :: Int -> ZipList Int -> Bool)
+        prop "generic Show"   (prop_genericShow  :: Int -> ZipList Int -> Bool)
+        prop "generic Show1"  (prop_genericShow1 :: Int -> ZipList Int -> Bool)
tests/Spec/Control/ConcurrentSpec.hs view
@@ -1,31 +1,34 @@-module Spec.Control.ConcurrentSpec (main, spec) where--import Control.Concurrent (myThreadId)--import GHC.Conc (BlockReason, ThreadStatus)--import Instances.Control.Concurrent ()--import Prelude ()-import Prelude.Compat--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)-import Test.QuickCheck (Property, ioProperty)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Control.Concurrent" $ do-    prop "BlockReason instance"  (prop_matchesShow :: Int -> BlockReason -> Bool)-    prop "ThreadId instance"     prop_showThreadId-    prop "ThreadStatus instance" (prop_matchesShow :: Int -> ThreadStatus -> Bool)---- | Verifies the 'Show' instance for 'ThreadId' is accurate.-prop_showThreadId :: Int -> Property-prop_showThreadId p = ioProperty $ do-    tid <- myThreadId-    pure $ prop_matchesShow p tid+module Spec.Control.ConcurrentSpec (main, spec) where
+
+import Control.Concurrent (myThreadId)
+
+import GHC.Conc (BlockReason, ThreadStatus)
+
+import Instances.Control.Concurrent ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+import Test.QuickCheck (Property, ioProperty)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "BlockReason" $
+        prop "Show instance" (prop_matchesShow :: Int -> BlockReason -> Bool)
+    describe "ThreadId" $
+        prop "Show instance" prop_showThreadId
+    describe "ThreadStatus" $
+        prop "Show instance" (prop_matchesShow :: Int -> ThreadStatus -> Bool)
+
+-- | Verifies the 'Show' instance for 'ThreadId' is accurate.
+prop_showThreadId :: Int -> Property
+prop_showThreadId p = ioProperty $ do
+    tid <- myThreadId
+    pure $ prop_matchesShow p tid
tests/Spec/Control/ExceptionSpec.hs view
@@ -1,52 +1,72 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Control.ExceptionSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "Control.Exception" module.--}-module Spec.Control.ExceptionSpec (main, spec) where--import Control.Exception--import Instances.Control.Exception ()--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Control.Exception" $ do-    prop "SomeException instance"             (prop_matchesShow :: Int -> SomeException -> Bool)-    prop "IOException instance"               (prop_matchesShow :: Int -> IOException -> Bool)-    prop "ArithException instance"            (prop_matchesShow :: Int -> ArithException -> Bool)-    prop "ArrayException instance"            (prop_matchesShow :: Int -> ArrayException -> Bool)-    prop "AssertionFailed instance"           (prop_matchesShow :: Int -> AssertionFailed -> Bool)-#if MIN_VERSION_base(4,7,0)-    prop "SomeAsyncException instance"        (prop_matchesShow :: Int -> SomeAsyncException -> Bool)-#endif-    prop "AsyncException instance"            (prop_matchesShow :: Int -> AsyncException -> Bool)-    prop "NonTermination instance"            (prop_matchesShow :: Int -> NonTermination -> Bool)-    prop "NestedAtomically instance"          (prop_matchesShow :: Int -> NestedAtomically -> Bool)-    prop "BlockedIndefinitelyOnMVar instance" (prop_matchesShow :: Int -> BlockedIndefinitelyOnMVar -> Bool)-    prop "BlockedIndefinitelyOnSTM instance"  (prop_matchesShow :: Int -> BlockedIndefinitelyOnSTM -> Bool)-#if MIN_VERSION_base(4,8,0)-    prop "AllocationLimitExceeded instance"   (prop_matchesShow :: Int -> AllocationLimitExceeded -> Bool)-#endif-    prop "Deadlock instance"                  (prop_matchesShow :: Int -> Deadlock -> Bool)-    prop "NoMethodError instance"             (prop_matchesShow :: Int -> NoMethodError -> Bool)-    prop "PatternMatchFail instance"          (prop_matchesShow :: Int -> PatternMatchFail -> Bool)-    prop "RecConError instance"               (prop_matchesShow :: Int -> RecConError -> Bool)-    prop "RecSelError instance"               (prop_matchesShow :: Int -> RecSelError -> Bool)-    prop "RecUpdError instance"               (prop_matchesShow :: Int -> RecUpdError -> Bool)-    prop "ErrorCall instance"                 (prop_matchesShow :: Int -> ErrorCall -> Bool)-    prop "MaskingState instance"              (prop_matchesShow :: Int -> MaskingState -> Bool)+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Control.ExceptionSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "Control.Exception" module.
+-}
+module Spec.Control.ExceptionSpec (main, spec) where
+
+import Control.Exception
+
+import Instances.Control.Exception ()
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Text.Show.Text.Control.Exception" $ do
+    describe "SomeException" $
+        prop "Show instance" (prop_matchesShow :: Int -> SomeException -> Bool)
+    describe "IOException" $
+        prop "Show instance" (prop_matchesShow :: Int -> IOException -> Bool)
+    describe "ArithException" $
+        prop "Show instance" (prop_matchesShow :: Int -> ArithException -> Bool)
+    describe "ArrayException" $
+        prop "Show instance" (prop_matchesShow :: Int -> ArrayException -> Bool)
+    describe "AssertionFailed" $
+        prop "Show instance" (prop_matchesShow :: Int -> AssertionFailed -> Bool)
+#if MIN_VERSION_base(4,7,0)
+    describe "SomeAsyncException" $
+        prop "Show instance" (prop_matchesShow :: Int -> SomeAsyncException -> Bool)
+#endif
+    describe "AsyncException" $
+        prop "Show instance" (prop_matchesShow :: Int -> AsyncException -> Bool)
+    describe "NonTermination" $
+        prop "Show instance" (prop_matchesShow :: Int -> NonTermination -> Bool)
+    describe "NestedAtomically" $
+        prop "Show instance" (prop_matchesShow :: Int -> NestedAtomically -> Bool)
+    describe "BlockedIndefinitelyOnMVar" $
+        prop "Show instance" (prop_matchesShow :: Int -> BlockedIndefinitelyOnMVar -> Bool)
+    describe "BlockedIndefinitelyOnSTM" $
+        prop "Show instance" (prop_matchesShow :: Int -> BlockedIndefinitelyOnSTM -> Bool)
+#if MIN_VERSION_base(4,8,0)
+    describe "AllocationLimitExceeded" $
+        prop "Show instance" (prop_matchesShow :: Int -> AllocationLimitExceeded -> Bool)
+#endif
+    describe "Deadlock" $
+        prop "Show instance" (prop_matchesShow :: Int -> Deadlock -> Bool)
+    describe "NoMethodError" $
+        prop "Show instance" (prop_matchesShow :: Int -> NoMethodError -> Bool)
+    describe "PatternMatchFail" $
+        prop "Show instance" (prop_matchesShow :: Int -> PatternMatchFail -> Bool)
+    describe "RecConError" $
+        prop "Show instance" (prop_matchesShow :: Int -> RecConError -> Bool)
+    describe "RecSelError" $
+        prop "Show instance" (prop_matchesShow :: Int -> RecSelError -> Bool)
+    describe "RecUpdError" $
+        prop "Show instance" (prop_matchesShow :: Int -> RecUpdError -> Bool)
+    describe "ErrorCall" $
+        prop "Show instance" (prop_matchesShow :: Int -> ErrorCall -> Bool)
+    describe "MaskingState" $
+        prop "Show instance" (prop_matchesShow :: Int -> MaskingState -> Bool)
tests/Spec/Control/Monad/STSpec.hs view
@@ -1,17 +1,17 @@-module Spec.Control.Monad.STSpec (main, spec) where--import Control.Monad.ST--import Instances.Control.Monad.ST ()--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Control.Monad.ST" $-    prop "ST instance" (prop_matchesShow :: Int -> ST Int Int -> Bool)+module Spec.Control.Monad.STSpec (main, spec) where
+
+import Control.Monad.ST
+
+import Instances.Control.Monad.ST ()
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "ST Int Int" $
+    prop "Show instance" (prop_matchesShow :: Int -> ST Int Int -> Bool)
tests/Spec/Data/ArraySpec.hs view
@@ -1,43 +1,44 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.ArraySpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for array data types.--}-module Spec.Data.ArraySpec (main, spec) where--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)-import Test.QuickCheck.Instances ()--#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)-import Data.Array (Array)-import Data.Array.Unboxed (UArray)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)--- TODO: Figure out why these tests diverge on Windows-    describe "Text.Show.Text.Data.Array" $ do-        prop "Array Int Int instance"  (prop_matchesShow :: Int -> Array Int Int -> Bool)-        prop "UArray Int Int instance" (prop_matchesShow :: Int -> UArray Int Int -> Bool)-#else-    pure ()-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Data.ArraySpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for array data types.
+-}
+module Spec.Data.ArraySpec (main, spec) where
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+import Test.QuickCheck.Instances ()
+
+#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)
+import Data.Array (Array)
+import Data.Array.Unboxed (UArray)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)
+-- TODO: Figure out why these tests diverge on Windows
+    describe "Array Int Int" $
+        prop "Show instance" (prop_matchesShow :: Int -> Array Int Int -> Bool)
+    describe "UArray Int Int" $
+        prop "Show instance" (prop_matchesShow :: Int -> UArray Int Int -> Bool)
+#else
+    pure ()
+#endif
tests/Spec/Data/BoolSpec.hs view
@@ -1,31 +1,26 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.BoolSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for 'Bool'.--}-module Spec.Data.BoolSpec (main, spec) where--import Spec.Utils (prop_matchesShow)-#if __GLASGOW_HASKELL__ >= 702-import Spec.Utils (prop_genericShow)-#endif--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Bool" $ do-    prop "Bool instance"     (prop_matchesShow :: Int -> Bool -> Bool)-#if __GLASGOW_HASKELL__ >= 702-    prop "Bool generic show" (prop_genericShow :: Int -> Bool -> Bool)-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Data.BoolSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for 'Bool'.
+-}
+module Spec.Data.BoolSpec (main, spec) where
+
+import Spec.Utils (prop_matchesShow, prop_genericShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Bool" $ do
+    prop "Show instance" (prop_matchesShow :: Int -> Bool -> Bool)
+    prop "generic Show"  (prop_genericShow :: Int -> Bool -> Bool)
tests/Spec/Data/ByteStringSpec.hs view
@@ -1,32 +1,35 @@-{-|-Module:      Spec.Data.ByteStringSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the @bytestring@ library.--}-module Spec.Data.ByteStringSpec (main, spec) where--import qualified Data.ByteString      as BS (ByteString)-import qualified Data.ByteString.Lazy as BL (ByteString)-import           Data.ByteString.Short (ShortByteString)--import           Instances.Data.ByteString ()--import           Spec.Utils (prop_matchesShow)--import           Test.Hspec (Spec, describe, hspec, parallel)-import           Test.Hspec.QuickCheck (prop)-import           Test.QuickCheck.Instances ()--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.ByteString" $ do-    prop "strict ByteString instance" (prop_matchesShow :: Int -> BS.ByteString -> Bool)-    prop "lazy ByteString instance"   (prop_matchesShow :: Int -> BL.ByteString -> Bool)-    prop "ShortByteString instance"   (prop_matchesShow :: Int -> ShortByteString -> Bool)+{-|
+Module:      Spec.Data.ByteStringSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the @bytestring@ library.
+-}
+module Spec.Data.ByteStringSpec (main, spec) where
+
+import qualified Data.ByteString      as BS (ByteString)
+import qualified Data.ByteString.Lazy as BL (ByteString)
+import           Data.ByteString.Short (ShortByteString)
+
+import           Instances.Data.ByteString ()
+
+import           Spec.Utils (prop_matchesShow)
+
+import           Test.Hspec (Spec, describe, hspec, parallel)
+import           Test.Hspec.QuickCheck (prop)
+import           Test.QuickCheck.Instances ()
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "strict ByteString" $
+        prop "Show instance" (prop_matchesShow :: Int -> BS.ByteString -> Bool)
+    describe "lazy ByteString" $
+        prop "Show instance" (prop_matchesShow :: Int -> BL.ByteString -> Bool)
+    describe "ShortByteString" $
+        prop "Show instance" (prop_matchesShow :: Int -> ShortByteString -> Bool)
tests/Spec/Data/CharSpec.hs view
@@ -1,35 +1,38 @@-{-|-Module:      Spec.Data.CharSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "Data.Char" module.--}-module Spec.Data.CharSpec (main, spec) where--import Data.Array (elems)-import Data.Char (GeneralCategory)--import GHC.Show (asciiTab)--import Instances.Data.Char ()--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, it, parallel, shouldBe)-import Test.Hspec.QuickCheck (prop)--import Text.Show.Text (fromString)-import Text.Show.Text.Data.Char (asciiTabB)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Char" $ do-    prop "Char instance"            (prop_matchesShow :: Int -> Char -> Bool)-    prop "GeneralCategory instance" (prop_matchesShow :: Int -> GeneralCategory -> Bool)-    it   "asciiTab = asciiTabB"   $ map fromString asciiTab `shouldBe` elems asciiTabB+{-|
+Module:      Spec.Data.CharSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "Data.Char" module.
+-}
+module Spec.Data.CharSpec (main, spec) where
+
+import Data.Array (elems)
+import Data.Char (GeneralCategory)
+
+import GHC.Show (asciiTab)
+
+import Instances.Data.Char ()
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, it, parallel, shouldBe)
+import Test.Hspec.QuickCheck (prop)
+
+import Text.Show.Text (fromString)
+import Text.Show.Text.Data.Char (asciiTabB)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Char" $
+        prop "Show instance"   (prop_matchesShow :: Int -> Char -> Bool)
+    describe "GeneralCategory" $
+        prop "Show instance"   (prop_matchesShow :: Int -> GeneralCategory -> Bool)
+    describe "asciiTabB" $
+        it "equals asciiTab" $ map fromString asciiTab `shouldBe` elems asciiTabB
tests/Spec/Data/ComplexSpec.hs view
@@ -1,25 +1,25 @@-{-|-Module:      Spec.Data.ComplexSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'Complex'.--}-module Spec.Data.ComplexSpec (main, spec) where--import Data.Complex (Complex)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Complex" $-    prop "Complex Double instance" (prop_matchesShow :: Int -> Complex Double -> Bool)+{-|
+Module:      Spec.Data.ComplexSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for 'Complex'.
+-}
+module Spec.Data.ComplexSpec (main, spec) where
+
+import Data.Complex (Complex)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Complex Double" $
+    prop "Show instance" (prop_matchesShow :: Int -> Complex Double -> Bool)
tests/Spec/Data/DataSpec.hs view
@@ -1,31 +1,36 @@-{-|-Module:      Spec.Data.DataSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "Data.Data" module.--}-module Spec.Data.DataSpec (main, spec) where--import Data.Data (Constr, ConstrRep, DataRep, DataType, Fixity)--import Instances.Data.Data ()--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Data" $ do-    prop "Constr instance"    (prop_matchesShow :: Int -> Constr -> Bool)-    prop "ConstrRep instance" (prop_matchesShow :: Int -> ConstrRep -> Bool)-    prop "DataRep instance"   (prop_matchesShow :: Int -> DataRep -> Bool)-    prop "DataType instance"  (prop_matchesShow :: Int -> DataType -> Bool)-    prop "Fixity instance"    (prop_matchesShow :: Int -> Fixity -> Bool)+{-|
+Module:      Spec.Data.DataSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "Data.Data" module.
+-}
+module Spec.Data.DataSpec (main, spec) where
+
+import Data.Data (Constr, ConstrRep, DataRep, DataType, Fixity)
+
+import Instances.Data.Data ()
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Constr" $
+        prop "Show instance" (prop_matchesShow :: Int -> Constr -> Bool)
+    describe "ConstrRep" $
+        prop "Show instance" (prop_matchesShow :: Int -> ConstrRep -> Bool)
+    describe "DataRep" $
+        prop "Show instance" (prop_matchesShow :: Int -> DataRep -> Bool)
+    describe "DataType" $
+        prop "Show instance" (prop_matchesShow :: Int -> DataType -> Bool)
+    describe "Fixity" $
+        prop "Show instance" (prop_matchesShow :: Int -> Fixity -> Bool)
tests/Spec/Data/DynamicSpec.hs view
@@ -1,27 +1,27 @@-{-|-Module:      Spec.Data.DynamicSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'Dynamic'.--}-module Spec.Data.DynamicSpec (main, spec) where--import Data.Dynamic (Dynamic)--import Instances.Data.Dynamic ()--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Dynamic" $-    prop "Dynamic instance" (prop_matchesShow :: Int -> Dynamic -> Bool)+{-|
+Module:      Spec.Data.DynamicSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for 'Dynamic'.
+-}
+module Spec.Data.DynamicSpec (main, spec) where
+
+import Data.Dynamic (Dynamic)
+
+import Instances.Data.Dynamic ()
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Dynamic" $
+    prop "Show instance" (prop_matchesShow :: Int -> Dynamic -> Bool)
tests/Spec/Data/EitherSpec.hs view
@@ -1,33 +1,27 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.EitherSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for 'Either'.--}-module Spec.Data.EitherSpec (main, spec) where--import Data.Orphans ()--import Spec.Utils (prop_matchesShow)-#if __GLASGOW_HASKELL__ >= 702-import Spec.Utils (prop_genericShow)-#endif--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Either" $ do-    prop "Either Int Int instance"     (prop_matchesShow :: Int -> Either Int Int -> Bool)-#if __GLASGOW_HASKELL__ >= 702-    prop "Either Int Int generic show" (prop_genericShow :: Int -> Either Int Int -> Bool)-#endif+{-|
+Module:      Spec.Data.EitherSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for 'Either'.
+-}
+module Spec.Data.EitherSpec (main, spec) where
+
+import Generics.Deriving.Instances ()
+
+import Spec.Utils (prop_matchesShow2, prop_genericShow, prop_genericShow1)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Either Int Int" $ do
+    prop "Show2 instance" (prop_matchesShow2 :: Int -> Either Int Int -> Bool)
+    prop "generic Show"   (prop_genericShow  :: Int -> Either Int Int -> Bool)
+    prop "generic Show1"  (prop_genericShow1 :: Int -> Either Int Int -> Bool)
tests/Spec/Data/FixedSpec.hs view
@@ -1,39 +1,47 @@-{-|-Module:      Spec.Data.FixedSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'Fixed' values.--}-module Spec.Data.FixedSpec (main, spec) where--import Data.Fixed (Fixed, E0, E1, E2, E3, E6, E9, E12, showFixed)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--import Text.Show.Text (fromString)-import Text.Show.Text.Data.Fixed (showbFixed)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Fixed" $ do-    prop "Fixed E0 instance"  (prop_matchesShow :: Int -> Fixed E0 -> Bool)-    prop "Fixed E1 instance"  (prop_matchesShow :: Int -> Fixed E1 -> Bool)-    prop "Fixed E2 instance"  (prop_matchesShow :: Int -> Fixed E2 -> Bool)-    prop "Fixed E3 instance"  (prop_matchesShow :: Int -> Fixed E3 -> Bool)-    prop "Fixed E6 instance"  (prop_matchesShow :: Int -> Fixed E6 -> Bool)-    prop "Fixed E9 instance"  (prop_matchesShow :: Int -> Fixed E9 -> Bool)-    prop "Fixed E12 instance" (prop_matchesShow :: Int -> Fixed E12 -> Bool)-    prop "showFixed output"   prop_showFixed---- | 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+{-|
+Module:      Spec.Data.FixedSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for 'Fixed' values.
+-}
+module Spec.Data.FixedSpec (main, spec) where
+
+import Data.Fixed (Fixed, E0, E1, E2, E3, E6, E9, E12, showFixed)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+import Text.Show.Text (fromString)
+import Text.Show.Text.Data.Fixed (showbFixed)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Fixed E0" $
+        prop "Show instance"                    (prop_matchesShow :: Int -> Fixed E0 -> Bool)
+    describe "Fixed E1" $
+        prop "Show instance"                    (prop_matchesShow :: Int -> Fixed E1 -> Bool)
+    describe "Fixed E2" $
+        prop "Show instance"                    (prop_matchesShow :: Int -> Fixed E2 -> Bool)
+    describe "Fixed E3" $
+        prop "Show instance"                    (prop_matchesShow :: Int -> Fixed E3 -> Bool)
+    describe "Fixed E6" $
+        prop "Show instance"                    (prop_matchesShow :: Int -> Fixed E6 -> Bool)
+    describe "Fixed E9" $
+        prop "Show instance"                    (prop_matchesShow :: Int -> Fixed E9 -> Bool)
+    describe "Fixed E12" $
+        prop "Show instance"                    (prop_matchesShow :: Int -> Fixed E12 -> Bool)
+    describe "showbFixed" $
+        prop "has the same output as showFixed" prop_showFixed
+
+-- | 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
tests/Spec/Data/FloatingSpec.hs view
@@ -1,54 +1,62 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.FloatingSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for floating-point data types.--}-module Spec.Data.FloatingSpec (main, spec) where--import Data.Text.Lazy.Builder.RealFloat (FPFormat)--import Instances.Data.Floating ()--import Numeric.Compat (showEFloat, showFFloat, showGFloat,-                       showFFloatAlt, showGFloatAlt)--import Prelude ()-import Prelude.Compat--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)-import Test.QuickCheck (Gen, arbitrary, suchThat)--import Text.Show.Text (Builder, fromString)-import Text.Show.Text.Data.Floating (showbEFloat, showbFFloat, showbGFloat,-                                     showbFFloatAlt, showbGFloatAlt)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Floating" $ do-    prop "Float instance"          (prop_matchesShow :: Int -> Float -> Bool)-    prop "Double instance"         (prop_matchesShow :: Int -> Double -> Bool)-    prop "showbEFloat output"    $ prop_showXFloat showEFloat showbEFloat-    prop "showbFFloat output"    $ prop_showXFloat showFFloat showbFFloat-    prop "showbGFloat output"    $ prop_showXFloat showGFloat showbGFloat-    prop "showbFFloatAlt output" $ prop_showXFloat showFFloatAlt showbFFloatAlt-    prop "showbGFloatAlt output" $ prop_showXFloat showGFloatAlt showbGFloatAlt-    prop "FPFormat instance"       (prop_matchesShow :: Int -> FPFormat -> Bool)---- | 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+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Data.FloatingSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for floating-point data types.
+-}
+module Spec.Data.FloatingSpec (main, spec) where
+
+import Data.Text.Lazy.Builder.RealFloat (FPFormat)
+
+import Instances.Data.Floating ()
+
+import Numeric.Compat (showEFloat, showFFloat, showGFloat,
+                       showFFloatAlt, showGFloatAlt)
+
+import Prelude ()
+import Prelude.Compat
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+import Test.QuickCheck (Gen, arbitrary, suchThat)
+
+import Text.Show.Text (Builder, fromString)
+import Text.Show.Text.Data.Floating (showbEFloat, showbFFloat, showbGFloat,
+                                     showbFFloatAlt, showbGFloatAlt)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Float" $
+        prop "Show instance"                          (prop_matchesShow :: Int -> Float -> Bool)
+    describe "Double" $
+        prop "Show instance"                          (prop_matchesShow :: Int -> Double -> Bool)
+    describe "showbEFloat" $
+        prop "has the same output as showEFloat" $    prop_showXFloat showEFloat showbEFloat
+    describe "showbFFloat" $
+        prop "has the same output as showFFloat" $    prop_showXFloat showFFloat showbFFloat
+    describe "showbGFloat" $
+        prop "has the same output as showGFloat" $    prop_showXFloat showGFloat showbGFloat
+    describe "showbFFloatAlt" $
+        prop "has the same output as showFFloatAlt" $ prop_showXFloat showFFloatAlt showbFFloatAlt
+    describe "showbGFloatAlt" $
+        prop "has the same output as showFFloatAlt" $ prop_showXFloat showGFloatAlt showbGFloatAlt
+    describe "FPFormat" $
+        prop "Show instance"                          (prop_matchesShow :: Int -> FPFormat -> Bool)
+
+-- | 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
tests/Spec/Data/Functor/IdentitySpec.hs view
@@ -1,28 +1,28 @@-{-|-Module:      Spec.Data.Functor.Identity-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'Identity'.--}-module Spec.Data.Functor.IdentitySpec (main, spec) where--import Data.Functor.Classes ()-import Data.Functor.Identity (Identity)--import Instances.Data.Functor.Identity ()--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Functor.Identity" $ -    prop "Identity Int instance"     (prop_matchesShow :: Int -> Identity Int -> Bool)+{-|
+Module:      Spec.Data.Functor.Identity
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for 'Identity'.
+-}
+module Spec.Data.Functor.IdentitySpec (main, spec) where
+
+import Data.Functor.Classes ()
+import Data.Functor.Identity (Identity)
+
+import Instances.Data.Functor.Identity ()
+
+import Spec.Utils (prop_matchesShow1)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Identity Int" $
+    prop "Show1 instance" (prop_matchesShow1 :: Int -> Identity Int -> Bool)
tests/Spec/Data/IntegralSpec.hs view
@@ -1,64 +1,76 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.IntegralSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for integral data types.--}-module Spec.Data.IntegralSpec (main, spec) where--import Data.Int (Int8, Int16, Int32, Int64)-import Data.Word (Word8, Word16, Word32, Word64)--import Prelude ()-import Prelude.Compat--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)-import Control.Applicative (liftA2)-import Data.Char (intToDigit)-import Numeric (showIntAtBase)-import Test.QuickCheck (Gen, arbitrary, getNonNegative, suchThat)--import Text.Show.Text (fromString)-import Text.Show.Text.Data.Integral (showbIntAtBase)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Integral" $ do-    prop "Int instance"          (prop_matchesShow :: Int -> Int -> Bool)-    prop "Int8 instance"         (prop_matchesShow :: Int -> Int8 -> Bool)-    prop "Int16 instance"        (prop_matchesShow :: Int -> Int16 -> Bool)-    prop "Int32 instance"        (prop_matchesShow :: Int -> Int32 -> Bool)-    prop "Int64 instance"        (prop_matchesShow :: Int -> Int64 -> Bool)-    prop "Integer instance"      (prop_matchesShow :: Int -> Integer -> Bool)-    prop "Word instance"         (prop_matchesShow :: Int -> Word -> Bool)-    prop "Word8 instance"        (prop_matchesShow :: Int -> Word8 -> Bool)-    prop "Word16 instance"       (prop_matchesShow :: Int -> Word16 -> Bool)-    prop "Word32 instance"       (prop_matchesShow :: Int -> Word32 -> Bool)-    prop "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-    prop "showbIntAtBase output" prop_showIntAtBase-#endif---- | 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    <- getNonNegative <$> arbitrary :: Gen Int-    pure $ fromString (showIntAtBase base intToDigit i "") == showbIntAtBase base intToDigit i-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Data.IntegralSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for integral data types.
+-}
+module Spec.Data.IntegralSpec (main, spec) where
+
+import Data.Int (Int8, Int16, Int32, Int64)
+import Data.Word (Word8, Word16, Word32, Word64)
+
+import Prelude ()
+import Prelude.Compat
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+#if !defined(mingw32_HOST_OS) && MIN_VERSION_text(1,0,0)
+import Control.Applicative (liftA2)
+import Data.Char (intToDigit)
+import Numeric (showIntAtBase)
+import Test.QuickCheck (Gen, arbitrary, getNonNegative, suchThat)
+
+import Text.Show.Text (fromString)
+import Text.Show.Text.Data.Integral (showbIntAtBase)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Int" $
+        prop "Show instance"                        (prop_matchesShow :: Int -> Int -> Bool)
+    describe "Int8" $
+        prop "Show instance"                        (prop_matchesShow :: Int -> Int8 -> Bool)
+    describe "Int16" $
+        prop "Show instance"                        (prop_matchesShow :: Int -> Int16 -> Bool)
+    describe "Int32" $
+        prop "Show instance"                        (prop_matchesShow :: Int -> Int32 -> Bool)
+    describe "Int64" $
+        prop "Show instance"                        (prop_matchesShow :: Int -> Int64 -> Bool)
+    describe "Integer" $
+        prop "Show instance"                        (prop_matchesShow :: Int -> Integer -> Bool)
+    describe "Word" $
+        prop "Show instance"                        (prop_matchesShow :: Int -> Word -> Bool)
+    describe "Word8" $
+        prop "Show instance"                        (prop_matchesShow :: Int -> Word8 -> Bool)
+    describe "Word16" $
+        prop "Show instance"                        (prop_matchesShow :: Int -> Word16 -> Bool)
+    describe "Word32" $
+        prop "Show instance"                        (prop_matchesShow :: Int -> Word32 -> Bool)
+    describe "Word64" $
+        prop "Show 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
+    describe "showbIntAtBase" $
+        prop "has the same output as showIntAtBase" prop_showIntAtBase
+#endif
+
+-- | 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    <- getNonNegative <$> arbitrary :: Gen Int
+    pure $ fromString (showIntAtBase base intToDigit i "") == showbIntAtBase base intToDigit i
+#endif
tests/Spec/Data/ListSpec.hs view
@@ -1,34 +1,38 @@-{-|-Module:      Spec.Data.ListSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for lists.--}-module Spec.Data.ListSpec (main, spec) where--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--import Text.Show (showListWith)-import Text.Show.Text (fromString, showb)-import Text.Show.Text.Data.List (showbListWith)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.List" $ do-    prop "String instance"      (prop_matchesShow :: Int -> String -> Bool)-    prop "[String] instance"    (prop_matchesShow :: Int -> [String] -> Bool)-    prop "[Int] instance"       (prop_matchesShow :: Int -> [Int] -> Bool)-    prop "showbListWith output" prop_showListWith---- | Verifies 'showListWith' and 'showbListWith' generate the same output.-prop_showListWith :: String -> Bool-prop_showListWith str = fromString (showListWith shows str "") == showbListWith showb str+{-|
+Module:      Spec.Data.ListSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for lists.
+-}
+module Spec.Data.ListSpec (main, spec) where
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+import Text.Show (showListWith)
+import Text.Show.Text (fromString, showb)
+import Text.Show.Text.Data.List (showbListWith)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "String" $
+        prop "Show instance"                       (prop_matchesShow :: Int -> String -> Bool)
+    describe "[String]" $
+        prop "Show instance"                       (prop_matchesShow :: Int -> [String] -> Bool)
+    describe "[Int]" $
+        prop "Show instance"                       (prop_matchesShow :: Int -> [Int] -> Bool)
+    describe "showbListWith" $
+        prop "has the same output as showListWith" prop_showListWith
+
+-- | Verifies 'showListWith' and 'showbListWith' generate the same output.
+prop_showListWith :: String -> Bool
+prop_showListWith str = fromString (showListWith shows str "") == showbListWith showb str
tests/Spec/Data/MaybeSpec.hs view
@@ -1,33 +1,27 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.MaybeSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for 'Maybe'.--}-module Spec.Data.MaybeSpec (main, spec) where--import Data.Orphans ()--import Spec.Utils (prop_matchesShow)-#if __GLASGOW_HASKELL__ >= 702-import Spec.Utils (prop_genericShow)-#endif--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Maybe" $ do-        prop "Maybe Int instance"     (prop_matchesShow :: Int -> Maybe Int -> Bool)-#if __GLASGOW_HASKELL__ >= 702-        prop "Maybe Int generic show" (prop_genericShow :: Int -> Maybe Int -> Bool)-#endif+{-|
+Module:      Spec.Data.MaybeSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for 'Maybe'.
+-}
+module Spec.Data.MaybeSpec (main, spec) where
+
+import Data.Orphans ()
+
+import Spec.Utils (prop_matchesShow1, prop_genericShow, prop_genericShow1)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Maybe Int" $ do
+    prop "Show1 instance" (prop_matchesShow1 :: Int -> Maybe Int -> Bool)
+    prop "generic Show"   (prop_genericShow  :: Int -> Maybe Int -> Bool)
+    prop "generic Show1"  (prop_genericShow1 :: Int -> Maybe Int -> Bool)
tests/Spec/Data/MonoidSpec.hs view
@@ -1,54 +1,62 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.MonoidSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "Data.Monoid" module.--}-module Spec.Data.MonoidSpec (main, spec) where--import Data.Monoid-import Data.Orphans ()--import Instances.Data.Monoid ()--import Spec.Utils (prop_matchesShow)-#if __GLASGOW_HASKELL__ >= 702-import Spec.Utils (prop_genericShow)-#endif--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Monoid" $ do-    prop "All instance"                   (prop_matchesShow :: Int -> All -> Bool)-    prop "Any instance"                   (prop_matchesShow :: Int -> Any -> Bool)-    prop "Dual Int instance"              (prop_matchesShow :: Int -> Dual Int -> Bool)-    prop "First (Maybe Int) instance"     (prop_matchesShow :: Int -> First (Maybe Int) -> Bool)-    prop "Last (Maybe Int) instance"      (prop_matchesShow :: Int -> Last (Maybe Int) -> Bool)-    prop "Product Int instance"           (prop_matchesShow :: Int -> Product Int -> Bool)-    prop "Sum Int instance"               (prop_matchesShow :: Int -> Sum Int -> Bool)-#if MIN_VERSION_base(4,8,0)-    prop "Alt Maybe Int instance"         (prop_matchesShow :: Int -> Alt Maybe Int -> Bool)-#endif-#if __GLASGOW_HASKELL__ >= 702-    prop "All generic show"               (prop_genericShow :: Int -> All -> Bool)-    prop "Any generic show"               (prop_genericShow :: Int -> Any -> Bool)-    prop "Dual Int generic show"          (prop_genericShow :: Int -> Dual Int -> Bool)-    prop "First (Maybe Int) generic show" (prop_genericShow :: Int -> First (Maybe Int) -> Bool)-    prop "Last (Maybe Int) generic show"  (prop_genericShow :: Int -> Last (Maybe Int) -> Bool)-    prop "Product Int generic show"       (prop_genericShow :: Int -> Product Int -> Bool)-    prop "Sum Int generic show"           (prop_genericShow :: Int -> Sum Int -> Bool)-#endif-#if MIN_VERSION_base(4,8,0)-    prop "Alt Maybe Int generic show"     (prop_genericShow :: Int -> Alt Maybe Int -> Bool)-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Data.MonoidSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "Data.Monoid" module.
+-}
+module Spec.Data.MonoidSpec (main, spec) where
+
+import Data.Monoid
+
+import Generics.Deriving.Instances ()
+
+import Instances.Data.Monoid ()
+
+import Spec.Utils (prop_matchesShow, prop_genericShow, prop_genericShow1)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "All" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> All -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> All -> Bool)
+    describe "Any" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Any -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Any -> Bool)
+    describe "Dual Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Dual Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Dual Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> Dual Int -> Bool)
+    describe "First Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> First Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> First Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> First Int -> Bool)
+    describe "Last Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Last Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Last Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> Last Int -> Bool)
+    describe "Product Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Product Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Product Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> Product Int -> Bool)
+    describe "Sum Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Sum Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Sum Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> Sum Int -> Bool)
+#if MIN_VERSION_base(4,8,0)
+    describe "Alt Maybe Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Alt Maybe Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Alt Maybe Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> Alt Maybe Int -> Bool)
+#endif
tests/Spec/Data/OldTypeableSpec.hs view
@@ -1,46 +1,47 @@-{-# LANGUAGE CPP #-}--#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}-#endif--{-|-Module:      Spec.Data.OldTypeableSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "Data.Monoid" module.--}-module Spec.Data.OldTypeableSpec (main, spec) where--import Instances.Data.OldTypeable ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-import Data.OldTypeable (TyCon, TypeRep)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))-    describe "Text.Show.Text.Data.OldTypeable" $ do-        prop "TypeRep instance" (prop_matchesShow :: Int -> TypeRep -> Bool)-        prop "TyCon instance"   (prop_matchesShow :: Int -> TyCon -> Bool)-#else-    pure ()-#endif+{-# LANGUAGE CPP #-}
+
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
+#endif
+
+{-|
+Module:      Spec.Data.OldTypeableSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "Data.Monoid" module.
+-}
+module Spec.Data.OldTypeableSpec (main, spec) where
+
+import Instances.Data.OldTypeable ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+import Data.OldTypeable (TyCon, TypeRep)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
+    describe "TypeRep" $
+        prop "Show instance" (prop_matchesShow :: Int -> TypeRep -> Bool)
+    describe "TyCon" $
+        prop "Show instance" (prop_matchesShow :: Int -> TyCon -> Bool)
+#else
+    pure ()
+#endif
tests/Spec/Data/OrdSpec.hs view
@@ -1,41 +1,39 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.OrdSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "Data.Ord" module.--}-module Spec.Data.OrdSpec (main, spec) where--#if MIN_VERSION_base(4,6,0)-import Data.Ord (Down)-#endif-import Data.Orphans ()--import Instances.Data.Ord ()--import Spec.Utils (prop_matchesShow)-#if __GLASGOW_HASKELL__ >= 702-import Spec.Utils (prop_genericShow)-#endif--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Ord" $ do-    prop "Ordering instance"     (prop_matchesShow :: Int -> Ordering -> Bool)-#if __GLASGOW_HASKELL__ >= 702-    prop "Ordering generic show" (prop_genericShow :: Int -> Ordering -> Bool)-#endif-#if MIN_VERSION_base(4,6,0)-    prop "Down Int instance"     (prop_matchesShow :: Int -> Down Int -> Bool)-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Data.OrdSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "Data.Ord" module.
+-}
+module Spec.Data.OrdSpec (main, spec) where
+
+#if MIN_VERSION_base(4,6,0)
+import Data.Ord (Down)
+#endif
+
+import Generics.Deriving.Instances ()
+
+import Instances.Data.Ord ()
+
+import Spec.Utils (prop_matchesShow, prop_genericShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Ordering" $ do
+        prop "Show instance" (prop_matchesShow :: Int -> Ordering -> Bool)
+        prop "generic Show"  (prop_genericShow :: Int -> Ordering -> Bool)
+#if MIN_VERSION_base(4,6,0)
+    describe "Down Int" $ do
+        prop "Show instance" (prop_matchesShow :: Int -> Down Int -> Bool)
+#endif
tests/Spec/Data/ProxySpec.hs view
@@ -1,32 +1,28 @@-{-|-Module:      Spec.Data.ProxySpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for 'Proxy'.--}-module Spec.Data.ProxySpec (main, spec) where--import Data.Proxy (Proxy)--import Instances.Data.Proxy ()--import Spec.Utils (prop_matchesShow)--- #if __GLASGOW_HASKELL__ >= 702--- import Spec.Utils (prop_genericShow)--- #endif--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Proxy" $ do-    prop "Proxy Int instance"     (prop_matchesShow :: Int -> Proxy Int -> Bool)-    -- TODO: Uncomment this once tagged is fixed---     prop "Proxy Int generic show" (prop_genericShow :: Int -> Proxy Int -> Bool)+{-|
+Module:      Spec.Data.ProxySpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for 'Proxy'.
+-}
+module Spec.Data.ProxySpec (main, spec) where
+
+import Data.Proxy (Proxy)
+
+import Instances.Data.Proxy ()
+
+import Spec.Utils (prop_matchesShow, prop_genericShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Proxy Int" $ do
+    prop "Show instance" (prop_matchesShow :: Int -> Proxy Int -> Bool)
+    prop "generic show"  (prop_genericShow :: Int -> Proxy Int -> Bool)
tests/Spec/Data/RatioSpec.hs view
@@ -1,25 +1,25 @@-{-|-Module:      Spec.Data.RatioSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'Ratio'.--}-module Spec.Data.RatioSpec (main, spec) where--import Data.Ratio (Ratio)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Ratio" $ do-    prop "Ratio Int instance" (prop_matchesShow :: Int -> Ratio Int -> Bool)+{-|
+Module:      Spec.Data.RatioSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for 'Ratio'.
+-}
+module Spec.Data.RatioSpec (main, spec) where
+
+import Data.Ratio (Ratio)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Ratio Int" $ do
+    prop "Show instance" (prop_matchesShow :: Int -> Ratio Int -> Bool)
tests/Spec/Data/TextSpec.hs view
@@ -1,49 +1,56 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.TextSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the @text@ library.--}-module Spec.Data.TextSpec (main, spec) where--import           Instances.Data.Text ()--import           Spec.Utils (prop_matchesShow)--import           Test.Hspec (Spec, describe, hspec, parallel)-import           Test.Hspec.QuickCheck (prop)--import qualified Data.Text as TS-import qualified Data.Text as TL-#if MIN_VERSION_text(1,0,0)-import           Data.Text.Encoding (Decoding)-#endif-import           Data.Text.Encoding.Error (UnicodeException)-import           Data.Text.Foreign (I16)-#if MIN_VERSION_text(1,1,0)-import           Data.Text.Internal.Fusion.Size (Size)-#endif-import           Data.Text.Lazy.Builder (Builder)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Text" $ do-    prop "Builder instance"          (prop_matchesShow :: Int -> Builder -> Bool)-    prop "strict Text instance"      (prop_matchesShow :: Int -> TS.Text -> Bool)-    prop "lazy Text instance"        (prop_matchesShow :: Int -> TL.Text -> Bool)-    prop "I16 instance"              (prop_matchesShow :: Int -> I16 -> Bool)-    prop "UnicodeException instance" (prop_matchesShow :: Int -> UnicodeException -> Bool)-#if MIN_VERSION_text(1,0,0)-    prop "Decoding instance"         (prop_matchesShow :: Int -> Decoding -> Bool)-#endif-#if MIN_VERSION_text(1,1,0)-    prop "Size instance"             (prop_matchesShow :: Int -> Size -> Bool)-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Data.TextSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the @text@ library.
+-}
+module Spec.Data.TextSpec (main, spec) where
+
+import           Instances.Data.Text ()
+
+import           Spec.Utils (prop_matchesShow)
+
+import           Test.Hspec (Spec, describe, hspec, parallel)
+import           Test.Hspec.QuickCheck (prop)
+
+import qualified Data.Text as TS
+import qualified Data.Text as TL
+#if MIN_VERSION_text(1,0,0)
+import           Data.Text.Encoding (Decoding)
+#endif
+import           Data.Text.Encoding.Error (UnicodeException)
+import           Data.Text.Foreign (I16)
+#if MIN_VERSION_text(1,1,0)
+import           Data.Text.Internal.Fusion.Size (Size)
+#endif
+import           Data.Text.Lazy.Builder (Builder)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Builder" $
+        prop "Show instance" (prop_matchesShow :: Int -> Builder -> Bool)
+    describe "strict Text" $
+        prop "Show instance" (prop_matchesShow :: Int -> TS.Text -> Bool)
+    describe "lazy Text" $
+        prop "Show instance" (prop_matchesShow :: Int -> TL.Text -> Bool)
+    describe "I16" $
+        prop "Show instance" (prop_matchesShow :: Int -> I16 -> Bool)
+    describe "UnicodeException" $
+        prop "Show instance" (prop_matchesShow :: Int -> UnicodeException -> Bool)
+#if MIN_VERSION_text(1,0,0)
+    describe "Decoding" $
+        prop "Show instance" (prop_matchesShow :: Int -> Decoding -> Bool)
+#endif
+#if MIN_VERSION_text(1,1,0)
+    describe "Size" $
+        prop "Show instance" (prop_matchesShow :: Int -> Size -> Bool)
+#endif
tests/Spec/Data/TupleSpec.hs view
@@ -1,93 +1,98 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.TupleSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for tuple types.--}-module Spec.Data.TupleSpec (main, spec) where--import Data.Orphans ()--import Instances.Data.Tuple ()--import Spec.Utils (prop_matchesShow)-#if __GLASGOW_HASKELL__ >= 704-import Spec.Utils (prop_genericShow)-#endif--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Tuple" $ do-    prop "() instance"-        (prop_matchesShow :: Int -> () -> Bool)-    prop "(Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int) -> Bool)-    prop "(Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) instance"-        (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-#if __GLASGOW_HASKELL__ >= 704-    prop "() generic show"-        (prop_genericShow :: Int -> () -> Bool)-    prop "(Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int) -> Bool)-    prop "(Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-    prop "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) generic show"-        (prop_genericShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)-#endif+{-|
+Module:      Spec.Data.TupleSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for tuple types.
+-}
+module Spec.Data.TupleSpec (main, spec) where
+
+import Generics.Deriving.Instances ()
+
+import Instances.Data.Tuple ()
+
+import Spec.Utils (prop_matchesShow, prop_matchesShow2,
+                   prop_genericShow, prop_genericShow1)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "()" $ do
+        prop "Show instance"
+            (prop_matchesShow :: Int -> () -> Bool)
+        prop "generic Show"
+            (prop_genericShow :: Int -> () -> Bool)
+    describe "(Int, Int)" $ do
+        prop "Show2 instance"
+            (prop_matchesShow2 :: Int -> (Int, Int) -> Bool)
+        prop "generic Show"
+            (prop_genericShow  :: Int -> (Int, Int) -> Bool)
+        prop "generic Show1"
+            (prop_genericShow1 :: Int -> (Int, Int) -> Bool)
+    describe "(Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow  :: Int -> (Int, Int, Int) -> Bool)
+        prop "generic Show"
+            (prop_genericShow  :: Int -> (Int, Int, Int) -> Bool)
+        prop "generic Show1"
+            (prop_genericShow1 :: Int -> (Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow  :: Int -> (Int, Int, Int, Int) -> Bool)
+        prop "generic Show"
+            (prop_genericShow  :: Int -> (Int, Int, Int, Int) -> Bool)
+        prop "generic Show1"
+            (prop_genericShow1 :: Int -> (Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow  :: Int -> (Int, Int, Int, Int, Int) -> Bool)
+        prop "generic Show"
+            (prop_genericShow  :: Int -> (Int, Int, Int, Int, Int) -> Bool)
+        prop "generic Show1"
+            (prop_genericShow1 :: Int -> (Int, Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow  :: Int -> (Int, Int, Int, Int, Int, Int) -> Bool)
+        prop "generic Show"
+            (prop_genericShow  :: Int -> (Int, Int, Int, Int, Int, Int) -> Bool)
+        prop "generic Show1"
+            (prop_genericShow1 :: Int -> (Int, Int, Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow  :: Int -> (Int, Int, Int, Int, Int, Int, Int) -> Bool)
+        prop "generic Show"
+            (prop_genericShow  :: Int -> (Int, Int, Int, Int, Int, Int, Int) -> Bool)
+        prop "generic Show1"
+            (prop_genericShow1 :: Int -> (Int, Int, Int, Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)
+    describe "(Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int)" $ do
+        prop "Show instance"
+            (prop_matchesShow :: Int -> (Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int) -> Bool)
tests/Spec/Data/Type/CoercionSpec.hs view
@@ -1,42 +1,42 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Data.Type.CoercionSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'Coercion'.--}-module Spec.Data.Type.CoercionSpec (main, spec) where--import Instances.Data.Type.Coercion ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if MIN_VERSION_base(4,7,0)-import Data.Monoid (All(..))-import Data.Type.Coercion (Coercion)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if MIN_VERSION_base(4,7,0)-    describe "Text.Show.Text.Data.Type.Coercion" $-        prop "Coercion instance" (prop_matchesShow :: Int -> Coercion All Bool -> Bool)-#else-    pure ()-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Data.Type.CoercionSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for 'Coercion'.
+-}
+module Spec.Data.Type.CoercionSpec (main, spec) where
+
+import Instances.Data.Type.Coercion ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if MIN_VERSION_base(4,7,0)
+import Data.Monoid (All(..))
+import Data.Type.Coercion (Coercion)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $
+#if MIN_VERSION_base(4,7,0)
+    describe "Coercion All Bool" $
+        prop "Show instance" (prop_matchesShow :: Int -> Coercion All Bool -> Bool)
+#else
+    pure ()
+#endif
tests/Spec/Data/Type/EqualitySpec.hs view
@@ -1,42 +1,42 @@-{-# LANGUAGE CPP           #-}-{-# LANGUAGE TypeOperators #-}--{-|-Module:      Spec.Data.Type.EqualitySpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for '(:~:)'.--}-module Spec.Data.Type.EqualitySpec (main, spec) where--import Instances.Data.Type.Equality ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if MIN_VERSION_base(4,7,0)-import Data.Type.Equality ((:~:))--import Spec.Utils (prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if MIN_VERSION_base(4,7,0)-    describe "Text.Show.Text.Data.Type.Equality" $-        prop "(:~:) instance"                          (prop_matchesShow :: Int -> Int :~: Int -> Bool)-#else-    pure ()-#endif+{-# LANGUAGE CPP           #-}
+{-# LANGUAGE TypeOperators #-}
+
+{-|
+Module:      Spec.Data.Type.EqualitySpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for '(:~:)'.
+-}
+module Spec.Data.Type.EqualitySpec (main, spec) where
+
+import Instances.Data.Type.Equality ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if MIN_VERSION_base(4,7,0)
+import Data.Type.Equality ((:~:))
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $
+#if MIN_VERSION_base(4,7,0)
+    describe "Int :~: Int" $
+        prop "Show instance" (prop_matchesShow :: Int -> Int :~: Int -> Bool)
+#else
+    pure ()
+#endif
tests/Spec/Data/TypeableSpec.hs view
@@ -1,28 +1,30 @@-{-|-Module:      Spec.Data.TypeableSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "Data.Typeable" module.--}-module Spec.Data.TypeableSpec (main, spec) where--import Data.Typeable (TyCon, TypeRep)--import Instances.Data.Typeable ()--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Typeable" $ do-    prop "TypeRep instance" (prop_matchesShow :: Int -> TypeRep -> Bool)-    prop "TyCon instance"   (prop_matchesShow :: Int -> TyCon -> Bool)+{-|
+Module:      Spec.Data.TypeableSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "Data.Typeable" module.
+-}
+module Spec.Data.TypeableSpec (main, spec) where
+
+import Data.Typeable (TyCon, TypeRep)
+
+import Instances.Data.Typeable ()
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "TypeRep" $
+        prop "Show instance" (prop_matchesShow :: Int -> TypeRep -> Bool)
+    describe "TyCon" $
+        prop "Show instance" (prop_matchesShow :: Int -> TyCon -> Bool)
tests/Spec/Data/VersionSpec.hs view
@@ -1,25 +1,27 @@-module Spec.Data.VersionSpec (main, spec) where--import Data.Version (Version, showVersion)--import Instances.Data.Version ()--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--import Text.Show.Text (fromString)-import Text.Show.Text.Data.Version (showbVersionConcrete)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Data.Version" $ do-    prop "Version instance"            (prop_matchesShow :: Int -> Version -> Bool)-    prop "showbVersionConcrete output" prop_showVersion---- | Verifies 'showVersion' and 'showbVersion' generate the same output.-prop_showVersion :: Version -> Bool-prop_showVersion v = fromString (showVersion v) == showbVersionConcrete v+module Spec.Data.VersionSpec (main, spec) where
+
+import Data.Version (Version, showVersion)
+
+import Instances.Data.Version ()
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+import Text.Show.Text (fromString)
+import Text.Show.Text.Data.Version (showbVersionConcrete)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Version" $
+        prop "Show instance"                      (prop_matchesShow :: Int -> Version -> Bool)
+    describe "showbVersionConcrete" $
+        prop "has the same output as showVersion" prop_showVersion
+
+-- | Verifies 'showVersion' and 'showbVersion' generate the same output.
+prop_showVersion :: Version -> Bool
+prop_showVersion v = fromString (showVersion v) == showbVersionConcrete v
+ tests/Spec/Derived/DataFamiliesSpec.hs view
@@ -0,0 +1,51 @@+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Derived.DataFamiliesSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for corner case-provoking data families.
+-}
+module Spec.Derived.DataFamiliesSpec (main, spec) where
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if MIN_VERSION_template_haskell(2,7,0)
+import Derived.DataFamilies (NotAllShow)
+
+import Spec.Utils (prop_matchesShow2, prop_genericShow', prop_genericShow1)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+
+# if __GLASGOW_HASKELL__ >= 708
+import Derived.DataFamilies (NullaryData)
+import Spec.Utils (prop_matchesShow)
+# endif
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+#if MIN_VERSION_template_haskell(2,7,0)
+    describe "NotAllShow Int Int Int Int" $ do
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> NotAllShow Int Int Int Int -> Bool)
+        prop "generic Show"   (prop_genericShow' :: Int -> NotAllShow Int Int Int Int -> Bool)
+        prop "generic Show1"  (prop_genericShow1 :: Int -> NotAllShow Int Int Int Int -> Bool)
+# if __GLASGOW_HASKELL__ >= 708
+    describe "NullaryData" $ do
+        prop "Show instance"  (prop_matchesShow  :: Int -> NullaryData -> Bool)
+        prop "generic Show"   (prop_genericShow' :: Int -> NullaryData -> Bool)
+# endif
+#else
+    pure ()
+#endif
+ tests/Spec/Derived/DatatypeContextsSpec.hs view
@@ -0,0 +1,32 @@+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Derived.DatatypeContextsSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types with DatatypeContexts (eww).
+-}
+module Spec.Derived.DatatypeContextsSpec (main, spec) where
+
+import Derived.DatatypeContexts
+
+import Spec.Utils (prop_matchesShow2)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "TyCon Int Int Int" $
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyCon Int Int Int -> Bool)
+#if MIN_VERSION_template_haskell(2,7,0)
+    describe "TyFamily Int Int Int" $
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyFamily Int Int Int -> Bool)
+#endif
+ tests/Spec/Derived/ExistentialQuantificationSpec.hs view
@@ -0,0 +1,32 @@+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Derived.ExistentialQuantificationSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for existentially quantified data types.
+-}
+module Spec.Derived.ExistentialQuantificationSpec (main, spec) where
+
+import Derived.ExistentialQuantification
+
+import Spec.Utils (prop_matchesShow2)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "TyCon Int Int Int Int" $
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyCon Int Int Int Int -> Bool)
+#if MIN_VERSION_template_haskell(2,7,0)
+    describe "TyFamily Int Int Int Int" $
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyFamily Int Int Int Int -> Bool)
+#endif
+ tests/Spec/Derived/InfixSpec.hs view
@@ -0,0 +1,45 @@+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Derived.InfixSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types with infix constructors.
+-}
+module Spec.Derived.InfixSpec (main, spec) where
+
+import Derived.Infix
+
+import Spec.Utils (prop_matchesShow, prop_genericShow,
+                   prop_genericShow', prop_genericShow1)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "TyConPlain Int Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> TyConPlain Int Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> TyConPlain Int Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> TyConPlain Int Int -> Bool)
+    describe "TyConGADT Int Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> TyConGADT Int Int -> Bool)
+        prop "generic Show"  (prop_genericShow' :: Int -> TyConGADT Int Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> TyConGADT Int Int -> Bool)
+#if MIN_VERSION_template_haskell(2,7,0)
+    describe "TyFamilyPlain Int Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> TyFamilyPlain Int Int -> Bool)
+        prop "generic Show"  (prop_genericShow' :: Int -> TyFamilyPlain Int Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> TyFamilyPlain Int Int -> Bool)
+    describe "TyFamilyGADT Int Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> TyFamilyGADT Int Int -> Bool)
+        prop "generic Show"  (prop_genericShow' :: Int -> TyFamilyGADT Int Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> TyFamilyGADT Int Int -> Bool)
+#endif
+ tests/Spec/Derived/MagicHashSpec.hs view
@@ -0,0 +1,33 @@+{-# LANGUAGE CPP       #-}
+{-# LANGUAGE MagicHash #-}
+
+{-|
+Module:      Spec.Derived.MagicHashSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types with fields that have unlifted types.
+-}
+module Spec.Derived.MagicHashSpec (main, spec) where
+
+import Derived.MagicHash
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "TyCon#" $
+        prop "Show instance" (prop_matchesShow :: Int -> TyCon# -> Bool)
+#if MIN_VERSION_template_haskell(2,7,0)
+    describe "TyFamily#" $
+        prop "Show instance" (prop_matchesShow :: Int -> TyFamily# -> Bool)
+#endif
+ tests/Spec/Derived/PolyKindsSpec.hs view
@@ -0,0 +1,47 @@+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Derived.PolyKindsSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types with poly-kinded type variables.
+-}
+module Spec.Derived.PolyKindsSpec (main, spec) where
+
+import Derived.PolyKinds
+
+import Spec.Utils (prop_matchesShow2, prop_genericShow, prop_genericShow1)
+#if MIN_VERSION_template_haskell(2,7,0)
+import Spec.Utils (prop_genericShow')
+#endif
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "TyConCompose Either Either Either Maybe Maybe Int Int" $ do
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyConCompose Either Either Either Maybe Maybe Int Int -> Bool)
+        prop "generic Show"   (prop_genericShow  :: Int -> TyConCompose Either Either Either Maybe Maybe Int Int -> Bool)
+        prop "generic Show1"  (prop_genericShow1 :: Int -> TyConCompose Either Either Either Maybe Maybe Int Int -> Bool)
+    describe "TyConProxy Int Int" $ do
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyConProxy Int Int -> Bool)
+        prop "generic Show"   (prop_genericShow  :: Int -> TyConProxy Int Int -> Bool)
+        prop "generic Show1"  (prop_genericShow1 :: Int -> TyConProxy Int Int -> Bool)
+#if MIN_VERSION_template_haskell(2,7,0)
+    describe "TyFamilyCompose Either Either Either Maybe Maybe Int Int" $ do
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyFamilyCompose Either Either Either Maybe Maybe Int Int -> Bool)
+        prop "generic Show"   (prop_genericShow' :: Int -> TyFamilyCompose Either Either Either Maybe Maybe Int Int -> Bool)
+        prop "generic Show1"  (prop_genericShow1 :: Int -> TyFamilyCompose Either Either Either Maybe Maybe Int Int -> Bool)
+    describe "TyFamilyProxy Int Int" $ do
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyFamilyProxy Int Int -> Bool)
+        prop "generic Show"   (prop_genericShow' :: Int -> TyFamilyProxy Int Int -> Bool)
+        prop "generic Show1"  (prop_genericShow1 :: Int -> TyFamilyProxy Int Int -> Bool)
+#endif
+ tests/Spec/Derived/RankNTypesSpec.hs view
@@ -0,0 +1,32 @@+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Derived.RankNTypesSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types with rank-n voodoo.
+-}
+module Spec.Derived.RankNTypesSpec (main, spec) where
+
+import Derived.Records
+
+import Spec.Utils (prop_matchesShow2)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "TyCon Int Int" $
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyCon Int Int -> Bool)
+#if MIN_VERSION_template_haskell(2,7,0)
+    describe "TyFamily Int Int" $
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyFamily Int Int -> Bool)
+#endif
+ tests/Spec/Derived/RecordsSpec.hs view
@@ -0,0 +1,39 @@+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Derived.RecordsSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types with record syntax.
+-}
+module Spec.Derived.RecordsSpec (main, spec) where
+
+import Derived.Records
+
+import Spec.Utils (prop_matchesShow2, prop_genericShow, prop_genericShow1)
+#if MIN_VERSION_template_haskell(2,7,0)
+import Spec.Utils (prop_genericShow')
+#endif
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "TyCon Int Int" $ do
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyCon Int Int -> Bool)
+        prop "generic Show"   (prop_genericShow  :: Int -> TyCon Int Int -> Bool)
+        prop "generic Show1"  (prop_genericShow1 :: Int -> TyCon Int Int -> Bool)
+#if MIN_VERSION_template_haskell(2,7,0)
+    describe "TyFamily Int Int" $ do
+        prop "Show2 instance" (prop_matchesShow2 :: Int -> TyFamily Int Int -> Bool)
+        prop "generic Show"   (prop_genericShow' :: Int -> TyFamily Int Int -> Bool)
+        prop "generic Show1"  (prop_genericShow1 :: Int -> TyFamily Int Int -> Bool)
+#endif
+ tests/Spec/Derived/TypeSynonymsSpec.hs view
@@ -0,0 +1,39 @@+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Derived.TypeSynonymsSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types that use type synonyms.
+-}
+module Spec.Derived.TypeSynonymsSpec (main, spec) where
+
+import Derived.TypeSynonyms
+
+import Spec.Utils (prop_matchesShow, prop_genericShow, prop_genericShow1)
+#if MIN_VERSION_template_haskell(2,7,0)
+import Spec.Utils (prop_genericShow')
+#endif
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "TyCon Int Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> TyCon Int Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> TyCon Int Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> TyCon Int Int -> Bool)
+#if MIN_VERSION_template_haskell(2,7,0)
+    describe "TyFamily Int Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> TyFamily Int Int -> Bool)
+        prop "generic Show"  (prop_genericShow' :: Int -> TyFamily Int Int -> Bool)
+        prop "generic Show1" (prop_genericShow1 :: Int -> TyFamily Int Int -> Bool)
+#endif
− tests/Spec/DerivedSpec.hs
@@ -1,119 +0,0 @@-{-# LANGUAGE CPP           #-}-{-# LANGUAGE MagicHash     #-}-{-# LANGUAGE TypeOperators #-}-{-|-Module:      Spec.DerivedSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types that have derived 'Show' instances-(using "Text.Show.Text.TH").--}-module Spec.DerivedSpec (main, spec) where--import Derived--import Instances.Derived ()--import Spec.Utils (prop_matchesShow)-#if __GLASGOW_HASKELL__ >= 702-import Spec.Utils (prop_genericShow)-#endif--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Template Haskell-derived data types" $ do-    prop "Nullary instance"                                (prop_matchesShow :: Int -> Nullary -> Bool)-    prop "PhantomNullary Int instance"                     (prop_matchesShow :: Int -> PhantomNullary Int -> Bool)-    prop "MonomorphicUnary instance"                       (prop_matchesShow :: Int -> MonomorphicUnary -> Bool)-    prop "PolymorphicUnary Int Int instance"               (prop_matchesShow :: Int -> PolymorphicUnary Int Int -> Bool)-    prop "MonomorphicProduct instance"                     (prop_matchesShow :: Int -> MonomorphicProduct -> Bool)-    prop "PolymorphicProduct Int Int Int Int instance"     (prop_matchesShow :: Int -> PolymorphicProduct Int Int Int Int -> Bool)-    prop "MonomorphicRecord instance"                      (prop_matchesShow :: Int -> MonomorphicRecord -> Bool)-    prop "PolymorphicRecord Int Int Int Int instance"      (prop_matchesShow :: Int -> PolymorphicRecord Int Int Int Int -> Bool)-    prop "MonomorphicInfix instance"                       (prop_matchesShow :: Int -> MonomorphicInfix -> Bool)-    prop "PolymorphicInfix Int Int Int instance"           (prop_matchesShow :: Int -> PolymorphicInfix Int Int Int -> Bool)-    prop "MonomorphicForall instance"                      (prop_matchesShow :: Int -> MonomorphicForall -> Bool)-    prop "PolymorphicForall Int Int instance"              (prop_matchesShow :: Int -> PolymorphicForall Int Int -> Bool)-    prop "AllAtOnce Int Int Int Int instance"              (prop_matchesShow :: Int -> AllAtOnce Int Int Int Int -> Bool)-    prop "NormalGADT instance"                             (prop_matchesShow :: Int -> NormalGADT -> Bool)-    prop "ExistentialGADT Char Int Int instance"           (prop_matchesShow :: Int -> ExistentialGADT Char Int Int -> Bool)-    prop "ExistentialGADT Double Double Int instance"      (prop_matchesShow :: Int -> ExistentialGADT Double Double Int -> Bool)-    prop "ExistentialGADT Int String Int instance"         (prop_matchesShow :: Int -> ExistentialGADT Int String Int -> Bool)-    prop "ExistentialGADT Ordering Int Int instance"       (prop_matchesShow :: Int -> ExistentialGADT Ordering Int Int -> Bool)-    prop "ExistentialGADT Int Int Int instance"            (prop_matchesShow :: Int -> ExistentialGADT Int Int Int -> Bool)-    prop "PrimADT# Int instance"                           (prop_matchesShow :: Int -> PrimADT# Int -> Bool)-    prop "LeftAssocTree Int instance"                      (prop_matchesShow :: Int -> LeftAssocTree Int -> Bool)-    prop "RightAssocTree Int instance"                     (prop_matchesShow :: Int -> RightAssocTree Int -> Bool)-    prop "Int :?: Int instance"                            (prop_matchesShow :: Int -> Int :?: Int -> Bool)-    prop "HigherKindedTypeParams Maybe Int instance"       (prop_matchesShow :: Int -> HigherKindedTypeParams Maybe Int -> Bool)-    prop "RestrictedContext Int instance"                  (prop_matchesShow :: Int -> RestrictedContext Int -> Bool)-    prop "Fix Maybe instance"                              (prop_matchesShow :: Int -> Fix Maybe -> Bool)-#if MIN_VERSION_template_haskell(2,7,0)                                  -    prop "AllShow () () Int Int instance"                  (prop_matchesShow :: Int -> AllShow () () Int Int -> Bool)-    prop "AllShow Int Int Int Int instance"                (prop_matchesShow :: Int -> AllShow Int Int Int Int -> Bool)-    prop "AllShow Bool Bool Int Int instance"              (prop_matchesShow :: Int -> AllShow Bool Bool Int Int -> Bool)-    prop "AllShow Char Double Int Int instance"            (prop_matchesShow :: Int -> AllShow Char Double Int Int -> Bool)-    prop "AllShow Float Ordering Int Int instance"         (prop_matchesShow :: Int -> AllShow Float Ordering Int Int -> Bool)-    prop "NotAllShow Int Int Int Int instance"             (prop_matchesShow :: Int -> NotAllShow Int Int Int Int -> Bool)-    prop "OneDataInstance Int Int Int Int instance"        (prop_matchesShow :: Int -> OneDataInstance Int Int Int Int -> Bool)-    prop "AssocData1 () instance"                          (prop_matchesShow :: Int -> AssocData1 () -> Bool)-    prop "AssocData2 () instance"                          (prop_matchesShow :: Int -> AssocData2 () Int Int -> Bool)-# if __GLASGOW_HASKELL__ >= 708-    prop "NullaryData instance"                            (prop_matchesShow :: Int -> NullaryData -> Bool)-# endif-    prop "GADTFam Char Int Int instance"                   (prop_matchesShow :: Int -> GADTFam Char Int Int -> Bool)-    prop "GADTFam Double Double Int instance"              (prop_matchesShow :: Int -> GADTFam Double Double Int -> Bool)-    prop "GADTFam Int String Int instance"                 (prop_matchesShow :: Int -> GADTFam Int String Int -> Bool)-    prop "GADTFam Ordering Int Int instance"               (prop_matchesShow :: Int -> GADTFam Ordering Int Int -> Bool)-    prop "GADTFam Int Int Int instance"                    (prop_matchesShow :: Int -> GADTFam Int Int Int -> Bool)-#endif-#if __GLASGOW_HASKELL__ >= 702-    prop "Nullary generic show"                            (prop_genericShow :: Int -> Nullary -> Bool)-    prop "PhantomNullary Int generic show"                 (prop_genericShow :: Int -> PhantomNullary Int -> Bool)-    prop "MonomorphicUnary generic show"                   (prop_genericShow :: Int -> MonomorphicUnary -> Bool)-    prop "PolymorphicUnary Int Int generic show"           (prop_genericShow :: Int -> PolymorphicUnary Int Int -> Bool)-    prop "MonomorphicProduct generic show"                 (prop_genericShow :: Int -> MonomorphicProduct -> Bool)-    prop "PolymorphicProduct Int Int Int Int generic show" (prop_genericShow :: Int -> PolymorphicProduct Int Int Int Int -> Bool)-    prop "MonomorphicRecord generic show"                  (prop_genericShow :: Int -> MonomorphicRecord -> Bool)-    prop "PolymorphicRecord Int Int Int Int generic show"  (prop_genericShow :: Int -> PolymorphicRecord Int Int Int Int -> Bool)-    prop "MonomorphicInfix generic show"                   (prop_genericShow :: Int -> MonomorphicInfix -> Bool)-    prop "PolymorphicInfix Int Int Int generic show"       (prop_genericShow :: Int -> PolymorphicInfix Int Int Int -> Bool)---     prop "MonomorphicForall generic show"                  (prop_genericShow :: Int -> MonomorphicForall -> Bool)---     prop "PolymorphicForall Int Int generic show"          (prop_genericShow :: Int -> PolymorphicForall Int Int -> Bool)---     prop "AllAtOnce Int Int Int Int generic show"          (prop_genericShow :: Int -> AllAtOnce Int Int Int Int -> Bool)-    prop "NormalGADT generic show"                         (prop_genericShow :: Int -> NormalGADT -> Bool)---     prop "ExistentialGADT Char Int Int generic show"       (prop_genericShow :: Int -> GADT Char Int Int -> Bool)---     prop "ExistentialGADT Double Double Int generic show"  (prop_genericShow :: Int -> GADT Double Double Int -> Bool)---     prop "ExistentialGADT Int String Int generic show"     (prop_genericShow :: Int -> GADT Int String Int -> Bool)---     prop "ExistentialGADT Ordering Int Int generic show"   (prop_genericShow :: Int -> GADT Ordering Int Int -> Bool)---     prop "ExistentialGADT Int Int Int generic show"        (prop_genericShow :: Int -> GADT Int Int Int -> Bool)-    prop "LeftAssocTree Int generic show"                  (prop_genericShow :: Int -> LeftAssocTree Int -> Bool)-    prop "RightAssocTree Int generic show"                 (prop_genericShow :: Int -> RightAssocTree Int -> Bool)-    prop "Int :?: Int generic show"                        (prop_genericShow :: Int -> Int :?: Int -> Bool)-    prop "HigherKindedTypeParams Maybe Int generic show"   (prop_genericShow :: Int -> HigherKindedTypeParams Maybe Int -> Bool)-    prop "RestrictedContext Int generic show"              (prop_genericShow :: Int -> RestrictedContext Int -> Bool)-    prop "Fix Maybe generic show"                          (prop_genericShow :: Int -> Fix Maybe -> Bool)-# if MIN_VERSION_template_haskell(2,7,0) && __GLASGOW_HASKELL__ >= 706-    prop "AllShow () () Int Int generic show"              (prop_matchesShow :: Int -> AllShow () () Int Int -> Bool)-    prop "AllShow Int Int Int Int generic show"            (prop_matchesShow :: Int -> AllShow Int Int Int Int -> Bool)-    prop "AllShow Bool Bool Int Int generic show"          (prop_matchesShow :: Int -> AllShow Bool Bool Int Int -> Bool)-    prop "AllShow Char Double Int Int generic show"        (prop_matchesShow :: Int -> AllShow Char Double Int Int -> Bool)-    prop "AllShow Float Ordering Int Int generic show"     (prop_matchesShow :: Int -> AllShow Float Ordering Int Int -> Bool)-    prop "NotAllShow Int Int Int Int generic show"         (prop_genericShow :: Int -> NotAllShow Int Int Int Int -> Bool)-    prop "OneDataInstance Int Int Int Int generic show"    (prop_genericShow :: Int -> OneDataInstance Int Int Int Int -> Bool)-    prop "AssocData1 () generic show"                      (prop_genericShow :: Int -> AssocData1 () -> Bool)-    prop "AssocData2 () generic show"                      (prop_genericShow :: Int -> AssocData2 () Int Int -> Bool)-#  if __GLASGOW_HASKELL__ >= 708-    prop "NullaryData generic show"                        (prop_genericShow :: Int -> NullaryData -> Bool)-#  endif-# endif-#endif
tests/Spec/Foreign/C/TypesSpec.hs view
@@ -1,55 +1,80 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Foreign.C.TypesSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "Foreign.C.Types" module.--}-module Spec.Foreign.C.TypesSpec (main, spec) where--import Foreign.C.Types--import Instances.Foreign.C.Types ()--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Foreign.C.Types" $ do-    prop "CChar instance"      (prop_matchesShow :: Int -> CChar -> Bool)-    prop "CSChar instance"     (prop_matchesShow :: Int -> CSChar -> Bool)-    prop "CUChar instance"     (prop_matchesShow :: Int -> CUChar -> Bool)-    prop "CShort instance"     (prop_matchesShow :: Int -> CShort -> Bool)-    prop "CUShort instance"    (prop_matchesShow :: Int -> CUShort -> Bool)-    prop "CInt instance"       (prop_matchesShow :: Int -> CInt -> Bool)-    prop "CUInt instance"      (prop_matchesShow :: Int -> CUInt -> Bool)-    prop "CLong instance"      (prop_matchesShow :: Int -> CLong -> Bool)-    prop "CULong instance"     (prop_matchesShow :: Int -> CULong -> Bool)-    prop "CPtrdiff instance"   (prop_matchesShow :: Int -> CPtrdiff -> Bool)-    prop "CSize instance"      (prop_matchesShow :: Int -> CSize -> Bool)-    prop "CWchar instance"     (prop_matchesShow :: Int -> CWchar -> Bool)-    prop "CSigAtomic instance" (prop_matchesShow :: Int -> CSigAtomic -> Bool)-    prop "CLLong instance"     (prop_matchesShow :: Int -> CLLong -> Bool)-    prop "CULLong instance"    (prop_matchesShow :: Int -> CULLong -> Bool)-    prop "CIntPtr instance"    (prop_matchesShow :: Int -> CIntPtr -> Bool)-    prop "CUIntPtr instance"   (prop_matchesShow :: Int -> CUIntPtr -> Bool)-    prop "CIntMax instance"    (prop_matchesShow :: Int -> CIntMax -> Bool)-    prop "CUIntMax instance"   (prop_matchesShow :: Int -> CUIntMax -> Bool)-    prop "CClock instance"     (prop_matchesShow :: Int -> CClock -> Bool)-    prop "CTime instance"      (prop_matchesShow :: Int -> CTime -> Bool)-#if MIN_VERSION_base(4,4,0)-    prop "CUSeconds instance"  (prop_matchesShow :: Int -> CUSeconds -> Bool)-    prop "CSUSeconds instance" (prop_matchesShow :: Int -> CSUSeconds -> Bool)-#endif-    prop "CFloat instance"     (prop_matchesShow :: Int -> CFloat -> Bool)-    prop "CDouble instance"    (prop_matchesShow :: Int -> CDouble -> Bool)+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Foreign.C.TypesSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "Foreign.C.Types" module.
+-}
+module Spec.Foreign.C.TypesSpec (main, spec) where
+
+import Foreign.C.Types
+
+import Instances.Foreign.C.Types ()
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "CChar" $
+        prop "Show instance" (prop_matchesShow :: Int -> CChar -> Bool)
+    describe "CSChar" $
+        prop "Show instance" (prop_matchesShow :: Int -> CSChar -> Bool)
+    describe "CUChar" $
+        prop "Show instance" (prop_matchesShow :: Int -> CUChar -> Bool)
+    describe "CShort" $
+        prop "Show instance" (prop_matchesShow :: Int -> CShort -> Bool)
+    describe "CUShort" $
+        prop "Show instance" (prop_matchesShow :: Int -> CUShort -> Bool)
+    describe "CInt" $
+        prop "Show instance" (prop_matchesShow :: Int -> CInt -> Bool)
+    describe "CUInt" $
+        prop "Show instance" (prop_matchesShow :: Int -> CUInt -> Bool)
+    describe "CLong" $
+        prop "Show instance" (prop_matchesShow :: Int -> CLong -> Bool)
+    describe "CULong" $
+        prop "Show instance" (prop_matchesShow :: Int -> CULong -> Bool)
+    describe "CPtrdiff" $
+        prop "Show instance" (prop_matchesShow :: Int -> CPtrdiff -> Bool)
+    describe "CSize" $
+        prop "Show instance" (prop_matchesShow :: Int -> CSize -> Bool)
+    describe "CWchar" $
+        prop "Show instance" (prop_matchesShow :: Int -> CWchar -> Bool)
+    describe "CSigAtomic" $
+        prop "Show instance" (prop_matchesShow :: Int -> CSigAtomic -> Bool)
+    describe "CLLong" $
+        prop "Show instance" (prop_matchesShow :: Int -> CLLong -> Bool)
+    describe "CULLong" $
+        prop "Show instance" (prop_matchesShow :: Int -> CULLong -> Bool)
+    describe "CIntPtr" $
+        prop "Show instance" (prop_matchesShow :: Int -> CIntPtr -> Bool)
+    describe "CUIntPtr" $
+        prop "Show instance" (prop_matchesShow :: Int -> CUIntPtr -> Bool)
+    describe "CIntMax" $
+        prop "Show instance" (prop_matchesShow :: Int -> CIntMax -> Bool)
+    describe "CUIntMax" $
+        prop "Show instance" (prop_matchesShow :: Int -> CUIntMax -> Bool)
+    describe "CClock" $
+        prop "Show instance" (prop_matchesShow :: Int -> CClock -> Bool)
+    describe "CTime" $
+        prop "Show instance" (prop_matchesShow :: Int -> CTime -> Bool)
+#if MIN_VERSION_base(4,4,0)
+    describe "CUSeconds" $
+        prop "Show instance" (prop_matchesShow :: Int -> CUSeconds -> Bool)
+    describe "CSUSeconds" $
+        prop "Show instance" (prop_matchesShow :: Int -> CSUSeconds -> Bool)
+#endif
+    describe "CFloat" $
+        prop "Show instance" (prop_matchesShow :: Int -> CFloat -> Bool)
+    describe "CDouble" $
+        prop "Show instance" (prop_matchesShow :: Int -> CDouble -> Bool)
tests/Spec/Foreign/PtrSpec.hs view
@@ -1,42 +1,47 @@-{-|-Module:      Spec.Foreign.PtrSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for pointer data types.--}-module Spec.Foreign.PtrSpec (main, spec) where--import Foreign.ForeignPtr (newForeignPtr_)-import Foreign.Ptr (FunPtr, IntPtr, Ptr, WordPtr)--import Instances.Foreign.Ptr ()--import Prelude ()-import Prelude.Compat--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)-import Test.QuickCheck (Property, ioProperty)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Foreign.Ptr" $ do-    prop "Ptr Int instance"     (prop_matchesShow :: Int -> Ptr Int -> Bool)-    prop "FunPtr Int instance"  (prop_matchesShow :: Int -> FunPtr Int -> Bool)-    prop "IntPtr instance"      (prop_matchesShow :: Int -> IntPtr -> Bool)-    prop "WordPtr instance"     (prop_matchesShow :: Int -> WordPtr -> Bool)-    prop "ForeignPtr instance"  prop_showForeignPtr---- | 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+{-|
+Module:      Spec.Foreign.PtrSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for pointer data types.
+-}
+module Spec.Foreign.PtrSpec (main, spec) where
+
+import Foreign.ForeignPtr (newForeignPtr_)
+import Foreign.Ptr (FunPtr, IntPtr, Ptr, WordPtr)
+
+import Instances.Foreign.Ptr ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+import Test.QuickCheck (Property, ioProperty)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Ptr Int" $
+        prop "Show instance"     (prop_matchesShow :: Int -> Ptr Int -> Bool)
+    describe "FunPtr Int" $
+        prop "Show instance"  (prop_matchesShow :: Int -> FunPtr Int -> Bool)
+    describe "IntPtr" $
+        prop "Show instance"      (prop_matchesShow :: Int -> IntPtr -> Bool)
+    describe "WordPtr" $
+        prop "Show instance"     (prop_matchesShow :: Int -> WordPtr -> Bool)
+    describe "ForeignPtr" $
+        prop "Show instance"  prop_showForeignPtr
+
+-- | 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
tests/Spec/FromStringTextShowSpec.hs view
@@ -1,65 +1,34 @@-{-|-Module:      Spec.FromStringTextShowSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for 'FromStringShow' and 'FromTextShow'.--}-module Spec.FromStringTextShowSpec (main, spec) where---- import qualified Debug.Trace as S (traceShow)--import           Instances.FromStringTextShow ()--import           Spec.Utils (prop_matchesShow, prop_readShow, prop_showEq)---- import qualified System.IO as S (print)--- import           System.IO.Silently (capture_, hCapture_)--import           Test.Hspec (Spec, describe, hspec, parallel)-import           Test.Hspec.QuickCheck (prop)--import           Text.Show.Text (FromStringShow(..), FromTextShow(..))--- import qualified Text.Show.Text as T (print)--- import qualified Text.Show.Text.Debug.Trace as T (traceShow)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text" $ do-        prop "FromStringShow Int instance"             (prop_matchesShow :: Int -> FromStringShow Int -> Bool)-        prop "FromStringShow Int: read . show = id"    (prop_readShow :: Int -> FromStringShow Int -> Bool)-        prop "FromStringShow Int = Int" $              prop_showEq (FromStringShow :: Int -> FromStringShow Int)-        prop "FromStringShow String instance"          (prop_matchesShow :: Int -> FromStringShow String -> Bool)-        prop "FromStringShow String: read . show = id" (prop_readShow :: Int -> FromStringShow String -> Bool)-        prop "FromStringShow String = String" $        prop_showEq (FromStringShow :: String -> FromStringShow String)-        prop "FromTextShow Int instance"               (prop_matchesShow :: Int -> FromTextShow Int -> Bool)-        prop "FromTextShow Int: read . show = id"      (prop_readShow :: Int -> FromTextShow Int -> Bool)-        prop "FromTextShow Int = Int" $                prop_showEq (FromTextShow :: Int -> FromTextShow Int)-        prop "FromTextShow String instance"            (prop_matchesShow :: Int -> FromTextShow String -> Bool)-        prop "FromTextShow String: read . show = id"   (prop_readShow :: Int -> FromTextShow String -> Bool)-        prop "FromTextShow String = String" $          prop_showEq (FromTextShow :: String -> FromTextShow String)-        -- TODO: Figure out why these fail on NixOS---         prop "print behavior"                          prop_print---         prop "traceShow behavior"                      prop_traceShow---- -- | 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 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+{-|
+Module:      Spec.FromStringTextShowSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for 'FromStringShow' and 'FromTextShow'.
+-}
+module Spec.FromStringTextShowSpec (main, spec) where
+
+import Instances.FromStringTextShow ()
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+import Text.Show.Text (FromStringShow(..), FromTextShow(..))
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "FromStringShow Int" $
+        prop "Show instance" (prop_matchesShow  :: Int -> FromStringShow Int -> Bool)
+    describe "FromStringShow String" $
+        prop "Show instance" (prop_matchesShow :: Int -> FromStringShow String -> Bool)
+    describe "FromTextShow Int" $
+        prop "Show instance" (prop_matchesShow  :: Int -> FromTextShow Int -> Bool)
+    describe "FromTextShow String" $
+        prop "Show instance" (prop_matchesShow  :: Int -> FromTextShow String -> Bool)
tests/Spec/FunctionsSpec.hs view
@@ -1,26 +1,26 @@-{-|-Module:      Spec.FunctionsSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for the orphan 'Show' instance for functions.--}-module Spec.FunctionsSpec (main, spec) where--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--import Text.Show.Functions ()-import Text.Show.Text.Functions ()--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Functions" $-    prop "Int -> Int instance" (prop_matchesShow :: Int -> (Int -> Int) -> Bool)+{-|
+Module:      Spec.FunctionsSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for the orphan 'Show' instance for functions.
+-}
+module Spec.FunctionsSpec (main, spec) where
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+import Text.Show.Functions ()
+import Text.Show.Text.Functions ()
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Int -> Int" $
+    prop "Show instance" (prop_matchesShow :: Int -> (Int -> Int) -> Bool)
tests/Spec/GHC/Conc/WindowsSpec.hs view
@@ -1,41 +1,41 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.GHC.Conc.WindowsSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'ConsoleEvent'.--}-module Spec.GHC.Conc.WindowsSpec (main, spec) where--import Instances.GHC.Conc.Windows ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if !defined(__GHCJS__) && defined(mingw32_HOST_OS)-import GHC.Conc.Windows (ConsoleEvent)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if !defined(__GHCJS__) && defined(mingw32_HOST_OS)-    describe "Text.Show.Text.GHC.Conc.Windows" $-        prop "ConsoleEvent instance" (prop_matchesShow :: Int -> ConsoleEvent -> Bool)-#else-    pure ()-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.GHC.Conc.WindowsSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for 'ConsoleEvent'.
+-}
+module Spec.GHC.Conc.WindowsSpec (main, spec) where
+
+import Instances.GHC.Conc.Windows ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if !defined(__GHCJS__) && defined(mingw32_HOST_OS)
+import GHC.Conc.Windows (ConsoleEvent)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $
+#if !defined(__GHCJS__) && defined(mingw32_HOST_OS)
+    describe "ConsoleEvent" $
+        prop "Show instance" (prop_matchesShow :: Int -> ConsoleEvent -> Bool)
+#else
+    pure ()
+#endif
tests/Spec/GHC/EventSpec.hs view
@@ -1,43 +1,44 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.GHC.EventSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "GHC.Event" module.--}-module Spec.GHC.EventSpec (main, spec) where--import Instances.GHC.Event ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if !defined(__GHCJS__) && !defined(mingw32_HOST_OS) && MIN_VERSION_base(4,4,0)-import GHC.Event (Event)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif---main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if !defined(__GHCJS__) && !defined(mingw32_HOST_OS) && MIN_VERSION_base(4,4,0)-    describe "Text.Show.Text.GHC.Event" $ do-        prop "Event instance" (prop_matchesShow :: Int -> Event -> Bool)---         prop "FdKey instance" (prop_matchesShow :: Int -> FdKey -> Bool)-#else-    pure ()-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.GHC.EventSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "GHC.Event" module.
+-}
+module Spec.GHC.EventSpec (main, spec) where
+
+import Instances.GHC.Event ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if !defined(__GHCJS__) && !defined(mingw32_HOST_OS) && MIN_VERSION_base(4,4,0)
+import GHC.Event (Event)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+#endif
+
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+#if !defined(__GHCJS__) && !defined(mingw32_HOST_OS) && MIN_VERSION_base(4,4,0)
+    describe "Event" $
+        prop "Show instance" (prop_matchesShow :: Int -> Event -> Bool)
+--     describe "FdKey" $
+--         prop "Show instance" (prop_matchesShow :: Int -> FdKey -> Bool)
+#else
+    pure ()
+#endif
tests/Spec/GHC/FingerprintSpec.hs view
@@ -1,43 +1,43 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.GHC.FingerprintSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for 'Fingerprint'.--}-module Spec.GHC.FingerprintSpec (main, spec) where--import Data.Orphans ()--import Instances.GHC.Fingerprint ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if MIN_VERSION_base(4,4,0)-import GHC.Fingerprint.Type (Fingerprint)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if MIN_VERSION_base(4,4,0)-    describe "Text.Show.Text.GHC.Fingerprint" $-        prop "Fingerprint instance" (prop_matchesShow :: Int -> Fingerprint -> Bool)-#else-    pure ()-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.GHC.FingerprintSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for 'Fingerprint'.
+-}
+module Spec.GHC.FingerprintSpec (main, spec) where
+
+import Data.Orphans ()
+
+import Instances.GHC.Fingerprint ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if MIN_VERSION_base(4,4,0)
+import GHC.Fingerprint.Type (Fingerprint)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $
+#if MIN_VERSION_base(4,4,0)
+    describe "Fingerprint" $
+        prop "Show instance" (prop_matchesShow :: Int -> Fingerprint -> Bool)
+#else
+    pure ()
+#endif
tests/Spec/GHC/GenericsSpec.hs view
@@ -1,69 +1,65 @@-{-# LANGUAGE CPP           #-}--#if __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE TypeOperators #-}-#endif--{-|-Module:      Spec.GHC.GenericsSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "GHC.Generics" module.--}-module Spec.GHC.GenericsSpec (main, spec) where--import Data.Orphans ()--import Instances.GHC.Generics ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if __GLASGOW_HASKELL__ >= 702-import GHC.Generics (U1, Par1, Rec1, K1, M1, (:+:), (:*:), (:.:),-                     Fixity, Associativity, Arity)--import Spec.Utils (prop_matchesShow, prop_genericShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if __GLASGOW_HASKELL__ >= 702-    describe "Text.Show.Text.GHC.Generics" $ do-        prop "Fixity instance"                    (prop_matchesShow :: Int -> Fixity -> Bool)-        prop "Associativity instance"             (prop_matchesShow :: Int -> Associativity -> Bool)-        prop "Arity instance"                     (prop_matchesShow :: Int -> Arity -> Bool)-        prop "U1 Int instance"                    (prop_matchesShow :: Int -> U1 Int -> Bool)-        prop "Par1 Int instance"                  (prop_matchesShow :: Int -> Par1 Int -> Bool)-        prop "Rec1 Maybe Int instance"            (prop_matchesShow :: Int -> Rec1 Maybe Int -> Bool)-        prop "K1 () Int () instance"              (prop_matchesShow :: Int -> K1 () Int () -> Bool)-        prop "M1 () () Maybe Int instance"        (prop_matchesShow :: Int -> M1 () () Maybe Int -> Bool)-        prop "(Maybe :+: Maybe) Int instance"     (prop_matchesShow :: Int -> (Maybe :+: Maybe) Int -> Bool)-        prop "(Maybe :*: Maybe) Int instance"     (prop_matchesShow :: Int -> (Maybe :*: Maybe) Int -> Bool)-        prop "(Maybe :.: Maybe) Int instance"     (prop_matchesShow :: Int -> (Maybe :.: Maybe) Int -> Bool)-        prop "Fixity generic show"                (prop_genericShow :: Int -> Fixity -> Bool)-        prop "Associativity generic show"         (prop_genericShow :: Int -> Associativity -> Bool)-        prop "Arity generic show"                 (prop_genericShow :: Int -> Arity -> Bool)-        prop "U1 Int generic show"                (prop_genericShow :: Int -> U1 Int -> Bool)-        prop "Par1 Int generic show"              (prop_genericShow :: Int -> Par1 Int -> Bool)-        prop "Rec1 Maybe Int generic show"        (prop_genericShow :: Int -> Rec1 Maybe Int -> Bool)-        prop "K1 () Int () generic show"          (prop_genericShow :: Int -> K1 () Int () -> Bool)-        prop "M1 () () Maybe Int generic show"    (prop_genericShow :: Int -> M1 () () Maybe Int -> Bool)-        prop "(Maybe :+: Maybe) Int generic show" (prop_genericShow :: Int -> (Maybe :+: Maybe) Int -> Bool)-        prop "(Maybe :*: Maybe) Int generic show" (prop_genericShow :: Int -> (Maybe :*: Maybe) Int -> Bool)-        prop "(Maybe :.: Maybe) Int generic show" (prop_genericShow :: Int -> (Maybe :.: Maybe) Int -> Bool)-#else-    pure ()-#endif+{-# LANGUAGE TypeOperators #-}
+
+{-|
+Module:      Spec.GHC.GenericsSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "GHC.Generics" module.
+-}
+module Spec.GHC.GenericsSpec (main, spec) where
+
+import Data.Orphans ()
+
+import Generics.Deriving.Base (U1, Par1, Rec1, K1, M1, (:+:), (:*:), (:.:),
+                               Fixity, Associativity, Arity)
+import Generics.Deriving.Instances ()
+
+import Instances.GHC.Generics ()
+
+import Spec.Utils (prop_matchesShow, prop_genericShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Fixity" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Fixity -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Fixity -> Bool)
+    describe "Associativity" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Associativity -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Associativity -> Bool)
+    describe "Arity" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Arity -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Arity -> Bool)
+    describe "U1 Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> U1 Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> U1 Int -> Bool)
+    describe "Par1 Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Par1 Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Par1 Int -> Bool)
+    describe "Rec1 Maybe Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> Rec1 Maybe Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> Rec1 Maybe Int -> Bool)
+    describe "K1 () Int ()" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> K1 () Int () -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> K1 () Int () -> Bool)
+    describe "M1 () () Maybe Int" $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> M1 () () Maybe Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> M1 () () Maybe Int -> Bool)
+    describe "(Maybe :+: Maybe) Int " $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> (Maybe :+: Maybe) Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> (Maybe :+: Maybe) Int -> Bool)
+    describe "(Maybe :*: Maybe) Int " $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> (Maybe :*: Maybe) Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> (Maybe :*: Maybe) Int -> Bool)
+    describe "(Maybe :.: Maybe) Int " $ do
+        prop "Show instance" (prop_matchesShow  :: Int -> (Maybe :.: Maybe) Int -> Bool)
+        prop "generic Show"  (prop_genericShow  :: Int -> (Maybe :.: Maybe) Int -> Bool)
tests/Spec/GHC/RTS/FlagsSpec.hs view
@@ -1,82 +1,90 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.GHC.RTS.Flags-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for 'ConType'.--}-module Spec.GHC.RTS.FlagsSpec (main, spec) where--import Instances.GHC.RTS.Flags ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if MIN_VERSION_base(4,8,0)-import GHC.RTS.Flags--import Spec.Utils (ioProperty, prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-import Test.QuickCheck (Property)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if MIN_VERSION_base(4,8,0)-    describe "Text.Show.Text.GHC.RTS.Flags" $ do-        prop "RTSFlags instance"   prop_showRTSFlags-        prop "GCFlags instance"    prop_showGCFlags-        prop "ConcFlags instance"  (prop_matchesShow :: Int -> ConcFlags -> Bool)-        prop "MiscFlags instance"  (prop_matchesShow :: Int -> MiscFlags -> Bool)-        prop "DebugFlags instance" (prop_matchesShow :: Int -> DebugFlags -> Bool)-        prop "CCFlags instance"    prop_showCCFlags-        prop "ProfFlags instance"  prop_showProfFlags-        prop "TraceFlags instance" prop_showTraceFlags-        prop "TickyFlags instance" (prop_matchesShow :: Int -> TickyFlags -> Bool)-#else-    pure ()-#endif--#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+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.GHC.RTS.Flags
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for 'ConType'.
+-}
+module Spec.GHC.RTS.FlagsSpec (main, spec) where
+
+import Instances.GHC.RTS.Flags ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if MIN_VERSION_base(4,8,0)
+import GHC.RTS.Flags
+
+import Spec.Utils (ioProperty, prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+import Test.QuickCheck (Property)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+#if MIN_VERSION_base(4,8,0)
+    describe "RTSFlags" $
+        prop "Show instance" prop_showRTSFlags
+    describe "GCFlags" $
+        prop "Show instance" prop_showGCFlags
+    describe "ConcFlags" $
+        prop "Show instance" (prop_matchesShow :: Int -> ConcFlags -> Bool)
+    describe "MiscFlags" $
+        prop "Show instance" (prop_matchesShow :: Int -> MiscFlags -> Bool)
+    describe "DebugFlags" $
+        prop "Show instance" (prop_matchesShow :: Int -> DebugFlags -> Bool)
+    describe "CCFlags" $
+        prop "Show instance" prop_showCCFlags
+    describe "ProfFlags" $
+        prop "Show instance" prop_showProfFlags
+    describe "TraceFlags" $
+        prop "Show instance" prop_showTraceFlags
+    describe "TickyFlags" $
+        prop "Show instance" (prop_matchesShow :: Int -> TickyFlags -> Bool)
+#else
+    pure ()
+#endif
+
+#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
tests/Spec/GHC/StaticPtrSpec.hs view
@@ -1,41 +1,41 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.GHC.StaticPtrSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'StaticPtr'.--}-module Spec.GHC.StaticPtrSpec (main, spec) where--import Instances.GHC.StaticPtr ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if MIN_VERSION_base(4,8,0)-import GHC.StaticPtr (StaticPtrInfo)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if MIN_VERSION_base(4,8,0)-    describe "Text.Show.Text.GHC.StaticPtr" $-        prop "StaticPtrInfo instance" (prop_matchesShow :: Int -> StaticPtrInfo -> Bool)-#else-    pure ()-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.GHC.StaticPtrSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for 'StaticPtr'.
+-}
+module Spec.GHC.StaticPtrSpec (main, spec) where
+
+import Instances.GHC.StaticPtr ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if MIN_VERSION_base(4,8,0)
+import GHC.StaticPtr (StaticPtrInfo)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $
+#if MIN_VERSION_base(4,8,0)
+    describe "StaticPtrInfo" $
+        prop "Show instance" (prop_matchesShow :: Int -> StaticPtrInfo -> Bool)
+#else
+    pure ()
+#endif
tests/Spec/GHC/StatsSpec.hs view
@@ -1,41 +1,41 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.GHC.StatsSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'GCStats'.--}-module Spec.GHC.StatsSpec (main, spec) where--import Instances.GHC.Stats ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if MIN_VERSION_base(4,5,0)-import GHC.Stats (GCStats)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if MIN_VERSION_base(4,5,0)-    describe "Text.Show.Text.GHC.Stats" $-        prop "GCStats instance" (prop_matchesShow :: Int -> GCStats -> Bool)-#else-    pure ()-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.GHC.StatsSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for 'GCStats'.
+-}
+module Spec.GHC.StatsSpec (main, spec) where
+
+import Instances.GHC.Stats ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if MIN_VERSION_base(4,5,0)
+import GHC.Stats (GCStats)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $
+#if MIN_VERSION_base(4,5,0)
+    describe "GCStats" $
+        prop "Show instance" (prop_matchesShow :: Int -> GCStats -> Bool)
+#else
+    pure ()
+#endif
tests/Spec/GHC/TypeLitsSpec.hs view
@@ -1,56 +1,62 @@-{-# LANGUAGE CPP       #-}--#if MIN_VERSION_base(4,6,0) && !(MIN_VERSION_base(4,7,0))-{-# LANGUAGE DataKinds #-}-#endif--{-|-Module:      Spec.GHC.TypeLitsSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "GHC.TypeLits" module.--}-module Spec.GHC.TypeLitsSpec (main, spec) where--import Instances.GHC.TypeLits ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if MIN_VERSION_base(4,6,0)-import GHC.TypeLits--import Spec.Utils (prop_matchesShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if MIN_VERSION_base(4,6,0)-    describe "Text.Show.Text.GHC.TypeLits" $ do-# if MIN_VERSION_base(4,7,0)-        prop "SomeNat instance"    (prop_matchesShow :: Int -> SomeNat -> Bool)-        prop "SomeSymbol instance" (prop_matchesShow :: Int -> SomeSymbol -> Bool)-# else-        prop "IsEven 0 instance"   (prop_matchesShow :: Int -> IsEven 0 -> Bool)-        prop "IsEven 1 instance"   (prop_matchesShow :: Int -> IsEven 1 -> Bool)-        prop "IsEven 2 instance"   (prop_matchesShow :: Int -> IsEven 2 -> Bool)-        prop "IsZero 0 instance"   (prop_matchesShow :: Int -> IsZero 0 -> Bool)-        prop "IsZero 1 instance"   (prop_matchesShow :: Int -> IsZero 1 -> Bool)-        prop "Sing 0 instance"     (prop_matchesShow :: Int -> Sing 0 -> Bool)-        prop "Sing \"a\" instance" (prop_matchesShow :: Int -> Sing "a" -> Bool)-# endif-#else-    pure ()-#endif+{-# LANGUAGE CPP       #-}
+
+#if MIN_VERSION_base(4,6,0) && !(MIN_VERSION_base(4,7,0))
+{-# LANGUAGE DataKinds #-}
+#endif
+
+{-|
+Module:      Spec.GHC.TypeLitsSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "GHC.TypeLits" module.
+-}
+module Spec.GHC.TypeLitsSpec (main, spec) where
+
+import Instances.GHC.TypeLits ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Test.Hspec (Spec, hspec, parallel)
+
+#if MIN_VERSION_base(4,6,0)
+import GHC.TypeLits
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (describe)
+import Test.Hspec.QuickCheck (prop)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+#if MIN_VERSION_base(4,7,0)
+    describe "SomeNat" $
+        prop "Show instance" (prop_matchesShow :: Int -> SomeNat -> Bool)
+    describe "SomeSymbol" $
+        prop "Show instance" (prop_matchesShow :: Int -> SomeSymbol -> Bool)
+#elif MIN_VERSION_base(4,6,0)
+    describe "IsEven 0" $
+        prop "Show instance" (prop_matchesShow :: Int -> IsEven 0 -> Bool)
+    describe "IsEven 1" $
+        prop "Show instance" (prop_matchesShow :: Int -> IsEven 1 -> Bool)
+    describe "IsEven 2" $
+        prop "Show instance" (prop_matchesShow :: Int -> IsEven 2 -> Bool)
+    describe "IsZero 0" $
+        prop "Show instance" (prop_matchesShow :: Int -> IsZero 0 -> Bool)
+    describe "IsZero 1" $
+        prop "Show instance" (prop_matchesShow :: Int -> IsZero 1 -> Bool)
+    describe "Sing 0" $
+        prop "Show instance" (prop_matchesShow :: Int -> Sing 0 -> Bool)
+    describe "Sing \"a\"" $
+        prop "Show instance" (prop_matchesShow :: Int -> Sing "a" -> Bool)
+#else
+    pure ()
+#endif
tests/Spec/GenericSpec.hs view
@@ -1,42 +1,28 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.GenericSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for 'ConType'.--}-module Spec.GenericSpec (main, spec) where--import Instances.Generic ()--import Prelude ()-import Prelude.Compat--import Test.Hspec (Spec, hspec, parallel)--#if __GLASGOW_HASKELL__ >= 702-import Spec.Utils (prop_matchesShow, prop_genericShow)--import Test.Hspec (describe)-import Test.Hspec.QuickCheck (prop)--import Text.Show.Text.Generic (ConType)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel $-#if __GLASGOW_HASKELL__ >= 702-    describe "Text.Show.Text.Generic" $ do-        prop "ConType instance"     (prop_matchesShow :: Int -> ConType -> Bool)-        prop "ConType generic show" (prop_genericShow :: Int -> ConType -> Bool)-#else-    pure ()-#endif+{-|
+Module:      Spec.GenericSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for 'ConType'.
+-}
+module Spec.GenericSpec (main, spec) where
+
+import Instances.Generic ()
+
+import Spec.Utils (prop_matchesShow, prop_genericShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+import Text.Show.Text.Generic (ConType)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "ConType" $ do
+    prop "Show instance" (prop_matchesShow :: Int -> ConType -> Bool)
+    prop "generic Show"  (prop_genericShow :: Int -> ConType -> Bool)
− tests/Spec/MkShowSpec.hs
@@ -1,134 +0,0 @@-{-# 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:      Spec.MkShowSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'mkShowbPrec' in "Text.Show.Text.TH".--}-module Spec.MkShowSpec (main, spec) 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           Spec.Utils (ioProperty)---- import           System.IO (hFlush, stdout, stderr)--- import           System.IO.Silently (capture_, hCapture_)--import           Test.Hspec (Spec, describe, hspec, parallel)-import           Test.Hspec.QuickCheck (prop)--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)--main :: IO ()-main = hspec spec---- | 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--spec :: Spec-spec = parallel . describe "mkShow and related functions" $ do-    prop "$(mkShowbPrec ''AllAtOnce) (a plain type constructor)"            prop_mkShowbPrecTyCon---     prop "$(mkPrint ''AllAtOnce) (a plain type constructor)"                prop_mkPrintTyCon---     prop "$(mkTraceShow ''AllAtOnce) (a plain type constructor)"            prop_mkTraceShowTyCon-#if MIN_VERSION_template_haskell(2,7,0)-    prop "$(mkShowbPrec ''NotAllShow) (a data family instance constructor)" prop_mkShowbPrecDataFamInstCon---     prop "$(mkPrint ''NotAllShow) (a data family instance constructor)"     prop_mkPrintDataFamInstCon---     prop "$(mkTraceShow ''NotAllShow) (a data family instance constructor)" prop_mkTraceShowDataFamInstCon-    prop "$(mkShowbPrec ''OneDataInstance) (a data family name)"            prop_mkShowbPrecDataFam---     prop "$(mkPrint ''OneDataInstance) (a data family name)"                prop_mkPrintDataFam---     prop "$(mkTraceShow ''OneDataInstance) (a data family name)"            prop_mkTraceShowDataFam-#endif
tests/Spec/Numeric/NaturalSpec.hs view
@@ -1,27 +1,27 @@-{-|-Module:      Spec.Numeric.NaturalSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for 'Natural'.--}-module Spec.Numeric.NaturalSpec (main, spec) where--import Instances.Numeric.Natural ()--import Numeric.Natural (Natural)--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Numeric.Natural" $-    prop "Natural instance" (prop_matchesShow :: Int -> Natural -> Bool)+{-|
+Module:      Spec.Numeric.NaturalSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for 'Natural'.
+-}
+module Spec.Numeric.NaturalSpec (main, spec) where
+
+import Instances.Numeric.Natural ()
+
+import Numeric.Natural (Natural)
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "Natural" $
+    prop "Show instance" (prop_matchesShow :: Int -> Natural -> Bool)
tests/Spec/System/ExitSpec.hs view
@@ -1,27 +1,27 @@-{-|-Module:      Spec.System.ExitSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ test for 'ExitCode'.--}-module Spec.System.ExitSpec (main, spec) where--import Instances.System.Exit ()--import Spec.Utils (prop_matchesShow)--import System.Exit (ExitCode)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.System.Exit" $-    prop "ExitCode instance" (prop_matchesShow :: Int -> ExitCode -> Bool)+{-|
+Module:      Spec.System.ExitSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ test for 'ExitCode'.
+-}
+module Spec.System.ExitSpec (main, spec) where
+
+import Instances.System.Exit ()
+
+import Spec.Utils (prop_matchesShow)
+
+import System.Exit (ExitCode)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel . describe "ExitCode" $
+    prop "Show instance" (prop_matchesShow :: Int -> ExitCode -> Bool)
tests/Spec/System/IOSpec.hs view
@@ -1,62 +1,72 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.System.IOSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "System.IO" module.--}-module Spec.System.IOSpec (main, spec) where--#if MIN_VERSION_base(4,4,0)-import GHC.IO.Encoding.Failure (CodingFailureMode)-import GHC.IO.Encoding.Types (CodingProgress)-#endif--import Instances.System.IO ()--import Prelude ()-import Prelude.Compat--import Spec.Utils (ioProperty, prop_matchesShow)--import System.IO (BufferMode, IOMode, HandlePosn, Newline,-                  NewlineMode, SeekMode, Handle, mkTextEncoding)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)-import Test.QuickCheck (Property, generate, oneof)--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.System.IO" $ do-    prop "Handle instance"            (prop_matchesShow :: Int -> Handle -> Bool)-    prop "IOMode instance"            (prop_matchesShow :: Int -> IOMode -> Bool)-    prop "BufferMode instance"        (prop_matchesShow :: Int -> BufferMode -> Bool)-    prop "HandlePosn instance"        (prop_matchesShow :: Int -> HandlePosn -> Bool)-    prop "SeekMode instance"          (prop_matchesShow :: Int -> SeekMode -> Bool)-    prop "TextEncoding instance"      prop_showTextEncoding-#if MIN_VERSION_base(4,4,0)-    prop "CodingProgress instance"    (prop_matchesShow :: Int -> CodingProgress -> Bool)-    prop "CodingFailureMode instance" (prop_matchesShow :: Int -> CodingFailureMode -> Bool)-#endif-    prop "Newline instance"           (prop_matchesShow :: Int -> Newline -> Bool)-    prop "NewlineMode instance"       (prop_matchesShow :: Int -> NewlineMode -> Bool)---- | 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+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.System.IOSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "System.IO" module.
+-}
+module Spec.System.IOSpec (main, spec) where
+
+#if MIN_VERSION_base(4,4,0)
+import GHC.IO.Encoding.Failure (CodingFailureMode)
+import GHC.IO.Encoding.Types (CodingProgress)
+#endif
+
+import Instances.System.IO ()
+
+import Prelude ()
+import Prelude.Compat
+
+import Spec.Utils (ioProperty, prop_matchesShow)
+
+import System.IO (BufferMode, IOMode, HandlePosn, Newline,
+                  NewlineMode, SeekMode, Handle, mkTextEncoding)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+import Test.QuickCheck (Property, generate, oneof)
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Handle" $
+        prop "Show instance" (prop_matchesShow :: Int -> Handle -> Bool)
+    describe "IOMode" $
+        prop "Show instance" (prop_matchesShow :: Int -> IOMode -> Bool)
+    describe "BufferMode" $
+        prop "Show instance" (prop_matchesShow :: Int -> BufferMode -> Bool)
+    describe "HandlePosn" $
+        prop "Show instance" (prop_matchesShow :: Int -> HandlePosn -> Bool)
+    describe "SeekMode" $
+        prop "Show instance" (prop_matchesShow :: Int -> SeekMode -> Bool)
+    describe "TextEncoding" $
+        prop "Show instance" prop_showTextEncoding
+#if MIN_VERSION_base(4,4,0)
+    describe "CodingProgress" $
+        prop "Show instance" (prop_matchesShow :: Int -> CodingProgress -> Bool)
+    describe "CodingFailureMode" $
+        prop "Show instance" (prop_matchesShow :: Int -> CodingFailureMode -> Bool)
+#endif
+    describe "Newline" $
+        prop "Show instance" (prop_matchesShow :: Int -> Newline -> Bool)
+    describe "NewlineMode" $
+        prop "Show instance" (prop_matchesShow :: Int -> NewlineMode -> Bool)
+
+-- | 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
tests/Spec/System/Posix/TypesSpec.hs view
@@ -1,70 +1,84 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.System.Posix.TypesSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "System.Posix.Types" module.--}-module Spec.System.Posix.TypesSpec (main, spec) where--import Instances.System.Posix.Types ()--import Spec.Utils (prop_matchesShow)--import System.Posix.Types--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--#include "HsBaseConfig.h"--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.System.Posix.Types" $ do-    prop "Fd instance"      (prop_matchesShow :: Int -> Fd -> Bool)-#if defined(HTYPE_DEV_T)-    prop "CDev instance"    (prop_matchesShow :: Int -> CDev -> Bool)-#endif-#if defined(HTYPE_INO_T)-    prop "CIno instance"    (prop_matchesShow :: Int -> CIno -> Bool)-#endif-#if defined(HTYPE_MODE_T)-    prop "CMode instance"   (prop_matchesShow :: Int -> CMode -> Bool)-#endif-#if defined(HTYPE_OFF_T)-    prop "COff instance"    (prop_matchesShow :: Int -> COff -> Bool)-#endif-#if defined(HTYPE_PID_T)-    prop "CPid instance"    (prop_matchesShow :: Int -> CPid -> Bool)-#endif-#if defined(HTYPE_SSIZE_T)-    prop "CSsize instance"  (prop_matchesShow :: Int -> CSsize -> Bool)-#endif-#if defined(HTYPE_GID_T)-    prop "CGid instance"    (prop_matchesShow :: Int -> CGid -> Bool)-#endif-#if defined(HTYPE_NLINK_T)-    prop "CNlink instance"  (prop_matchesShow :: Int -> CNlink -> Bool)-#endif-#if defined(HTYPE_UID_T)-    prop "CUid instance"    (prop_matchesShow :: Int -> CUid -> Bool)-#endif-#if defined(HTYPE_CC_T)-    prop "CCc instance"     (prop_matchesShow :: Int -> CCc -> Bool)-#endif-#if defined(HTYPE_SPEED_T)-    prop "CSpeed instance"  (prop_matchesShow :: Int -> CSpeed -> Bool)-#endif-#if defined(HTYPE_TCFLAG_T)-    prop "CTcflag instance" (prop_matchesShow :: Int -> CTcflag -> Bool)-#endif-#if defined(HTYPE_RLIM_T)-    prop "CRLim instance"   (prop_matchesShow :: Int -> CRLim -> Bool)-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.System.Posix.TypesSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "System.Posix.Types" module.
+-}
+module Spec.System.Posix.TypesSpec (main, spec) where
+
+import Instances.System.Posix.Types ()
+
+import Spec.Utils (prop_matchesShow)
+
+import System.Posix.Types
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+#include "HsBaseConfig.h"
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Fd" $
+        prop "Show instance" (prop_matchesShow :: Int -> Fd -> Bool)
+#if defined(HTYPE_DEV_T)
+    describe "CDev" $
+        prop "Show instance" (prop_matchesShow :: Int -> CDev -> Bool)
+#endif
+#if defined(HTYPE_INO_T)
+    describe "CIno" $
+        prop "Show instance" (prop_matchesShow :: Int -> CIno -> Bool)
+#endif
+#if defined(HTYPE_MODE_T)
+    describe "CMode" $
+        prop "Show instance" (prop_matchesShow :: Int -> CMode -> Bool)
+#endif
+#if defined(HTYPE_OFF_T)
+    describe "COff" $
+        prop "Show instance" (prop_matchesShow :: Int -> COff -> Bool)
+#endif
+#if defined(HTYPE_PID_T)
+    describe "CPid" $
+        prop "Show instance" (prop_matchesShow :: Int -> CPid -> Bool)
+#endif
+#if defined(HTYPE_SSIZE_T)
+    describe "CSsize" $
+        prop "Show instance" (prop_matchesShow :: Int -> CSsize -> Bool)
+#endif
+#if defined(HTYPE_GID_T)
+    describe "CGid" $
+        prop "Show instance" (prop_matchesShow :: Int -> CGid -> Bool)
+#endif
+#if defined(HTYPE_NLINK_T)
+    describe "CNlink" $
+        prop "Show instance" (prop_matchesShow :: Int -> CNlink -> Bool)
+#endif
+#if defined(HTYPE_UID_T)
+    describe "CUid" $
+        prop "Show instance" (prop_matchesShow :: Int -> CUid -> Bool)
+#endif
+#if defined(HTYPE_CC_T)
+    describe "CCc" $
+        prop "Show instance" (prop_matchesShow :: Int -> CCc -> Bool)
+#endif
+#if defined(HTYPE_SPEED_T)
+    describe "CSpeed" $
+        prop "Show instance" (prop_matchesShow :: Int -> CSpeed -> Bool)
+#endif
+#if defined(HTYPE_TCFLAG_T)
+    describe "CTcflag" $
+        prop "Show instance" (prop_matchesShow :: Int -> CTcflag -> Bool)
+#endif
+#if defined(HTYPE_RLIM_T)
+    describe "CRLim" $
+        prop "Show instance" (prop_matchesShow :: Int -> CRLim -> Bool)
+#endif
tests/Spec/Text/ReadSpec.hs view
@@ -1,35 +1,37 @@-{-# LANGUAGE CPP #-}--{-|-Module:      Spec.Text.ReadSpec-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--@hspec@ tests for data types in the "Text.Read" module.--}-module Spec.Text.ReadSpec (main, spec) where--import Instances.Text.Read ()--import Spec.Utils (prop_matchesShow)--import Test.Hspec (Spec, describe, hspec, parallel)-import Test.Hspec.QuickCheck (prop)--import Text.Read (Lexeme)-#if MIN_VERSION_base(4,7,0)-import Text.Read.Lex (Number)-#endif--main :: IO ()-main = hspec spec--spec :: Spec-spec = parallel . describe "Text.Show.Text.Text.Read.Lex" $ do-    prop "Lexeme instance" (prop_matchesShow :: Int -> Lexeme -> Bool)-#if MIN_VERSION_base(4,7,0)-    prop "Number instance" (prop_matchesShow :: Int -> Number -> Bool)-#endif+{-# LANGUAGE CPP #-}
+
+{-|
+Module:      Spec.Text.ReadSpec
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+@hspec@ tests for data types in the "Text.Read" module.
+-}
+module Spec.Text.ReadSpec (main, spec) where
+
+import Instances.Text.Read ()
+
+import Spec.Utils (prop_matchesShow)
+
+import Test.Hspec (Spec, describe, hspec, parallel)
+import Test.Hspec.QuickCheck (prop)
+
+import Text.Read (Lexeme)
+#if MIN_VERSION_base(4,7,0)
+import Text.Read.Lex (Number)
+#endif
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = parallel $ do
+    describe "Lexeme" $
+        prop "Show instance" (prop_matchesShow :: Int -> Lexeme -> Bool)
+#if MIN_VERSION_base(4,7,0)
+    describe "Number" $
+        prop "Show instance" (prop_matchesShow :: Int -> Number -> Bool)
+#endif
tests/Spec/Utils.hs view
@@ -1,68 +1,114 @@-{-# LANGUAGE CPP              #-}-{-# LANGUAGE FlexibleContexts #-}-{-|-Module:      Spec.Utils-Copyright:   (C) 2014-2015 Ryan Scott-License:     BSD-style (see the file LICENSE)-Maintainer:  Ryan Scott-Stability:   Experimental-Portability: GHC--Testing-related utility functions.--}-module Spec.Utils (-      ioProperty-    , prop_matchesShow-#if __GLASGOW_HASKELL__ >= 702-    , prop_genericShow-#endif-    , prop_readShow-    , prop_showEq-    ) where--#if __GLASGOW_HASKELL__ >= 702-import           GHC.Generics (Generic, Rep)-import           Text.Show.Text.Generic-#endif--import           Prelude hiding (Show)--#if MIN_VERSION_QuickCheck(2,7,0)-import qualified Test.QuickCheck as QC (ioProperty)-#else-import           Test.QuickCheck (morallyDubiousIOProperty)-#endif-import           Test.QuickCheck (Property, Testable)--import qualified Text.Show as S (Show)-import qualified Text.Show.Text as T (Show)-import           Text.Show.Text hiding (Show)--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--#if __GLASGOW_HASKELL__ >= 702--- | Verifies that a type's @Show@ instance coincides with the output produced--- by the equivalent 'Generic' functions.-prop_genericShow :: (T.Show a, Generic a, GShow (Rep a))-                 => Int -> a -> Bool-prop_genericShow p x = showbPrec p x == genericShowbPrec p x-#endif---- | 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:      Spec.Utils
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Testing-related utility functions.
+-}
+module Spec.Utils (
+      ioProperty
+    , prop_matchesShow
+    , prop_matchesShow1
+    , prop_matchesShow2
+    , prop_genericShow
+    , prop_genericShow'
+    , prop_genericShow1
+    ) where
+
+#include "generic.h"
+
+#if __GLASGOW_HASKELL__ >= 702
+import           GHC.Generics (Generic, Rep)
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+import           GHC.Generics (Generic1, Rep1)
+# endif
+import           Text.Show.Text.Generic
+#endif
+
+import           Prelude hiding (Show)
+
+#if MIN_VERSION_QuickCheck(2,7,0)
+import qualified Test.QuickCheck as QC (ioProperty)
+#else
+import           Test.QuickCheck (morallyDubiousIOProperty)
+#endif
+import           Test.QuickCheck (Property, Testable)
+
+import qualified Text.Show as S (Show)
+import           Text.Show.Text as T
+
+import           TransformersCompat as S
+
+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 @Show1@ instances coincide for both 'String's and 'Text',
+-- irrespective of precedence.
+prop_matchesShow1 :: (S.Show1 f, T.Show1 f) => Int -> f a -> Bool
+prop_matchesShow1 p x = showbPrecWith showb27Prec p (FromStringShow1 x)
+                       == showbPrecWith showb27Prec p x
+
+-- | Verifies that a type's @Show2@ instances coincide for both 'String's and 'Text',
+-- irrespective of precedence.
+prop_matchesShow2 :: (S.Show2 f, T.Show2 f) => Int -> f a b -> Bool
+prop_matchesShow2 p x = showbPrecWith2 showb27Prec showb42Prec p (FromStringShow2 x)
+                       == showbPrecWith2 showb27Prec showb42Prec p x
+
+-- | Show the number 27, which certain parody singer-songwriters find humorous.
+-- Useful for testing higher-order @Show@ classes.
+showb27Prec :: Int -> a -> Builder
+showb27Prec p _ = showbPrec p $ Just (27 :: Int)
+
+-- | Show the number 42, which is said to be the answer to something or other.
+-- Useful for testing higher-order @Show@ classes.
+showb42Prec :: Int -> a -> Builder
+showb42Prec p _ = showbPrec p $ Just (42 :: Int)
+
+-- | Verifies that a type's @Show@ instance coincides with the output produced
+-- by the equivalent 'Generic' functions.
+#if __GLASGOW_HASKELL__ >= 702
+prop_genericShow :: (T.Show a, Generic a, GShow (Rep a))
+                 => Int -> a -> Bool
+prop_genericShow p x = showbPrec p x == genericShowbPrec p x
+#else
+prop_genericShow :: Int -> a -> Bool
+prop_genericShow _ _ = True
+#endif
+
+-- | Behaves exactly like 'prop_genericShow', except only for GHC 7.6 and above.
+-- This is useful with type families, which couldn't properly have derived 'Generic'
+-- instances until GHC 7.6 due to a bug.
+#if __GLASGOW_HASKELL__ >= 706
+prop_genericShow' :: (T.Show a, Generic a, GShow (Rep a))
+                   => Int -> a -> Bool
+prop_genericShow' = prop_genericShow
+#else
+prop_genericShow' :: Int -> f a -> Bool
+prop_genericShow' _ _ = True
+#endif
+
+-- | Verifies that a type's @Show1@ instance coincides with the output produced
+-- by the equivalent 'Generic1' functions.
+#if defined(__LANGUAGE_DERIVE_GENERIC1__)
+prop_genericShow1 :: (T.Show1 f, Generic1 f, GShow1 (Rep1 f))
+                  => Int -> f a -> Bool
+prop_genericShow1 p x = showbPrecWith showb27Prec p x
+                        == genericShowbPrecWith showb27Prec p x
+#else
+prop_genericShow1 :: Int -> f a -> Bool
+prop_genericShow1 _ _ = True
+#endif
+ tests/TransformersCompat.hs view
@@ -0,0 +1,237 @@+{-# LANGUAGE CPP                        #-}
+-- {-# LANGUAGE DeriveDataTypeable         #-}
+{-# LANGUAGE DeriveFoldable             #-}
+{-# LANGUAGE DeriveFunctor              #-}
+{-# LANGUAGE DeriveTraversable          #-}
+{-# LANGUAGE FlexibleContexts           #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+
+#if __GLASGOW_HASKELL__ >= 702
+{-# LANGUAGE DeriveGeneric              #-}
+#endif
+
+#if __GLASGOW_HASKELL__ >= 706
+{-# LANGUAGE PolyKinds                  #-}
+#endif
+
+{-|
+Module:      TransformersCompat
+Copyright:   (C) 2014-2015 Ryan Scott
+License:     BSD-style (see the file LICENSE)
+Maintainer:  Ryan Scott
+Stability:   Provisional
+Portability: GHC
+
+Defines the 'Show1' and 'Show2' classes for @String@s. This module will be removed
+once the next version of @transformers@/@transformers-compat@ is released.
+-}
+module TransformersCompat (
+    -- * Liftings of Prelude classes
+    -- ** For unary constructors
+    Show1(..), showsPrec1,
+    -- ** For binary constructors
+    Show2(..), showsPrec2,
+    -- * Helper functions
+    showsUnaryWith,
+    showsBinaryWith,
+    -- * Conversion between @String@ and @Text@ 'Show1'/'Show2'
+    FromStringShow1(..),
+    FromStringShow2(..)
+    ) where
+
+#include "generic.h"
+#include "inline.h"
+
+import            Control.Applicative (Const(..))
+
+-- #if __GLASGOW_HASKELL__ >= 708
+-- import            Data.Data (Data, Typeable)
+-- #endif
+import            Data.Functor.Identity (Identity(..))
+import            Data.Text.Lazy.Builder (Builder)
+
+#if __GLASGOW_HASKELL__ >= 702
+import            GHC.Generics (Generic)
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+import            GHC.Generics (Generic1)
+# endif
+#endif
+
+import            Prelude ()
+import            Prelude.Compat
+
+import           Text.Read (Read(..), readListPrecDefault)
+import qualified Text.Show.Text as T (Show, Show1, Show2)
+import           Text.Show.Text (fromString, showbPrec, showbPrecWith,
+                                 showbPrecWith2, toString)
+
+-- | Lifting of the 'Show' class to unary type constructors.
+class Show1 f where
+    -- | Lift a 'showsPrec' function through the type constructor.
+    showsPrecWith :: (Int -> a -> ShowS) -> Int -> f a -> ShowS
+
+-- | Lift the standard 'showsPrec' function through the type constructor.
+showsPrec1 :: (Show1 f, Show a) => Int -> f a -> ShowS
+showsPrec1 = showsPrecWith showsPrec
+
+newtype FromStringShow1 f a = FromStringShow1 { fromStringShow1 :: f a }
+  deriving ( Eq
+#if __GLASGOW_HASKELL__ >= 702
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           , Ord
+           )
+
+deriving instance Show1       f => Show1       (FromStringShow1 f)
+deriving instance Functor     f => Functor     (FromStringShow1 f)
+deriving instance Foldable    f => Foldable    (FromStringShow1 f)
+deriving instance Traversable f => Traversable (FromStringShow1 f)
+-- #if __GLASGOW_HASKELL__ >= 708
+-- deriving instance Typeable FromStringShow1
+-- deriving instance (Data (f a), Typeable f, Typeable a) =>
+--     Data (FromStringShow1 f a)
+-- #endif
+
+-- | Convert a @Builder@-based show function to a @ShowS@-based one.
+showbToShows :: (Int -> a -> Builder) -> Int -> a -> ShowS
+showbToShows sp p = showString . toString . sp p
+
+-- | Convert a @ShowS@-based show function to a @Builder@-based one.
+showsToShowb :: (Int -> a -> ShowS) -> Int -> a -> Builder
+showsToShowb sp p x = fromString $ sp p x ""
+
+instance Read (f a) => Read (FromStringShow1 f a) where
+    readPrec = FromStringShow1 <$> readPrec
+    INLINE_INST_FUN(readPrec)
+
+    readListPrec = readListPrecDefault
+    INLINE_INST_FUN(readListPrec)
+
+instance (Show1 f, Show a) => T.Show (FromStringShow1 f a) where
+    showbPrec = showbPrecWith (showsToShowb showsPrec)
+    INLINE_INST_FUN(showbPrec)
+
+instance Show1 f => T.Show1 (FromStringShow1 f) where
+    showbPrecWith sp p (FromStringShow1 x) =
+        fromString $ showsPrecWith (showbToShows sp) p x ""
+    INLINE_INST_FUN(showbPrecWith)
+
+instance (Show1 f, Show a) => Show (FromStringShow1 f a) where
+    showsPrec = showsPrec1
+    INLINE_INST_FUN(showsPrec)
+
+-- | Lifting of the 'Show' class to binary type constructors.
+class Show2 f where
+    -- | Lift 'showsPrec' functions through the type constructor.
+    showsPrecWith2 :: (Int -> a -> ShowS) -> (Int -> b -> ShowS) ->
+        Int -> f a b -> ShowS
+
+-- | Lift the standard 'showsPrec' function through the type constructor.
+showsPrec2 :: (Show2 f, Show a, Show b) => Int -> f a b -> ShowS
+showsPrec2 = showsPrecWith2 showsPrec showsPrec
+
+newtype FromStringShow2 f a b = FromStringShow2 (f a b)
+  deriving ( Eq
+#if __GLASGOW_HASKELL__ >= 702
+           , Generic
+# if defined(__LANGUAGE_DERIVE_GENERIC1__)
+           , Generic1
+# endif
+#endif
+           , Ord
+           )
+
+deriving instance Show2       f     => Show2       (FromStringShow2 f)
+deriving instance Functor     (f a) => Functor     (FromStringShow2 f a)
+deriving instance Foldable    (f a) => Foldable    (FromStringShow2 f a)
+deriving instance Traversable (f a) => Traversable (FromStringShow2 f a)
+-- #if __GLASGOW_HASKELL__ >= 708
+-- deriving instance Typeable FromStringShow2
+-- deriving instance (Data (f a b), Typeable f, Typeable a, Typeable b) =>
+--     Data (FromStringShow2 f a b)
+-- #endif
+
+instance Read (f a b) => Read (FromStringShow2 f a b) where
+    readPrec = FromStringShow2 <$> readPrec
+    INLINE_INST_FUN(readPrec)
+
+    readListPrec = readListPrecDefault
+    INLINE_INST_FUN(readListPrec)
+
+instance (Show2 f, Show a, Show b) => T.Show (FromStringShow2 f a b) where
+    showbPrec = showbPrecWith (showsToShowb showsPrec)
+    INLINE_INST_FUN(showbPrec)
+
+instance (Show2 f, Show a) => T.Show1 (FromStringShow2 f a) where
+    showbPrecWith = showbPrecWith2 (showsToShowb showsPrec)
+    INLINE_INST_FUN(showbPrecWith)
+
+instance Show2 f => T.Show2 (FromStringShow2 f) where
+    showbPrecWith2 sp1 sp2 p (FromStringShow2 x) =
+        fromString $ showsPrecWith2 (showbToShows sp1) (showbToShows sp2) p x ""
+    INLINE_INST_FUN(showbPrecWith2)
+
+instance (Show2 f, Show a, Show b) => Show (FromStringShow2 f a b) where
+    showsPrec = showsPrec2
+    INLINE_INST_FUN(showsPrec)
+
+instance (Show2 f, Show a) => Show1 (FromStringShow2 f a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+    INLINE_INST_FUN(showsPrecWith)
+
+-------------------------------------------------------------------------------
+
+-- | @'showsUnaryWith' sp n d x@ produces the string representation of a
+-- unary data constructor with name @n@ and argument @x@, in precedence
+-- context @d@.
+showsUnaryWith :: (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
+showsUnaryWith sp name d x = showParen (d > 10) $
+    showString name . showChar ' ' . sp 11 x
+
+-- | @'showsBinaryWith' sp1 sp2 n d x y@ produces the string
+-- representation of a binary data constructor with name @n@ and arguments
+-- @x@ and @y@, in precedence context @d@.
+showsBinaryWith :: (Int -> a -> ShowS) -> (Int -> b -> ShowS) ->
+    String -> Int -> a -> b -> ShowS
+showsBinaryWith sp1 sp2 name d x y = showParen (d > 10) $
+    showString name . showChar ' ' . sp1 11 x . showChar ' ' . sp2 11 y
+
+-------------------------------------------------------------------------------
+
+instance Show a => Show1 ((,) a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+
+instance Show a => Show1 (Either a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+
+instance Show a => Show1 (Const a) where
+    showsPrecWith = showsPrecWith2 showsPrec
+
+instance Show1 Maybe where
+    showsPrecWith _  _ Nothing  = showString "Nothing"
+    showsPrecWith sp d (Just x) = showsUnaryWith sp "Just" d x
+
+instance Show1 [] where
+    showsPrecWith _  _ []     = showString "[]"
+    showsPrecWith sp _ (x:xs) = showChar '[' . sp 0 x . showl xs
+      where
+        showl []     = showChar ']'
+        showl (y:ys) = showChar ',' . sp 0 y . showl ys
+
+instance Show1 Identity where
+    showsPrecWith sp d (Identity x) = showsUnaryWith sp "Identity" d x
+
+instance Show2 (,) where
+    showsPrecWith2 sp1 sp2 _ (x, y) =
+        showChar '(' . sp1 0 x . showChar ',' . sp2 0 y . showChar ')'
+
+instance Show2 Either where
+    showsPrecWith2 sp1 _   d (Left x)  = showsUnaryWith sp1 "Left" d x
+    showsPrecWith2 _   sp2 d (Right x) = showsUnaryWith sp2 "Right" d x
+
+instance Show2 Const where
+    showsPrecWith2 sp _ d (Const x) = showsUnaryWith sp "Const" d x
text-show.cabal view
@@ -1,316 +1,329 @@-name:                text-show-version:             0.8.1.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-tested-with:         GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.1-extra-source-files:  CHANGELOG.md, README.md, include/*.h-cabal-version:       >=1.10--source-repository head-  type:                git-  location:            https://github.com/RyanGlScott/text-show--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--                       -- Only exports functions if using Windows-                       Text.Show.Text.GHC.Conc.Windows--                       -- Only exports functions if base >= 4.4-                       Text.Show.Text.GHC.Fingerprint-                       -- Only exports functions if base >= 4.4 and not using Windows-                       Text.Show.Text.GHC.Event--                       -- Only exports functions if GHC >= 7.2-                       Text.Show.Text.Debug.Trace.Generic-                       Text.Show.Text.Generic-                       Text.Show.Text.GHC.Generics--                       -- Only exports functions if base >= 4.5-                       Text.Show.Text.GHC.Stats--                       -- Only exports functions if base >= 4.6-                       Text.Show.Text.GHC.TypeLits--                       -- Only exports functions if base >= 4.7-                       Text.Show.Text.Data.Type.Coercion-                       Text.Show.Text.Data.Type.Equality-                       -- Only exports functions if base >= 4.7 && < 4.8-                       Text.Show.Text.Data.OldTypeable--                       -- Only exports functions if base >= 4.8-                       Text.Show.Text.GHC.RTS.Flags-                       Text.Show.Text.GHC.StaticPtr-  other-modules:       Text.Show.Text.Classes-                       Text.Show.Text.Data.Typeable.Utils-                       Text.Show.Text.Instances-                       Text.Show.Text.TH.Internal-                       Text.Show.Text.Utils-  build-depends:       array              >= 0.3     && < 0.6-                     , base               >= 4.3     && < 5-                     , base-compat        >= 0.8.1   && < 1-                     , bytestring         >= 0.9     && < 0.11-                     , bytestring-builder-                     , ghc-prim-                     , integer-gmp-                     , nats               >= 0.1     && < 2-                     , semigroups         >= 0.16.1  && < 1-                     , tagged             >= 0.4.4   && < 1-                     , text               >= 0.11.1  && < 1.3-                     , template-haskell   >= 2.5     && < 2.11-                     , transformers       >= 0.2.1   && < 0.5-                     , void               >= 0.5     && < 1-  hs-source-dirs:      src-  default-language:    Haskell2010-  ghc-options:         -Wall-  include-dirs:        include-  includes:            inline.h-                     , utils.h-  install-includes:    inline.h-                     , utils.h--test-suite text-show-spec-  type:                exitcode-stdio-1.0-  main-is:             Spec.hs-  other-modules:       Derived--                       Instances.Derived-                       Instances.FromStringTextShow-                       Instances.Utils--                       Instances.Control.Applicative-                       Instances.Control.Concurrent-                       Instances.Control.Exception-                       Instances.Control.Monad.ST-                       Instances.Data.ByteString-                       Instances.Data.Char-                       Instances.Data.Data-                       Instances.Data.Dynamic-                       Instances.Data.Floating-                       Instances.Data.Functor.Identity-                       Instances.Data.Monoid-                       Instances.Data.Ord-                       Instances.Data.Proxy-                       Instances.Data.Text-                       Instances.Data.Tuple-                       Instances.Data.Typeable-                       Instances.Data.Version-                       Instances.Foreign.C.Types-                       Instances.Foreign.Ptr-                       Instances.Numeric.Natural-                       Instances.System.Exit-                       Instances.System.IO-                       Instances.System.Posix.Types-                       Instances.Text.Read--                       -- Only exports functions if using Windows-                       Instances.GHC.Conc.Windows--                       -- Only exports functions if base >= 4.4-                       Instances.GHC.Fingerprint-                       -- Only exports functions if base >= 4.4 and not using Windows-                       Instances.GHC.Event--                       -- Only exports functions if GHC >= 7.2-                       Instances.Generic-                       Instances.GHC.Generics--                       -- Only exports functions if base >= 4.5-                       Instances.GHC.Stats--                       -- Only exports functions if base >= 4.6-                       Instances.GHC.TypeLits--                       -- Only exports functions if base >= 4.7-                       Instances.Data.Type.Coercion-                       Instances.Data.Type.Equality-                       -- Only exports functions if base >= 4.7 && < 4.8-                       Instances.Data.OldTypeable--                       -- Only exports functions if base >= 4.8-                       Instances.GHC.RTS.Flags-                       Instances.GHC.StaticPtr--                       Spec.BuilderSpec-                       Spec.DerivedSpec-                       Spec.FromStringTextShowSpec-                       Spec.MkShowSpec-                       Spec.Utils--                       Spec.Control.ApplicativeSpec-                       Spec.Control.ConcurrentSpec-                       Spec.Control.ExceptionSpec-                       Spec.Control.Monad.STSpec-                       Spec.Data.ArraySpec-                       Spec.Data.BoolSpec-                       Spec.Data.ByteStringSpec-                       Spec.Data.CharSpec-                       Spec.Data.ComplexSpec-                       Spec.Data.DataSpec-                       Spec.Data.DynamicSpec-                       Spec.Data.EitherSpec-                       Spec.Data.FixedSpec-                       Spec.Data.FloatingSpec-                       Spec.Data.Functor.IdentitySpec-                       Spec.Data.IntegralSpec-                       Spec.Data.ListSpec-                       Spec.Data.MaybeSpec-                       Spec.Data.MonoidSpec-                       Spec.Data.OrdSpec-                       Spec.Data.ProxySpec-                       Spec.Data.RatioSpec-                       Spec.Data.TextSpec-                       Spec.Data.TupleSpec-                       Spec.Data.TypeableSpec-                       Spec.Data.VersionSpec-                       Spec.Foreign.C.TypesSpec-                       Spec.Foreign.PtrSpec-                       Spec.FunctionsSpec-                       Spec.Numeric.NaturalSpec-                       Spec.System.ExitSpec-                       Spec.System.IOSpec-                       Spec.System.Posix.TypesSpec-                       Spec.Text.ReadSpec--                       -- Only exports functions if using Windows-                       Spec.GHC.Conc.WindowsSpec--                       -- Only exports functions if base >= 4.4-                       Spec.GHC.FingerprintSpec-                       -- Only exports functions if base >= 4.4 and not using Windows-                       Spec.GHC.EventSpec--                       -- Only exports functions if GHC >= 7.2-                       Spec.GenericSpec-                       Spec.GHC.GenericsSpec--                       -- Only exports functions if base >= 4.5-                       Spec.GHC.StatsSpec--                       -- Only exports functions if base >= 4.6-                       Spec.GHC.TypeLitsSpec--                       -- Only exports functions if base >= 4.7-                       Spec.Data.Type.CoercionSpec-                       Spec.Data.Type.EqualitySpec-                       -- Only exports functions if base >= 4.7 && < 4.8-                       Spec.Data.OldTypeableSpec--                       -- Only exports functions if base >= 4.8-                       Spec.GHC.RTS.FlagsSpec-                       Spec.GHC.StaticPtrSpec-  build-depends:       array                >= 0.3    && < 0.6-                     , base                 >= 4.3    && < 5-                     , base-compat          >= 0.8.2  && < 1-                     , base-orphans         >= 0.3    && < 1-                     , bytestring           >= 0.9    && < 0.11-                     , bytestring-builder-                     , ghc-prim-                     , hspec                >= 2      && < 3-                     , nats                 >= 0.1    && < 2-                     , QuickCheck           >= 2.5    && < 3-                     , quickcheck-instances >= 0.1    && < 0.4-                     -- , silently             >= 1.2.4 && < 1.3-                     , tagged               >= 0.4.4  && < 1-                     , text                 >= 0.11.1 && < 1.3-                     , text-show            == 0.8.1.1-                     , transformers         >= 0.2.1  && < 0.5-                     , transformers-compat  >= 0.3    && < 1-                     , void                 >= 0.5    && < 1-  hs-source-dirs:      tests-  default-language:    Haskell2010-  ghc-options:         -Wall -threaded -rtsopts-  include-dirs:        include-  includes:            overlap.h-                     , utils.h-  install-includes:    overlap.h-                     , utils.h+name:                text-show
+version:             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:           Provisional
+copyright:           (C) 2014-2015 Ryan Scott
+category:            Text
+build-type:          Simple
+tested-with:         GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.1
+extra-source-files:  CHANGELOG.md, README.md, include/*.h
+cabal-version:       >=1.10
+
+source-repository head
+  type:                git
+  location:            https://github.com/RyanGlScott/text-show
+
+library
+  exposed-modules:     Text.Show.Text
+                       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.Debug.Trace
+                       Text.Show.Text.Debug.Trace.Generic
+                       Text.Show.Text.Debug.Trace.TH
+                       Text.Show.Text.Generic
+                       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.GHC.Generics
+                       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
+                       Text.Show.Text.TH
+
+                       -- Only exports functions if using Windows
+                       Text.Show.Text.GHC.Conc.Windows
+
+                       -- Only exports functions if base >= 4.4
+                       Text.Show.Text.GHC.Fingerprint
+                       -- Only exports functions if base >= 4.4 and not using Windows
+                       Text.Show.Text.GHC.Event
+
+                       -- Only exports functions if base >= 4.5
+                       Text.Show.Text.GHC.Stats
+
+                       -- Only exports functions if base >= 4.6
+                       Text.Show.Text.GHC.TypeLits
+
+                       -- Only exports functions if base >= 4.7
+                       Text.Show.Text.Data.Type.Coercion
+                       Text.Show.Text.Data.Type.Equality
+                       -- Only exports functions if base >= 4.7 && < 4.8
+                       Text.Show.Text.Data.OldTypeable
+
+                       -- Only exports functions if base >= 4.8
+                       Text.Show.Text.GHC.RTS.Flags
+                       Text.Show.Text.GHC.StaticPtr
+  other-modules:       Text.Show.Text.Classes
+                       Text.Show.Text.Data.Typeable.Utils
+                       Text.Show.Text.Instances
+                       Text.Show.Text.TH.Internal
+                       Text.Show.Text.Utils
+  build-depends:       array              >= 0.3     && < 0.6
+                     , base               >= 4.3     && < 5
+                     , base-compat        >= 0.8.1   && < 1
+                     , bytestring         >= 0.9     && < 0.11
+                     , bytestring-builder
+                     , containers         >= 0.1     && < 0.6
+                     , generic-deriving   >= 1.8     && < 2
+                     , ghc-prim
+                     , integer-gmp
+                     , nats               >= 0.1     && < 2
+                     , semigroups         >= 0.16.1  && < 1
+                     , tagged             >= 0.4.4   && < 1
+                     , text               >= 0.11.1  && < 1.3
+                     , template-haskell   >= 2.5     && < 2.11
+                     , transformers       >= 0.2.1   && < 0.5
+                     , void               >= 0.5     && < 1
+  hs-source-dirs:      src
+  default-language:    Haskell2010
+  ghc-options:         -Wall
+  include-dirs:        include
+  includes:            inline.h
+                     , utils.h
+  install-includes:    inline.h
+                     , utils.h
+
+test-suite text-show-spec
+  type:                exitcode-stdio-1.0
+  main-is:             Spec.hs
+  other-modules:       Derived.DataFamilies
+                       Derived.DatatypeContexts
+                       Derived.ExistentialQuantification
+                       Derived.Infix
+                       Derived.MagicHash
+                       Derived.PolyKinds
+                       Derived.RankNTypes
+                       Derived.Records
+                       Derived.TypeSynonyms
+
+                       Instances.Control.Applicative
+                       Instances.Control.Concurrent
+                       Instances.Control.Exception
+                       Instances.Control.Monad.ST
+                       Instances.Data.ByteString
+                       Instances.Data.Char
+                       Instances.Data.Data
+                       Instances.Data.Dynamic
+                       Instances.Data.Floating
+                       Instances.Data.Functor.Identity
+                       Instances.Data.Monoid
+                       Instances.Data.Ord
+                       Instances.Data.Proxy
+                       Instances.Data.Text
+                       Instances.Data.Tuple
+                       Instances.Data.Typeable
+                       Instances.Data.Version
+                       Instances.Foreign.C.Types
+                       Instances.Foreign.Ptr
+                       Instances.FromStringTextShow
+                       Instances.Generic
+                       Instances.GHC.Generics
+                       Instances.Numeric.Natural
+                       Instances.System.Exit
+                       Instances.System.IO
+                       Instances.System.Posix.Types
+                       Instances.Text.Read
+                       Instances.Utils
+
+                       -- Only exports instances if using Windows
+                       Instances.GHC.Conc.Windows
+
+                       -- Only exports instances if base >= 4.4
+                       Instances.GHC.Fingerprint
+                       -- Only exports instances if base >= 4.4 and not using Windows
+                       Instances.GHC.Event
+
+                       -- Only exports instances if base >= 4.5
+                       Instances.GHC.Stats
+
+                       -- Only exports instances if base >= 4.6
+                       Instances.GHC.TypeLits
+
+                       -- Only exports instances if base >= 4.7
+                       Instances.Data.Type.Coercion
+                       Instances.Data.Type.Equality
+                       -- Only exports instances if base >= 4.7 && < 4.8
+                       Instances.Data.OldTypeable
+
+                       -- Only exports instances if base >= 4.8
+                       Instances.GHC.RTS.Flags
+                       Instances.GHC.StaticPtr
+
+                       Spec.BuilderSpec
+                       Spec.Control.ApplicativeSpec
+                       Spec.Control.ConcurrentSpec
+                       Spec.Control.ExceptionSpec
+                       Spec.Control.Monad.STSpec
+                       Spec.Data.ArraySpec
+                       Spec.Data.BoolSpec
+                       Spec.Data.ByteStringSpec
+                       Spec.Data.CharSpec
+                       Spec.Data.ComplexSpec
+                       Spec.Data.DataSpec
+                       Spec.Data.DynamicSpec
+                       Spec.Data.EitherSpec
+                       Spec.Data.FixedSpec
+                       Spec.Data.FloatingSpec
+                       Spec.Data.Functor.IdentitySpec
+                       Spec.Data.IntegralSpec
+                       Spec.Data.ListSpec
+                       Spec.Data.MaybeSpec
+                       Spec.Data.MonoidSpec
+                       Spec.Data.OrdSpec
+                       Spec.Data.ProxySpec
+                       Spec.Data.RatioSpec
+                       Spec.Data.TextSpec
+                       Spec.Data.TupleSpec
+                       Spec.Data.TypeableSpec
+                       Spec.Data.VersionSpec
+                       Spec.Derived.DatatypeContextsSpec
+                       Spec.Derived.ExistentialQuantificationSpec
+                       Spec.Derived.InfixSpec
+                       Spec.Derived.MagicHashSpec
+                       Spec.Derived.PolyKindsSpec
+                       Spec.Derived.RankNTypesSpec
+                       Spec.Derived.RecordsSpec
+                       Spec.Derived.TypeSynonymsSpec
+                       Spec.Foreign.C.TypesSpec
+                       Spec.Foreign.PtrSpec
+                       Spec.FromStringTextShowSpec
+                       Spec.FunctionsSpec
+                       Spec.GenericSpec
+                       Spec.GHC.GenericsSpec
+                       Spec.Numeric.NaturalSpec
+                       Spec.System.ExitSpec
+                       Spec.System.IOSpec
+                       Spec.System.Posix.TypesSpec
+                       Spec.Text.ReadSpec
+                       Spec.Utils
+
+                       -- Only exports tests if using Windows
+                       Spec.GHC.Conc.WindowsSpec
+
+                       -- Only exports tests if base >= 4.4
+                       Spec.GHC.FingerprintSpec
+                       -- Only exports tests if base >= 4.4 and not using Windows
+                       Spec.GHC.EventSpec
+
+                       -- Only exports tests if base >= 4.5
+                       Spec.GHC.StatsSpec
+
+                       -- Only exports tests if template-haskell >= 2.7
+                       Spec.Derived.DataFamiliesSpec
+
+                       -- Only exports tests if base >= 4.6
+                       Spec.GHC.TypeLitsSpec
+
+                       -- Only exports tests if base >= 4.7
+                       Spec.Data.Type.CoercionSpec
+                       Spec.Data.Type.EqualitySpec
+                       -- Only exports tests if base >= 4.7 && < 4.8
+                       Spec.Data.OldTypeableSpec
+
+                       -- Only exports tests if base >= 4.8
+                       Spec.GHC.RTS.FlagsSpec
+                       Spec.GHC.StaticPtrSpec
+
+                       TransformersCompat
+  build-depends:       array                >= 0.3    && < 0.6
+                     , base                 >= 4.3    && < 5
+                     , base-compat          >= 0.8.2  && < 1
+                     , base-orphans         >= 0.4    && < 1
+                     , bytestring           >= 0.9    && < 0.11
+                     , bytestring-builder
+                     , generic-deriving     >= 1.8.0  && < 2
+                     , ghc-prim
+                     , hspec                >= 2      && < 3
+                     , nats                 >= 0.1    && < 2
+                     , QuickCheck           >= 2.5    && < 3
+                     , quickcheck-instances >= 0.1    && < 0.4
+                     , tagged               >= 0.8.1  && < 1
+                     , text                 >= 0.11.1 && < 1.3
+                     , text-show            == 1
+                     , transformers         >= 0.2.1  && < 0.5
+                     , transformers-compat  >= 0.3    && < 1
+                     , void                 >= 0.5    && < 1
+  hs-source-dirs:      tests
+  default-language:    Haskell2010
+  ghc-options:         -Wall -threaded -rtsopts
+  include-dirs:        include
+  includes:            generic.h
+                     , overlap.h
+                     , utils.h
+  install-includes:    generic.h
+                     , overlap.h
+                     , utils.h