Skip to content

Commit

Permalink
Merge pull request #9 from RyanGlScott/show2
Browse files Browse the repository at this point in the history
Show2
  • Loading branch information
Ryan Scott committed Jul 2, 2015
2 parents e460309 + 88933e0 commit 47d7642
Show file tree
Hide file tree
Showing 170 changed files with 4,938 additions and 3,316 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# 0.9
# 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.
* `PragmaOptions` (in `Text.Show.Text.TH`) combined all of its inlining-related fields into a single field, `inlineFunctions`, which takes a list of names of functions to inline.
* 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
Expand Down
11 changes: 11 additions & 0 deletions include/generic.h
Original file line number Diff line number Diff line change
@@ -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
15 changes: 10 additions & 5 deletions src/Text/Show/Text.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ Module: Text.Show.Text
Copyright: (C) 2014-2015 Ryan Scott
License: BSD-style (see the file LICENSE)
Maintainer: Ryan Scott
Stability: Experimental
Stability: Provisional
Portability: GHC
Efficiently convert from values to 'Text' via 'Builder's.
/Since: 0.1/
-}
module Text.Show.Text (
-- * The 'Show' class
-- * The @Show@-related classes
-- ** 'Show'
Show(..)
, show
, showLazy
Expand All @@ -21,10 +22,14 @@ module Text.Show.Text (
, showListLazy
, showbParen
, showbSpace
, showbUnary
-- ** 'Show1'
, Show1(..)
, showbUnary1
, showbBinary1
, showbPrec1
, showbUnaryWith
-- ** 'Show2'
, Show2(..)
, showbPrec2
, showbBinaryWith
-- * 'Builder's
, module Data.Text.Lazy.Builder
, toString
Expand Down
Loading

0 comments on commit 47d7642

Please sign in to comment.