text-show-instances 2 → 2.0.1
raw patch · 55 files changed
+4562/−4538 lines, 55 filesdep ~text-show-instancesdep ~vectorPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: text-show-instances, vector
API changes (from Hackage documentation)
Files
- CHANGELOG.md +35/−32
- README.md +28/−28
- src/TextShow/Compiler/Hoopl.hs +191/−191
- src/TextShow/Control/Applicative/Trans.hs +64/−64
- src/TextShow/Control/Monad/Trans.hs +178/−178
- src/TextShow/Data/Bifunctor.hs +218/−218
- src/TextShow/Data/Binary.hs +41/−41
- src/TextShow/Data/Containers.hs +192/−192
- src/TextShow/Data/Functor/Trans.hs +129/−129
- src/TextShow/Data/List/NonEmpty.hs +31/−31
- src/TextShow/Data/Semigroup.hs +105/−105
- src/TextShow/Data/Tagged.hs +41/−41
- src/TextShow/Data/Time.hs +231/−231
- src/TextShow/Data/UnorderedContainers.hs +74/−74
- src/TextShow/Data/Vector.hs +144/−123
- src/TextShow/Instances.hs +44/−44
- src/TextShow/Language/Haskell/TH.hs +515/−515
- src/TextShow/System/Console/Haskeline.hs +72/−72
- src/TextShow/System/Console/Terminfo.hs +56/−56
- src/TextShow/System/Directory.hs +29/−29
- src/TextShow/System/Locale.hs +29/−29
- src/TextShow/System/Posix.hs +79/−79
- src/TextShow/System/Random.hs +31/−31
- src/TextShow/System/Time.hs +74/−74
- src/TextShow/System/Win32.hs +125/−125
- src/TextShow/Text/PrettyPrint.hs +106/−106
- src/TextShow/Text/XHtml.hs +87/−87
- src/TextShow/Trace/Hpc.hs +104/−104
- src/TextShow/Utils.hs +29/−29
- tests/Spec/Compiler/HooplSpec.hs +50/−50
- tests/Spec/Control/Applicative/TransSpec.hs +33/−33
- tests/Spec/Control/Monad/TransSpec.hs +49/−49
- tests/Spec/Data/BifunctorSpec.hs +51/−51
- tests/Spec/Data/BinarySpec.hs +29/−29
- tests/Spec/Data/ContainersSpec.hs +50/−50
- tests/Spec/Data/Functor/TransSpec.hs +42/−42
- tests/Spec/Data/List/NonEmptySpec.hs +31/−31
- tests/Spec/Data/SemigroupSpec.hs +56/−56
- tests/Spec/Data/TaggedSpec.hs +29/−29
- tests/Spec/Data/TimeSpec.hs +48/−48
- tests/Spec/Data/UnorderedContainersSpec.hs +32/−32
- tests/Spec/Language/Haskell/THSpec.hs +187/−187
- tests/Spec/System/Console/HaskelineSpec.hs +41/−41
- tests/Spec/System/Console/TerminfoSpec.hs +44/−44
- tests/Spec/System/DirectorySpec.hs +42/−42
- tests/Spec/System/LocaleSpec.hs +29/−29
- tests/Spec/System/PosixSpec.hs +52/−52
- tests/Spec/System/RandomSpec.hs +29/−29
- tests/Spec/System/TimeSpec.hs +37/−37
- tests/Spec/System/Win32Spec.hs +63/−63
- tests/Spec/Text/PrettyPrintSpec.hs +63/−63
- tests/Spec/Text/XHtmlSpec.hs +38/−38
- tests/Spec/Trace/HpcSpec.hs +44/−44
- tests/Spec/Utils.hs +66/−66
- text-show-instances.cabal +245/−245
CHANGELOG.md view
@@ -1,32 +1,35 @@-# 2 -* Changed the top-level module name from `Text.Show.Text` to `TextShow`, since the former was extremely verbose without much benefit. As a result, this will break all existing code that depends on `text-show-instances`. - -# 1 -* Allow building with `text-show-1`. Also changed the monomorphic functions to match the naming conventions introduced in `text-show-1`. -* Added instances for the `bifunctors` library -* Removed `utf8-string` instance, since it wasn't as useful as I had imagined -* Revamped test suite - -# 0.4 -* Allow building with `text-show-0.8` -* Modules which were previously exported only if using a recent-enough version of GHC/`base` (e.g., `Text.Show.Text.System.Win32`) 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. -* Change test-suite to use `hspec`, allowing for it to be built on GHC 7.0 and 7.2 - -### 0.3.0.1 -* Fixed tests on Windows - -# 0.3 -* Added `showbArgPrec` (and corresponding `Show` and `Show1` instances) to `Text.Show.Text.Data.Semigroup` -* Added `Show1` instances for data types in `Text.Show.Text.Data.List.NonEmpty` and `Text.Show.Text.Data.Semigroup` -* Added `showbDoc` (and corresponding `Show` instance) to `Text.Show.Text.Language.Haskell.TH` -* Renamed `showbDoc` in `Text.Show.Text.Text.PrettyPrint` to `renderB` - -# 0.2 -* Exposed `showbKindPrec` and `showbPredPrec` with later versions of Template Haskell -* Added `renderStyleB` to `Text.Show.Text.Text.PrettyPrint` (for `time-1.5` and later) -* Added `showbTimeLocalePrec` to `Text.Show.Text.Data.Time` -* Added instances for the `binary`, `haskeline`, `hoopl`, `terminfo`, and `utf8-string` libraries -* Removed `transformers-four` flag - -# 0.1 -* Initial commit +## 2.0.1+* Allow building with `vector-0.11` and above. Be aware that the `Show` instances for `Vector` types in `vector-0.11.0` are different from other versions of `vector`.++# 2+* Changed the top-level module name from `Text.Show.Text` to `TextShow`, since the former was extremely verbose without much benefit. As a result, this will break all existing code that depends on `text-show-instances`.++# 1+* Allow building with `text-show-1`. Also changed the monomorphic functions to match the naming conventions introduced in `text-show-1`.+* Added instances for the `bifunctors` library+* Removed `utf8-string` instance, since it wasn't as useful as I had imagined+* Revamped test suite++# 0.4+* Allow building with `text-show-0.8`+* Modules which were previously exported only if using a recent-enough version of GHC/`base` (e.g., `Text.Show.Text.System.Win32`) 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.+* Change test-suite to use `hspec`, allowing for it to be built on GHC 7.0 and 7.2++### 0.3.0.1+* Fixed tests on Windows++# 0.3+* Added `showbArgPrec` (and corresponding `Show` and `Show1` instances) to `Text.Show.Text.Data.Semigroup`+* Added `Show1` instances for data types in `Text.Show.Text.Data.List.NonEmpty` and `Text.Show.Text.Data.Semigroup`+* Added `showbDoc` (and corresponding `Show` instance) to `Text.Show.Text.Language.Haskell.TH`+* Renamed `showbDoc` in `Text.Show.Text.Text.PrettyPrint` to `renderB`++# 0.2+* Exposed `showbKindPrec` and `showbPredPrec` with later versions of Template Haskell+* Added `renderStyleB` to `Text.Show.Text.Text.PrettyPrint` (for `time-1.5` and later)+* Added `showbTimeLocalePrec` to `Text.Show.Text.Data.Time`+* Added instances for the `binary`, `haskeline`, `hoopl`, `terminfo`, and `utf8-string` libraries+* Removed `transformers-four` flag++# 0.1+* Initial commit
README.md view
@@ -1,28 +1,28 @@-# `text-show-instances` [](http://hackage.haskell.org/package/text-show-instances) [](https://travis-ci.org/RyanGlScott/text-show-instances) - -`text-show-instances` is a supplemental library to [`text-show`](https://github.com/RyanGlScott/text-show) that provides additional `Show` instances for data types in common Haskell libraries and GHC dependencies that are not encompassed by `text-show`. Currently, `text-show-instances` covers these libraries: - -* [`bifunctors`](http://hackage.haskell.org/package/bifunctors) -* [`binary`](http://hackage.haskell.org/package/binary) -* [`containers`](http://hackage.haskell.org/package/containers) -* [`directory`](http://hackage.haskell.org/package/directory) -* [`haskeline`](http://hackage.haskell.org/package/haskeline) -* [`hoopl`](http://hackage.haskell.org/package/hoopl) -* [`hpc`](http://hackage.haskell.org/package/hpc) -* [`old-locale`](http://hackage.haskell.org/package/old-locale) -* [`old-time`](http://hackage.haskell.org/package/old-time) -* [`pretty`](http://hackage.haskell.org/package/pretty) -* [`random`](http://hackage.haskell.org/package/random) -* [`semigroups`](http://hackage.haskell.org/package/semigroups) -* [`tagged`](http://hackage.haskell.org/package/tagged) -* [`template-haskell`](http://hackage.haskell.org/package/template-haskell) -* [`terminfo`](http://hackage.haskell.org/package/terminfo) -* [`time`](http://hackage.haskell.org/package/time) -* [`transformers`](http://hackage.haskell.org/package/transformers) -* [`unix`](http://hackage.haskell.org/package/unix) -* [`unordered-containers`](http://hackage.haskell.org/package/unordered-containers) -* [`vector`](http://hackage.haskell.org/package/vector) -* [`Win32`](http://hackage.haskell.org/package/Win32) -* [`xhtml`](http://hackage.haskell.org/package/xhtml) - -One can use these instances by importing `Text.Show.Text.Instances`. Alternatively, there are monomorphic versions of the `showb` function available in the other submodules of `Text.Show.Text`. +# `text-show-instances` [](http://hackage.haskell.org/package/text-show-instances) [](https://travis-ci.org/RyanGlScott/text-show-instances)++`text-show-instances` is a supplemental library to [`text-show`](https://github.com/RyanGlScott/text-show) that provides additional `Show` instances for data types in common Haskell libraries and GHC dependencies that are not encompassed by `text-show`. Currently, `text-show-instances` covers these libraries:++* [`bifunctors`](http://hackage.haskell.org/package/bifunctors)+* [`binary`](http://hackage.haskell.org/package/binary)+* [`containers`](http://hackage.haskell.org/package/containers)+* [`directory`](http://hackage.haskell.org/package/directory)+* [`haskeline`](http://hackage.haskell.org/package/haskeline)+* [`hoopl`](http://hackage.haskell.org/package/hoopl)+* [`hpc`](http://hackage.haskell.org/package/hpc)+* [`old-locale`](http://hackage.haskell.org/package/old-locale)+* [`old-time`](http://hackage.haskell.org/package/old-time)+* [`pretty`](http://hackage.haskell.org/package/pretty)+* [`random`](http://hackage.haskell.org/package/random)+* [`semigroups`](http://hackage.haskell.org/package/semigroups)+* [`tagged`](http://hackage.haskell.org/package/tagged)+* [`template-haskell`](http://hackage.haskell.org/package/template-haskell)+* [`terminfo`](http://hackage.haskell.org/package/terminfo)+* [`time`](http://hackage.haskell.org/package/time)+* [`transformers`](http://hackage.haskell.org/package/transformers)+* [`unix`](http://hackage.haskell.org/package/unix)+* [`unordered-containers`](http://hackage.haskell.org/package/unordered-containers)+* [`vector`](http://hackage.haskell.org/package/vector)+* [`Win32`](http://hackage.haskell.org/package/Win32)+* [`xhtml`](http://hackage.haskell.org/package/xhtml)++One can use these instances by importing `TextShow.Instances`. Alternatively, there are monomorphic versions of the `showb` function available in the other submodules of `TextShow`.
src/TextShow/Compiler/Hoopl.hs view
@@ -1,191 +1,191 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Compiler.Hoopl -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @hoopl@ library. - -/Since: 2/ --} -module TextShow.Compiler.Hoopl ( - showbLabel - , showbLabelMapPrecWith - , showbLabelSetPrec - , showbPointedWith - , showbUnique - , showbUniqueMapPrecWith - , showbUniqueSetPrec - , showbDominatorNode - , showbDominatorTree - , showbDPath - ) where - -import Compiler.Hoopl (Label, LabelMap, LabelSet, Pointed(..), - Unique, UniqueMap, UniqueSet) -#if MIN_VERSION_hoopl(3,9,0) -import Compiler.Hoopl.Internals (lblToUnique) -#else -import Compiler.Hoopl.GHC (lblToUnique, uniqueToInt) -#endif -import Compiler.Hoopl.Passes.Dominator (DominatorNode(..), DominatorTree(..), DPath(..)) - -import Data.Monoid.Compat - -import TextShow (TextShow(showb, showbPrec), TextShow1(..), - TextShow2(..), Builder, singleton) -import TextShow.Data.Containers () -import TextShow.Data.Integral (showbIntPrec) -import TextShow.TH (deriveTextShow, deriveTextShow1) - -#include "inline.h" - --- | Convert a 'Label' to a 'Builder'. --- --- /Since: 2/ -showbLabel :: Label -> Builder -showbLabel l = singleton 'L' <> showbUnique (lblToUnique l) -{-# INLINE showbLabel #-} - --- | Convert a 'LabelMap' to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbLabelMapPrecWith :: (Int -> v -> Builder) -> Int -> LabelMap v -> Builder -showbLabelMapPrecWith = showbPrecWith -{-# INLINE showbLabelMapPrecWith #-} - --- | Convert a 'LabelSet' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbLabelSetPrec :: Int -> LabelSet -> Builder -showbLabelSetPrec = showbPrec -{-# INLINE showbLabelSetPrec #-} - --- | Convert a 'Pointed' value to a 'Builder' with the given show function. --- --- /Since: 2/ -showbPointedWith :: (a -> Builder) -> Pointed t b a -> Builder -showbPointedWith _ Bot = "_|_" -showbPointedWith _ Top = singleton 'T' -showbPointedWith sp (PElem a) = sp a -{-# INLINE showbPointedWith #-} - --- | Convert a 'Unique' value to a 'Builder'. --- --- /Since: 2/ -showbUnique :: Unique -> Builder -#if MIN_VERSION_hoopl(3,9,0) -showbUnique = showbIntPrec 0 -#else -showbUnique = showbIntPrec 0 . uniqueToInt -#endif -{-# INLINE showbUnique #-} - --- | Convert a 'UniqueMap' to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbUniqueMapPrecWith :: (Int -> v -> Builder) -> Int -> UniqueMap v -> Builder -showbUniqueMapPrecWith = showbPrecWith -{-# INLINE showbUniqueMapPrecWith #-} - --- | Convert a 'UniqueSet' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbUniqueSetPrec :: Int -> UniqueSet -> Builder -showbUniqueSetPrec = showbPrec -{-# INLINE showbUniqueSetPrec #-} - --- | Convert a 'DominatorNode' to a 'Builder'. --- --- /Since: 2/ -showbDominatorNode :: DominatorNode -> Builder -showbDominatorNode Entry = "entryNode" -showbDominatorNode (Labelled l) = showbLabel l -{-# INLINE showbDominatorNode #-} - --- | Convert a 'DominatorTree' to a 'Builder'. --- --- /Since: 2/ -showbDominatorTree :: DominatorTree -> Builder -showbDominatorTree t = mconcat $ "digraph {\n" : dot t ["}\n"] - where - dot :: DominatorTree -> [Builder] -> [Builder] - dot (Dominates root trees) = - (dotnode root :) . outedges trees . flip (foldl subtree) trees - where - outedges :: [DominatorTree] -> [Builder] -> [Builder] - outedges [] = id - outedges (Dominates n _ : ts) = - \bs -> " " - : showbDominatorNode root - : " -> " - : showbDominatorNode n - : singleton '\n' - : outedges ts bs - - dotnode :: DominatorNode -> Builder - dotnode Entry = " entryNode [shape=plaintext, label=\"entry\"]\n" - dotnode (Labelled l) = " " <> showbLabel l <> singleton '\n' - - subtree :: [Builder] -> DominatorTree -> [Builder] - subtree = flip dot - --- | Convert a 'DPath' to a 'Builder'. --- --- /Since: 2/ -showbDPath :: DPath -> Builder -showbDPath (DPath ls) = mconcat $ foldr (\l path ->showbLabel l <> " -> " : path) - ["entry"] - ls -{-# INLINE showbDPath #-} - -instance TextShow Label where - showb = showbLabel - INLINE_INST_FUN(showb) - -$(deriveTextShow ''LabelMap) -$(deriveTextShow1 ''LabelMap) - -$(deriveTextShow ''LabelSet) - -instance TextShow a => TextShow (Pointed t b a) where - showbPrec = showbPrecWith showbPrec - INLINE_INST_FUN(showbPrec) - -instance TextShow1 (Pointed t b) where - showbPrecWith sp _ = showbPointedWith $ sp 0 - INLINE_INST_FUN(showbPrecWith) - -instance TextShow2 (Pointed t) where - showbPrecWith2 _ = showbPrecWith - INLINE_INST_FUN(showbPrecWith2) - -#if !(MIN_VERSION_hoopl(3,9,0)) -instance TextShow Unique where - showb = showbUnique - INLINE_INST_FUN(showb) -#endif - -$(deriveTextShow ''UniqueMap) -$(deriveTextShow1 ''UniqueMap) - -$(deriveTextShow ''UniqueSet) - -instance TextShow DominatorNode where - showb = showbDominatorNode - INLINE_INST_FUN(showb) - -instance TextShow DominatorTree where - showb = showbDominatorTree - INLINE_INST_FUN(showb) - -instance TextShow DPath where - showb = showbDPath - INLINE_INST_FUN(showb) +{-# LANGUAGE CPP #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Compiler.Hoopl+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @hoopl@ library.++/Since: 2/+-}+module TextShow.Compiler.Hoopl (+ showbLabel+ , showbLabelMapPrecWith+ , showbLabelSetPrec+ , showbPointedWith+ , showbUnique+ , showbUniqueMapPrecWith+ , showbUniqueSetPrec+ , showbDominatorNode+ , showbDominatorTree+ , showbDPath+ ) where++import Compiler.Hoopl (Label, LabelMap, LabelSet, Pointed(..),+ Unique, UniqueMap, UniqueSet)+#if MIN_VERSION_hoopl(3,9,0)+import Compiler.Hoopl.Internals (lblToUnique)+#else+import Compiler.Hoopl.GHC (lblToUnique, uniqueToInt)+#endif+import Compiler.Hoopl.Passes.Dominator (DominatorNode(..), DominatorTree(..), DPath(..))++import Data.Monoid.Compat++import TextShow (TextShow(showb, showbPrec), TextShow1(..),+ TextShow2(..), Builder, singleton)+import TextShow.Data.Containers ()+import TextShow.Data.Integral (showbIntPrec)+import TextShow.TH (deriveTextShow, deriveTextShow1)++#include "inline.h"++-- | Convert a 'Label' to a 'Builder'.+--+-- /Since: 2/+showbLabel :: Label -> Builder+showbLabel l = singleton 'L' <> showbUnique (lblToUnique l)+{-# INLINE showbLabel #-}++-- | Convert a 'LabelMap' to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbLabelMapPrecWith :: (Int -> v -> Builder) -> Int -> LabelMap v -> Builder+showbLabelMapPrecWith = showbPrecWith+{-# INLINE showbLabelMapPrecWith #-}++-- | Convert a 'LabelSet' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbLabelSetPrec :: Int -> LabelSet -> Builder+showbLabelSetPrec = showbPrec+{-# INLINE showbLabelSetPrec #-}++-- | Convert a 'Pointed' value to a 'Builder' with the given show function.+--+-- /Since: 2/+showbPointedWith :: (a -> Builder) -> Pointed t b a -> Builder+showbPointedWith _ Bot = "_|_"+showbPointedWith _ Top = singleton 'T'+showbPointedWith sp (PElem a) = sp a+{-# INLINE showbPointedWith #-}++-- | Convert a 'Unique' value to a 'Builder'.+--+-- /Since: 2/+showbUnique :: Unique -> Builder+#if MIN_VERSION_hoopl(3,9,0)+showbUnique = showbIntPrec 0+#else+showbUnique = showbIntPrec 0 . uniqueToInt+#endif+{-# INLINE showbUnique #-}++-- | Convert a 'UniqueMap' to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbUniqueMapPrecWith :: (Int -> v -> Builder) -> Int -> UniqueMap v -> Builder+showbUniqueMapPrecWith = showbPrecWith+{-# INLINE showbUniqueMapPrecWith #-}++-- | Convert a 'UniqueSet' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbUniqueSetPrec :: Int -> UniqueSet -> Builder+showbUniqueSetPrec = showbPrec+{-# INLINE showbUniqueSetPrec #-}++-- | Convert a 'DominatorNode' to a 'Builder'.+--+-- /Since: 2/+showbDominatorNode :: DominatorNode -> Builder+showbDominatorNode Entry = "entryNode"+showbDominatorNode (Labelled l) = showbLabel l+{-# INLINE showbDominatorNode #-}++-- | Convert a 'DominatorTree' to a 'Builder'.+--+-- /Since: 2/+showbDominatorTree :: DominatorTree -> Builder+showbDominatorTree t = mconcat $ "digraph {\n" : dot t ["}\n"]+ where+ dot :: DominatorTree -> [Builder] -> [Builder]+ dot (Dominates root trees) =+ (dotnode root :) . outedges trees . flip (foldl subtree) trees+ where+ outedges :: [DominatorTree] -> [Builder] -> [Builder]+ outedges [] = id+ outedges (Dominates n _ : ts) =+ \bs -> " "+ : showbDominatorNode root+ : " -> "+ : showbDominatorNode n+ : singleton '\n'+ : outedges ts bs++ dotnode :: DominatorNode -> Builder+ dotnode Entry = " entryNode [shape=plaintext, label=\"entry\"]\n"+ dotnode (Labelled l) = " " <> showbLabel l <> singleton '\n'++ subtree :: [Builder] -> DominatorTree -> [Builder]+ subtree = flip dot++-- | Convert a 'DPath' to a 'Builder'.+--+-- /Since: 2/+showbDPath :: DPath -> Builder+showbDPath (DPath ls) = mconcat $ foldr (\l path ->showbLabel l <> " -> " : path)+ ["entry"]+ ls+{-# INLINE showbDPath #-}++instance TextShow Label where+ showb = showbLabel+ INLINE_INST_FUN(showb)++$(deriveTextShow ''LabelMap)+$(deriveTextShow1 ''LabelMap)++$(deriveTextShow ''LabelSet)++instance TextShow a => TextShow (Pointed t b a) where+ showbPrec = showbPrecWith showbPrec+ INLINE_INST_FUN(showbPrec)++instance TextShow1 (Pointed t b) where+ showbPrecWith sp _ = showbPointedWith $ sp 0+ INLINE_INST_FUN(showbPrecWith)++instance TextShow2 (Pointed t) where+ showbPrecWith2 _ = showbPrecWith+ INLINE_INST_FUN(showbPrecWith2)++#if !(MIN_VERSION_hoopl(3,9,0))+instance TextShow Unique where+ showb = showbUnique+ INLINE_INST_FUN(showb)+#endif++$(deriveTextShow ''UniqueMap)+$(deriveTextShow1 ''UniqueMap)++$(deriveTextShow ''UniqueSet)++instance TextShow DominatorNode where+ showb = showbDominatorNode+ INLINE_INST_FUN(showb)++instance TextShow DominatorTree where+ showb = showbDominatorTree+ INLINE_INST_FUN(showb)++instance TextShow DPath where+ showb = showbDPath+ INLINE_INST_FUN(showb)
src/TextShow/Control/Applicative/Trans.hs view
@@ -1,64 +1,64 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE OverloadedStrings #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Control.Applicative.Trans -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for applicative functor transformers. - -/Since: 2/ --} -module TextShow.Control.Applicative.Trans ( - showbBackwardsPrecWith - , showbLiftPrecWith - ) where - -import Control.Applicative.Backwards (Backwards(..)) -import Control.Applicative.Lift (Lift(..)) - -import TextShow (TextShow(showbPrec), TextShow1(..), - Builder, showbPrec1, showbUnaryWith) - -#include "inline.h" - --- | Convert a 'Backwards' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbBackwardsPrecWith :: TextShow1 f - => (Int -> a -> Builder) - -> Int -> Backwards f a -> Builder -showbBackwardsPrecWith sp p (Backwards x) - = showbUnaryWith (showbPrecWith sp) "Backwards" p x -{-# INLINE showbBackwardsPrecWith #-} - --- | Convert a 'Lift' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbLiftPrecWith :: TextShow1 f - => (Int -> a -> Builder) - -> Int -> Lift f a -> Builder -showbLiftPrecWith sp p (Pure x) = showbUnaryWith sp "Pure" p x -showbLiftPrecWith sp p (Other y) = showbUnaryWith (showbPrecWith sp) "Other" p y -{-# INLINE showbLiftPrecWith #-} - -instance (TextShow1 f, TextShow a) => TextShow (Backwards f a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance TextShow1 f => TextShow1 (Backwards f) where - showbPrecWith = showbBackwardsPrecWith - INLINE_INST_FUN(showbPrecWith) - -instance (TextShow1 f, TextShow a) => TextShow (Lift f a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance TextShow1 f => TextShow1 (Lift f) where - showbPrecWith = showbLiftPrecWith - INLINE_INST_FUN(showbPrecWith) +{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Control.Applicative.Trans+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for applicative functor transformers.++/Since: 2/+-}+module TextShow.Control.Applicative.Trans (+ showbBackwardsPrecWith+ , showbLiftPrecWith+ ) where++import Control.Applicative.Backwards (Backwards(..))+import Control.Applicative.Lift (Lift(..))++import TextShow (TextShow(showbPrec), TextShow1(..),+ Builder, showbPrec1, showbUnaryWith)++#include "inline.h"++-- | Convert a 'Backwards' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbBackwardsPrecWith :: TextShow1 f+ => (Int -> a -> Builder)+ -> Int -> Backwards f a -> Builder+showbBackwardsPrecWith sp p (Backwards x)+ = showbUnaryWith (showbPrecWith sp) "Backwards" p x+{-# INLINE showbBackwardsPrecWith #-}++-- | Convert a 'Lift' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbLiftPrecWith :: TextShow1 f+ => (Int -> a -> Builder)+ -> Int -> Lift f a -> Builder+showbLiftPrecWith sp p (Pure x) = showbUnaryWith sp "Pure" p x+showbLiftPrecWith sp p (Other y) = showbUnaryWith (showbPrecWith sp) "Other" p y+{-# INLINE showbLiftPrecWith #-}++instance (TextShow1 f, TextShow a) => TextShow (Backwards f a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance TextShow1 f => TextShow1 (Backwards f) where+ showbPrecWith = showbBackwardsPrecWith+ INLINE_INST_FUN(showbPrecWith)++instance (TextShow1 f, TextShow a) => TextShow (Lift f a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance TextShow1 f => TextShow1 (Lift f) where+ showbPrecWith = showbLiftPrecWith+ INLINE_INST_FUN(showbPrecWith)
src/TextShow/Control/Monad/Trans.hs view
@@ -1,178 +1,178 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE OverloadedStrings #-} -{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-} -{-| -Module: TextShow.Control.Monad.Trans -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for monad transformers. - -/Since: 2/ --} -module TextShow.Control.Monad.Trans ( - showbErrorTPrecWith - , showbExceptTPrecWith - , showbIdentityTPrecWith - , showbListTPrec - , showbListTPrecWith - , showbMaybeTPrecWith - , showbWriterTLazyPrecWith - , showbWriterTStrictPrecWith - ) where - -import Control.Monad.Trans.Error (ErrorT(..)) -import Control.Monad.Trans.Except (ExceptT(..)) -import Control.Monad.Trans.Identity (IdentityT(..)) -import Control.Monad.Trans.List (ListT(..)) -import Control.Monad.Trans.Maybe (MaybeT(..)) -import qualified Control.Monad.Trans.Writer.Lazy as WL (WriterT(..)) -import qualified Control.Monad.Trans.Writer.Strict as WS (WriterT(..)) - -import TextShow (TextShow(showb, showbPrec), TextShow1(..), - Builder, showbPrec1, showbUnaryWith) -import TextShow.Data.Tuple (showb2TupleWith2) - -#include "inline.h" - --- | Convert an 'ErrorT' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbErrorTPrecWith :: (TextShow e, TextShow1 m) - => (Int -> a -> Builder) - -> Int -> ErrorT e m a -> Builder -showbErrorTPrecWith sp p (ErrorT m) = - showbUnaryWith (showbPrecWith (showbPrecWith sp)) "ErrorT" p m -{-# INLINE showbErrorTPrecWith #-} - --- | Convert an 'ExceptT' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbExceptTPrecWith :: (TextShow e, TextShow1 m) - => (Int -> a -> Builder) - -> Int -> ExceptT e m a -> Builder -showbExceptTPrecWith sp p (ExceptT m) = - showbUnaryWith (showbPrecWith (showbPrecWith sp)) "ExceptT" p m -{-# INLINE showbExceptTPrecWith #-} - --- | Convert an 'IdentityT' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbIdentityTPrecWith :: TextShow1 f - => (Int -> a -> Builder) - -> Int -> IdentityT f a -> Builder -showbIdentityTPrecWith sp p (IdentityT m) = - showbUnaryWith (showbPrecWith sp) "IdentityT" p m -{-# INLINE showbIdentityTPrecWith #-} - --- | Convert a 'ListT' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbListTPrec :: (TextShow1 m, TextShow a) => Int -> ListT m a -> Builder -showbListTPrec p (ListT m) = showbUnaryWith (showbPrecWith showbPrec) "ListT" p m -{-# INLINE showbListTPrec #-} - --- | Convert a 'ListT' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbListTPrecWith :: TextShow1 m - => (a -> Builder) - -> Int -> ListT m a -> Builder -showbListTPrecWith sp p (ListT m) = - showbUnaryWith (showbPrecWith (showbPrecWith (const sp))) "ListT" p m -{-# INLINE showbListTPrecWith #-} - --- | Convert a 'MaybeT' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbMaybeTPrecWith :: TextShow1 m - => (Int -> a -> Builder) - -> Int -> MaybeT m a -> Builder -showbMaybeTPrecWith sp p (MaybeT m) = - showbUnaryWith (showbPrecWith (showbPrecWith sp)) "MaybeT" p m -{-# INLINE showbMaybeTPrecWith #-} - --- | Convert a lazy 'WL.WriterT' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbWriterTLazyPrecWith :: (TextShow w, TextShow1 m) - => (a -> Builder) - -> Int -> WL.WriterT w m a -> Builder -showbWriterTLazyPrecWith sp p (WL.WriterT m) = - showbUnaryWith (showbPrecWith (const $ showb2TupleWith2 sp showb)) "WriterT" p m -{-# INLINE showbWriterTLazyPrecWith #-} - --- | Convert a strict 'WS.WriterT' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbWriterTStrictPrecWith :: (TextShow w, TextShow1 m) - => (a -> Builder) - -> Int -> WS.WriterT w m a -> Builder -showbWriterTStrictPrecWith sp p (WS.WriterT m) = - showbUnaryWith (showbPrecWith (const $ showb2TupleWith2 sp showb)) "WriterT" p m -{-# INLINE showbWriterTStrictPrecWith #-} - -instance (TextShow e, TextShow1 m, TextShow a) => TextShow (ErrorT e m a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance (TextShow e, TextShow1 m) => TextShow1 (ErrorT e m) where - showbPrecWith = showbErrorTPrecWith - INLINE_INST_FUN(showbPrecWith) - -instance (TextShow e, TextShow1 m, TextShow a) => TextShow (ExceptT e m a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance (TextShow e, TextShow1 m) => TextShow1 (ExceptT e m) where - showbPrecWith = showbExceptTPrecWith - INLINE_INST_FUN(showbPrecWith) - -instance (TextShow1 f, TextShow a) => TextShow (IdentityT f a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance TextShow1 f => TextShow1 (IdentityT f) where - showbPrecWith = showbIdentityTPrecWith - INLINE_INST_FUN(showbPrecWith) - -instance (TextShow1 m, TextShow a) => TextShow (ListT m a) where - showbPrec = showbListTPrec - INLINE_INST_FUN(showbPrec) - -instance TextShow1 m => TextShow1 (ListT m) where - showbPrecWith sp = showbListTPrecWith $ sp 0 - INLINE_INST_FUN(showbPrecWith) - -instance (TextShow1 m, TextShow a) => TextShow (MaybeT m a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance TextShow1 m => TextShow1 (MaybeT m) where - showbPrecWith = showbMaybeTPrecWith - INLINE_INST_FUN(showbPrecWith) - -instance (TextShow w, TextShow1 m, TextShow a) => TextShow (WL.WriterT w m a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance (TextShow w, TextShow1 m) => TextShow1 (WL.WriterT w m) where - showbPrecWith sp = showbWriterTLazyPrecWith $ sp 0 - INLINE_INST_FUN(showbPrecWith) - -instance (TextShow w, TextShow1 m, TextShow a) => TextShow (WS.WriterT w m a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance (TextShow w, TextShow1 m) => TextShow1 (WS.WriterT w m) where - showbPrecWith sp = showbWriterTStrictPrecWith $ sp 0 - INLINE_INST_FUN(showbPrecWith) +{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-}+{-|+Module: TextShow.Control.Monad.Trans+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for monad transformers.++/Since: 2/+-}+module TextShow.Control.Monad.Trans (+ showbErrorTPrecWith+ , showbExceptTPrecWith+ , showbIdentityTPrecWith+ , showbListTPrec+ , showbListTPrecWith+ , showbMaybeTPrecWith+ , showbWriterTLazyPrecWith+ , showbWriterTStrictPrecWith+ ) where++import Control.Monad.Trans.Error (ErrorT(..))+import Control.Monad.Trans.Except (ExceptT(..))+import Control.Monad.Trans.Identity (IdentityT(..))+import Control.Monad.Trans.List (ListT(..))+import Control.Monad.Trans.Maybe (MaybeT(..))+import qualified Control.Monad.Trans.Writer.Lazy as WL (WriterT(..))+import qualified Control.Monad.Trans.Writer.Strict as WS (WriterT(..))++import TextShow (TextShow(showb, showbPrec), TextShow1(..),+ Builder, showbPrec1, showbUnaryWith)+import TextShow.Data.Tuple (showb2TupleWith2)++#include "inline.h"++-- | Convert an 'ErrorT' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbErrorTPrecWith :: (TextShow e, TextShow1 m)+ => (Int -> a -> Builder)+ -> Int -> ErrorT e m a -> Builder+showbErrorTPrecWith sp p (ErrorT m) =+ showbUnaryWith (showbPrecWith (showbPrecWith sp)) "ErrorT" p m+{-# INLINE showbErrorTPrecWith #-}++-- | Convert an 'ExceptT' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbExceptTPrecWith :: (TextShow e, TextShow1 m)+ => (Int -> a -> Builder)+ -> Int -> ExceptT e m a -> Builder+showbExceptTPrecWith sp p (ExceptT m) =+ showbUnaryWith (showbPrecWith (showbPrecWith sp)) "ExceptT" p m+{-# INLINE showbExceptTPrecWith #-}++-- | Convert an 'IdentityT' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbIdentityTPrecWith :: TextShow1 f+ => (Int -> a -> Builder)+ -> Int -> IdentityT f a -> Builder+showbIdentityTPrecWith sp p (IdentityT m) =+ showbUnaryWith (showbPrecWith sp) "IdentityT" p m+{-# INLINE showbIdentityTPrecWith #-}++-- | Convert a 'ListT' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbListTPrec :: (TextShow1 m, TextShow a) => Int -> ListT m a -> Builder+showbListTPrec p (ListT m) = showbUnaryWith (showbPrecWith showbPrec) "ListT" p m+{-# INLINE showbListTPrec #-}++-- | Convert a 'ListT' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbListTPrecWith :: TextShow1 m+ => (a -> Builder)+ -> Int -> ListT m a -> Builder+showbListTPrecWith sp p (ListT m) =+ showbUnaryWith (showbPrecWith (showbPrecWith (const sp))) "ListT" p m+{-# INLINE showbListTPrecWith #-}++-- | Convert a 'MaybeT' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbMaybeTPrecWith :: TextShow1 m+ => (Int -> a -> Builder)+ -> Int -> MaybeT m a -> Builder+showbMaybeTPrecWith sp p (MaybeT m) =+ showbUnaryWith (showbPrecWith (showbPrecWith sp)) "MaybeT" p m+{-# INLINE showbMaybeTPrecWith #-}++-- | Convert a lazy 'WL.WriterT' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbWriterTLazyPrecWith :: (TextShow w, TextShow1 m)+ => (a -> Builder)+ -> Int -> WL.WriterT w m a -> Builder+showbWriterTLazyPrecWith sp p (WL.WriterT m) =+ showbUnaryWith (showbPrecWith (const $ showb2TupleWith2 sp showb)) "WriterT" p m+{-# INLINE showbWriterTLazyPrecWith #-}++-- | Convert a strict 'WS.WriterT' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbWriterTStrictPrecWith :: (TextShow w, TextShow1 m)+ => (a -> Builder)+ -> Int -> WS.WriterT w m a -> Builder+showbWriterTStrictPrecWith sp p (WS.WriterT m) =+ showbUnaryWith (showbPrecWith (const $ showb2TupleWith2 sp showb)) "WriterT" p m+{-# INLINE showbWriterTStrictPrecWith #-}++instance (TextShow e, TextShow1 m, TextShow a) => TextShow (ErrorT e m a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance (TextShow e, TextShow1 m) => TextShow1 (ErrorT e m) where+ showbPrecWith = showbErrorTPrecWith+ INLINE_INST_FUN(showbPrecWith)++instance (TextShow e, TextShow1 m, TextShow a) => TextShow (ExceptT e m a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance (TextShow e, TextShow1 m) => TextShow1 (ExceptT e m) where+ showbPrecWith = showbExceptTPrecWith+ INLINE_INST_FUN(showbPrecWith)++instance (TextShow1 f, TextShow a) => TextShow (IdentityT f a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance TextShow1 f => TextShow1 (IdentityT f) where+ showbPrecWith = showbIdentityTPrecWith+ INLINE_INST_FUN(showbPrecWith)++instance (TextShow1 m, TextShow a) => TextShow (ListT m a) where+ showbPrec = showbListTPrec+ INLINE_INST_FUN(showbPrec)++instance TextShow1 m => TextShow1 (ListT m) where+ showbPrecWith sp = showbListTPrecWith $ sp 0+ INLINE_INST_FUN(showbPrecWith)++instance (TextShow1 m, TextShow a) => TextShow (MaybeT m a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance TextShow1 m => TextShow1 (MaybeT m) where+ showbPrecWith = showbMaybeTPrecWith+ INLINE_INST_FUN(showbPrecWith)++instance (TextShow w, TextShow1 m, TextShow a) => TextShow (WL.WriterT w m a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance (TextShow w, TextShow1 m) => TextShow1 (WL.WriterT w m) where+ showbPrecWith sp = showbWriterTLazyPrecWith $ sp 0+ INLINE_INST_FUN(showbPrecWith)++instance (TextShow w, TextShow1 m, TextShow a) => TextShow (WS.WriterT w m a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance (TextShow w, TextShow1 m) => TextShow1 (WS.WriterT w m) where+ showbPrecWith sp = showbWriterTStrictPrecWith $ sp 0+ INLINE_INST_FUN(showbPrecWith)
src/TextShow/Data/Bifunctor.hs view
@@ -1,218 +1,218 @@-{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE UndecidableInstances #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} - -{-| -Module: TextShow.Data.Bifunctor -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @bifunctors@ library. - -/Since: 2/ --} -module TextShow.Data.Bifunctor ( - showbBiffPrec - , showbBiffPrecWith2 - , showbClownPrec - , showbClownPrecWith - , showbFlipPrec - , showbFlipPrecWith2 - , showbJoinPrec - , showbJoinPrecWith - , showbJokerPrec - , showbJokerPrecWith - , showbProductPrec - , showbProductPrecWith2 - , showbTannenPrec - , showbTannenPrecWith2 - , showbWrappedBifunctorPrec - , showbWrappedBifunctorPrecWith2 - ) where - -import Data.Bifunctor.Biff (Biff) -import Data.Bifunctor.Clown (Clown) -import Data.Bifunctor.Flip (Flip) -import Data.Bifunctor.Join (Join(..)) -import Data.Bifunctor.Joker (Joker) -import Data.Bifunctor.Product (Product) -import Data.Bifunctor.Tannen (Tannen) -import Data.Bifunctor.Wrapped (WrappedBifunctor) - -import TextShow (TextShow(..), TextShow1(..), TextShow2(..), Builder) -import TextShow.TH (deriveTextShow1, deriveTextShow2, makeShowbPrec, makeShowbPrecWith) - --- | Convert a 'Biff' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbBiffPrec :: TextShow (p (f a) (g b)) => Int -> Biff p f g a b -> Builder -showbBiffPrec = showbPrec -{-# INLINE showbBiffPrec #-} - --- | Convert a 'Biff' value to a 'Builder' with the given show functions and precedence. --- --- /Since: 2/ -showbBiffPrecWith2 :: (TextShow2 p, TextShow1 f, TextShow1 g) - => (Int -> a -> Builder) -> (Int -> b -> Builder) - -> Int -> Biff p f g a b -> Builder -showbBiffPrecWith2 = showbPrecWith2 -{-# INLINE showbBiffPrecWith2 #-} - --- | Convert a 'Clown' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbClownPrec :: TextShow (f a) => Int -> Clown f a b -> Builder -showbClownPrec = showbPrec -{-# INLINE showbClownPrec #-} - --- | Convert a 'Clown' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbClownPrecWith :: TextShow1 f => (Int -> a -> Builder) -> Int -> Clown f a b -> Builder -showbClownPrecWith sp = showbPrecWith2 sp undefined -{-# INLINE showbClownPrecWith #-} - --- | Convert a 'Flip' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbFlipPrec :: TextShow (p b a) => Int -> Flip p a b -> Builder -showbFlipPrec = showbPrec -{-# INLINE showbFlipPrec #-} - --- | Convert a 'Flip' value to a 'Builder' with the given show functions and precedence. --- --- /Since: 2/ -showbFlipPrecWith2 :: TextShow2 p - => (Int -> a -> Builder) -> (Int -> b -> Builder) - -> Int -> Flip p a b -> Builder -showbFlipPrecWith2 = showbPrecWith2 -{-# INLINE showbFlipPrecWith2 #-} - --- | Convert a 'Join' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbJoinPrec :: TextShow (p a a) => Int -> Join p a -> Builder -showbJoinPrec = showbPrec -{-# INLINE showbJoinPrec #-} - --- | Convert a 'Join' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbJoinPrecWith :: TextShow2 p => (Int -> a -> Builder) -> Int -> Join p a -> Builder -showbJoinPrecWith sp p = showbPrecWith2 sp sp p . runJoin -{-# INLINE showbJoinPrecWith #-} - --- | Convert a 'Joker' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbJokerPrec :: TextShow (g b) => Int -> Joker g a b -> Builder -showbJokerPrec = showbPrec -{-# INLINE showbJokerPrec #-} - --- | Convert a 'Joker' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbJokerPrecWith :: TextShow1 g => (Int -> b -> Builder) -> Int -> Joker g a b -> Builder -showbJokerPrecWith sp = showbPrecWith2 undefined sp -{-# INLINE showbJokerPrecWith #-} - --- | Convert a 'Product' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbProductPrec :: (TextShow (f a b), TextShow (g a b)) => Int -> Product f g a b -> Builder -showbProductPrec = showbPrec -{-# INLINE showbProductPrec #-} - --- | Convert a 'Product' value to a 'Builder' with the given show functions --- and precedence. --- --- /Since: 2/ -showbProductPrecWith2 :: (TextShow2 f, TextShow2 g) - => (Int -> a -> Builder) -> (Int -> b -> Builder) - -> Int -> Product f g a b -> Builder -showbProductPrecWith2 = showbPrecWith2 -{-# INLINE showbProductPrecWith2 #-} - --- | Convert a 'Tannen' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbTannenPrec :: TextShow (f (p a b)) => Int -> Tannen f p a b -> Builder -showbTannenPrec = showbPrec -{-# INLINE showbTannenPrec #-} - --- | Convert a 'Tannen' value to a 'Builder' with the given show functions --- and precedence. --- --- /Since: 2/ -showbTannenPrecWith2 :: (TextShow1 f, TextShow2 p) - => (Int -> a -> Builder) -> (Int -> b -> Builder) - -> Int -> Tannen f p a b -> Builder -showbTannenPrecWith2 = showbPrecWith2 -{-# INLINE showbTannenPrecWith2 #-} - --- | Convert a 'WrappedBifunctor' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbWrappedBifunctorPrec :: TextShow (p a b) => Int -> WrappedBifunctor p a b -> Builder -showbWrappedBifunctorPrec = showbPrec -{-# INLINE showbWrappedBifunctorPrec #-} - --- | Convert a 'WrappedBifunctor' value to a 'Builder' with the given show functions --- and precedence. --- --- /Since: 2/ -showbWrappedBifunctorPrecWith2 :: TextShow2 p - => (Int -> a -> Builder) -> (Int -> b -> Builder) - -> Int -> WrappedBifunctor p a b -> Builder -showbWrappedBifunctorPrecWith2 = showbPrecWith2 -{-# INLINE showbWrappedBifunctorPrecWith2 #-} - -instance TextShow (p (f a) (g b)) => TextShow (Biff p f g a b) where - showbPrec = $(makeShowbPrec ''Biff) -instance (TextShow2 p, TextShow1 f, TextShow1 g, TextShow a) => TextShow1 (Biff p f g a) where - showbPrecWith = showbPrecWith2 showbPrec -$(deriveTextShow2 ''Biff) - -instance TextShow (f a) => TextShow (Clown f a b) where - showbPrec = $(makeShowbPrec ''Clown) -$(deriveTextShow1 ''Clown) -$(deriveTextShow2 ''Clown) - -instance TextShow (p b a) => TextShow (Flip p a b) where - showbPrec = $(makeShowbPrec ''Flip) -instance (TextShow2 p, TextShow a) => TextShow1 (Flip p a) where - showbPrecWith = showbPrecWith2 showbPrec -$(deriveTextShow2 ''Flip) - -instance TextShow (p a a) => TextShow (Join p a) where - showbPrec = $(makeShowbPrec ''Join) -instance TextShow2 p => TextShow1 (Join p) where - showbPrecWith = showbJoinPrecWith - -instance TextShow (g b) => TextShow (Joker g a b) where - showbPrec = $(makeShowbPrec ''Joker) -instance TextShow1 g => TextShow1 (Joker g a) where - showbPrecWith = $(makeShowbPrecWith ''Joker) -$(deriveTextShow2 ''Joker) - -instance (TextShow (f a b), TextShow (g a b)) => TextShow (Product f g a b) where - showbPrec = $(makeShowbPrec ''Product) -instance (TextShow2 f, TextShow2 g, TextShow a) => TextShow1 (Product f g a) where - showbPrecWith = showbPrecWith2 showbPrec -$(deriveTextShow2 ''Product) - -instance TextShow (f (p a b)) => TextShow (Tannen f p a b) where - showbPrec = $(makeShowbPrec ''Tannen) -instance (TextShow1 f, TextShow2 p, TextShow a) => TextShow1 (Tannen f p a) where - showbPrecWith = showbPrecWith2 showbPrec -$(deriveTextShow2 ''Tannen) - -instance TextShow (p a b) => TextShow (WrappedBifunctor p a b) where - showbPrec = $(makeShowbPrec ''WrappedBifunctor) -instance (TextShow2 p, TextShow a) => TextShow1 (WrappedBifunctor p a) where - showbPrecWith = showbPrecWith2 showbPrec -$(deriveTextShow2 ''WrappedBifunctor) +{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE UndecidableInstances #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}++{-|+Module: TextShow.Data.Bifunctor+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @bifunctors@ library.++/Since: 2/+-}+module TextShow.Data.Bifunctor (+ showbBiffPrec+ , showbBiffPrecWith2+ , showbClownPrec+ , showbClownPrecWith+ , showbFlipPrec+ , showbFlipPrecWith2+ , showbJoinPrec+ , showbJoinPrecWith+ , showbJokerPrec+ , showbJokerPrecWith+ , showbProductPrec+ , showbProductPrecWith2+ , showbTannenPrec+ , showbTannenPrecWith2+ , showbWrappedBifunctorPrec+ , showbWrappedBifunctorPrecWith2+ ) where++import Data.Bifunctor.Biff (Biff)+import Data.Bifunctor.Clown (Clown)+import Data.Bifunctor.Flip (Flip)+import Data.Bifunctor.Join (Join(..))+import Data.Bifunctor.Joker (Joker)+import Data.Bifunctor.Product (Product)+import Data.Bifunctor.Tannen (Tannen)+import Data.Bifunctor.Wrapped (WrappedBifunctor)++import TextShow (TextShow(..), TextShow1(..), TextShow2(..), Builder)+import TextShow.TH (deriveTextShow1, deriveTextShow2, makeShowbPrec, makeShowbPrecWith)++-- | Convert a 'Biff' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbBiffPrec :: TextShow (p (f a) (g b)) => Int -> Biff p f g a b -> Builder+showbBiffPrec = showbPrec+{-# INLINE showbBiffPrec #-}++-- | Convert a 'Biff' value to a 'Builder' with the given show functions and precedence.+--+-- /Since: 2/+showbBiffPrecWith2 :: (TextShow2 p, TextShow1 f, TextShow1 g)+ => (Int -> a -> Builder) -> (Int -> b -> Builder)+ -> Int -> Biff p f g a b -> Builder+showbBiffPrecWith2 = showbPrecWith2+{-# INLINE showbBiffPrecWith2 #-}++-- | Convert a 'Clown' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbClownPrec :: TextShow (f a) => Int -> Clown f a b -> Builder+showbClownPrec = showbPrec+{-# INLINE showbClownPrec #-}++-- | Convert a 'Clown' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbClownPrecWith :: TextShow1 f => (Int -> a -> Builder) -> Int -> Clown f a b -> Builder+showbClownPrecWith sp = showbPrecWith2 sp undefined+{-# INLINE showbClownPrecWith #-}++-- | Convert a 'Flip' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbFlipPrec :: TextShow (p b a) => Int -> Flip p a b -> Builder+showbFlipPrec = showbPrec+{-# INLINE showbFlipPrec #-}++-- | Convert a 'Flip' value to a 'Builder' with the given show functions and precedence.+--+-- /Since: 2/+showbFlipPrecWith2 :: TextShow2 p+ => (Int -> a -> Builder) -> (Int -> b -> Builder)+ -> Int -> Flip p a b -> Builder+showbFlipPrecWith2 = showbPrecWith2+{-# INLINE showbFlipPrecWith2 #-}++-- | Convert a 'Join' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbJoinPrec :: TextShow (p a a) => Int -> Join p a -> Builder+showbJoinPrec = showbPrec+{-# INLINE showbJoinPrec #-}++-- | Convert a 'Join' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbJoinPrecWith :: TextShow2 p => (Int -> a -> Builder) -> Int -> Join p a -> Builder+showbJoinPrecWith sp p = showbPrecWith2 sp sp p . runJoin+{-# INLINE showbJoinPrecWith #-}++-- | Convert a 'Joker' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbJokerPrec :: TextShow (g b) => Int -> Joker g a b -> Builder+showbJokerPrec = showbPrec+{-# INLINE showbJokerPrec #-}++-- | Convert a 'Joker' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbJokerPrecWith :: TextShow1 g => (Int -> b -> Builder) -> Int -> Joker g a b -> Builder+showbJokerPrecWith sp = showbPrecWith2 undefined sp+{-# INLINE showbJokerPrecWith #-}++-- | Convert a 'Product' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbProductPrec :: (TextShow (f a b), TextShow (g a b)) => Int -> Product f g a b -> Builder+showbProductPrec = showbPrec+{-# INLINE showbProductPrec #-}++-- | Convert a 'Product' value to a 'Builder' with the given show functions+-- and precedence.+--+-- /Since: 2/+showbProductPrecWith2 :: (TextShow2 f, TextShow2 g)+ => (Int -> a -> Builder) -> (Int -> b -> Builder)+ -> Int -> Product f g a b -> Builder+showbProductPrecWith2 = showbPrecWith2+{-# INLINE showbProductPrecWith2 #-}++-- | Convert a 'Tannen' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbTannenPrec :: TextShow (f (p a b)) => Int -> Tannen f p a b -> Builder+showbTannenPrec = showbPrec+{-# INLINE showbTannenPrec #-}++-- | Convert a 'Tannen' value to a 'Builder' with the given show functions+-- and precedence.+--+-- /Since: 2/+showbTannenPrecWith2 :: (TextShow1 f, TextShow2 p)+ => (Int -> a -> Builder) -> (Int -> b -> Builder)+ -> Int -> Tannen f p a b -> Builder+showbTannenPrecWith2 = showbPrecWith2+{-# INLINE showbTannenPrecWith2 #-}++-- | Convert a 'WrappedBifunctor' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbWrappedBifunctorPrec :: TextShow (p a b) => Int -> WrappedBifunctor p a b -> Builder+showbWrappedBifunctorPrec = showbPrec+{-# INLINE showbWrappedBifunctorPrec #-}++-- | Convert a 'WrappedBifunctor' value to a 'Builder' with the given show functions+-- and precedence.+--+-- /Since: 2/+showbWrappedBifunctorPrecWith2 :: TextShow2 p+ => (Int -> a -> Builder) -> (Int -> b -> Builder)+ -> Int -> WrappedBifunctor p a b -> Builder+showbWrappedBifunctorPrecWith2 = showbPrecWith2+{-# INLINE showbWrappedBifunctorPrecWith2 #-}++instance TextShow (p (f a) (g b)) => TextShow (Biff p f g a b) where+ showbPrec = $(makeShowbPrec ''Biff)+instance (TextShow2 p, TextShow1 f, TextShow1 g, TextShow a) => TextShow1 (Biff p f g a) where+ showbPrecWith = showbPrecWith2 showbPrec+$(deriveTextShow2 ''Biff)++instance TextShow (f a) => TextShow (Clown f a b) where+ showbPrec = $(makeShowbPrec ''Clown)+$(deriveTextShow1 ''Clown)+$(deriveTextShow2 ''Clown)++instance TextShow (p b a) => TextShow (Flip p a b) where+ showbPrec = $(makeShowbPrec ''Flip)+instance (TextShow2 p, TextShow a) => TextShow1 (Flip p a) where+ showbPrecWith = showbPrecWith2 showbPrec+$(deriveTextShow2 ''Flip)++instance TextShow (p a a) => TextShow (Join p a) where+ showbPrec = $(makeShowbPrec ''Join)+instance TextShow2 p => TextShow1 (Join p) where+ showbPrecWith = showbJoinPrecWith++instance TextShow (g b) => TextShow (Joker g a b) where+ showbPrec = $(makeShowbPrec ''Joker)+instance TextShow1 g => TextShow1 (Joker g a) where+ showbPrecWith = $(makeShowbPrecWith ''Joker)+$(deriveTextShow2 ''Joker)++instance (TextShow (f a b), TextShow (g a b)) => TextShow (Product f g a b) where+ showbPrec = $(makeShowbPrec ''Product)+instance (TextShow2 f, TextShow2 g, TextShow a) => TextShow1 (Product f g a) where+ showbPrecWith = showbPrecWith2 showbPrec+$(deriveTextShow2 ''Product)++instance TextShow (f (p a b)) => TextShow (Tannen f p a b) where+ showbPrec = $(makeShowbPrec ''Tannen)+instance (TextShow1 f, TextShow2 p, TextShow a) => TextShow1 (Tannen f p a) where+ showbPrecWith = showbPrecWith2 showbPrec+$(deriveTextShow2 ''Tannen)++instance TextShow (p a b) => TextShow (WrappedBifunctor p a b) where+ showbPrec = $(makeShowbPrec ''WrappedBifunctor)+instance (TextShow2 p, TextShow a) => TextShow1 (WrappedBifunctor p a) where+ showbPrecWith = showbPrecWith2 showbPrec+$(deriveTextShow2 ''WrappedBifunctor)
src/TextShow/Data/Binary.hs view
@@ -1,41 +1,41 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE OverloadedStrings #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} - -{-| -Module: TextShow.Data.Binary -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' function for 'Decoder's. - -/Since: 2/ --} -module TextShow.Data.Binary (showbDecoderWith) where - -import Data.Binary.Get.Internal (Decoder(..)) -import Data.Monoid.Compat - -import TextShow (TextShow(..), TextShow1(..), Builder, fromString, showbPrec1) - -#include "inline.h" - --- | Convert a 'Decoder' to a 'Builder' with the given show function. --- --- /Since: 2/ -showbDecoderWith :: (a -> Builder) -> Decoder a -> Builder -showbDecoderWith _ (Fail _ msg) = "Fail: " <> fromString msg -showbDecoderWith _ (Partial _) = "Partial _" -showbDecoderWith sp (Done _ a) = "Done: " <> sp a -showbDecoderWith _ (BytesRead _ _) = "BytesRead" - -instance TextShow a => TextShow (Decoder a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance TextShow1 Decoder where - showbPrecWith sp _ = showbDecoderWith $ sp 0 - INLINE_INST_FUN(showbPrecWith) +{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}++{-|+Module: TextShow.Data.Binary+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' function for 'Decoder's.++/Since: 2/+-}+module TextShow.Data.Binary (showbDecoderWith) where++import Data.Binary.Get.Internal (Decoder(..))+import Data.Monoid.Compat++import TextShow (TextShow(..), TextShow1(..), Builder, fromString, showbPrec1)++#include "inline.h"++-- | Convert a 'Decoder' to a 'Builder' with the given show function.+--+-- /Since: 2/+showbDecoderWith :: (a -> Builder) -> Decoder a -> Builder+showbDecoderWith _ (Fail _ msg) = "Fail: " <> fromString msg+showbDecoderWith _ (Partial _) = "Partial _"+showbDecoderWith sp (Done _ a) = "Done: " <> sp a+showbDecoderWith _ (BytesRead _ _) = "BytesRead"++instance TextShow a => TextShow (Decoder a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance TextShow1 Decoder where+ showbPrecWith sp _ = showbDecoderWith $ sp 0+ INLINE_INST_FUN(showbPrecWith)
src/TextShow/Data/Containers.hs view
@@ -1,192 +1,192 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS -fno-warn-orphans #-} -{-| -Module: TextShow.Data.Containers -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @containers@ library. - -/Since: 2/ --} -module TextShow.Data.Containers ( - showbIntMapPrecWith - , showbIntSetPrec - , showbMapPrecWith2 - , showbSequencePrec - , showbSequencePrecWith - , showbViewLPrec - , showbViewLPrecWith - , showbViewRPrec - , showbViewRPrecWith - , showbSetPrec - , showbSetPrecWith - , showbTreePrec - , showbTreePrecWith - ) where - -import qualified Data.Foldable as F - -import qualified Data.IntMap as IM -import Data.IntMap (IntMap) -import qualified Data.IntSet as IS -import Data.IntSet (IntSet) -import qualified Data.Map as M -import Data.Map (Map) -import Data.Sequence (Seq, ViewL, ViewR) -import qualified Data.Set as Set -import Data.Set (Set) -import Data.Tree (Tree) - -import TextShow (TextShow(showb, showbPrec), TextShow1(..), TextShow2(..), - Builder, showbPrec1) -import TextShow.Data.Integral () -import TextShow.Data.Tuple (showb2TupleWith2) -import TextShow.TH (deriveTextShow, deriveTextShow1) -import TextShow.Utils (showbUnaryList, showbUnaryListWith) - -#include "inline.h" - --- | Convert an 'IntMap' to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbIntMapPrecWith :: (v -> Builder) -> Int -> IntMap v -> Builder -showbIntMapPrecWith sp p = showbUnaryListWith (showb2TupleWith2 showb sp) p . IM.toList -{-# INLINE showbIntMapPrecWith #-} - --- | Convert an 'IntSet' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbIntSetPrec :: Int -> IntSet -> Builder -showbIntSetPrec p = showbUnaryListWith showb p . IS.toList -{-# INLINE showbIntSetPrec #-} - --- | Convert a 'Map' to a 'Builder' with the given show functions and precedence. --- --- /Since: 2/ -showbMapPrecWith2 :: (k -> Builder) -> (v -> Builder) -> Int -> Map k v -> Builder -showbMapPrecWith2 sp1 sp2 p = showbUnaryListWith (showb2TupleWith2 sp1 sp2) p . M.toList -{-# INLINE showbMapPrecWith2 #-} - --- | Convert a 'Sequence' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbSequencePrec :: TextShow a => Int -> Seq a -> Builder -showbSequencePrec p = showbUnaryList p . F.toList -{-# INLINE showbSequencePrec #-} - --- | Convert a 'Sequence' to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbSequencePrecWith :: (a -> Builder) -> Int -> Seq a -> Builder -showbSequencePrecWith sp p = showbUnaryListWith sp p . F.toList -{-# INLINE showbSequencePrecWith #-} - --- | Convert a 'ViewL' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbViewLPrec :: TextShow a => Int -> ViewL a -> Builder -showbViewLPrec = showbPrec -{-# INLINE showbViewLPrec #-} - --- | Convert a 'ViewL' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbViewLPrecWith :: (a -> Builder) -> Int -> ViewL a -> Builder -showbViewLPrecWith sp = showbPrecWith $ const sp -{-# INLINE showbViewLPrecWith #-} - --- | Convert a 'ViewR' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbViewRPrec :: TextShow a => Int -> ViewR a -> Builder -showbViewRPrec = showbPrec -{-# INLINE showbViewRPrec #-} - --- | Convert a 'ViewR' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbViewRPrecWith :: (a -> Builder) -> Int -> ViewR a -> Builder -showbViewRPrecWith sp = showbPrecWith $ const sp -{-# INLINE showbViewRPrecWith #-} - --- | Convert a 'Set' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbSetPrec :: TextShow a => Int -> Set a -> Builder -showbSetPrec p = showbUnaryList p . Set.toList -{-# INLINE showbSetPrec #-} - --- | Convert a 'Set' to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbSetPrecWith :: (a -> Builder) -> Int -> Set a -> Builder -showbSetPrecWith sp p = showbUnaryListWith sp p . Set.toList -{-# INLINE showbSetPrecWith #-} - --- | Convert a 'Tree' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbTreePrec :: TextShow a => Int -> Tree a -> Builder -showbTreePrec = showbPrec -{-# INLINE showbTreePrec #-} - --- | Convert a 'Tree' to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbTreePrecWith :: (a -> Builder) -> Int -> Tree a -> Builder -showbTreePrecWith sp = showbPrecWith $ const sp -{-# INLINE showbTreePrecWith #-} - -instance TextShow v => TextShow (IntMap v) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance TextShow1 IntMap where - showbPrecWith sp = showbIntMapPrecWith $ sp 0 - INLINE_INST_FUN(showbPrecWith) - -instance TextShow IntSet where - showbPrec = showbIntSetPrec - INLINE_INST_FUN(showbPrec) - -instance (TextShow k, TextShow v) => TextShow (Map k v) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance TextShow k => TextShow1 (Map k) where - showbPrecWith = showbPrecWith2 showbPrec - INLINE_INST_FUN(showbPrecWith) - -instance TextShow2 Map where - showbPrecWith2 sp1 sp2 = showbMapPrecWith2 (sp1 0) (sp2 0) - INLINE_INST_FUN(showbPrecWith2) - -instance TextShow a => TextShow (Seq a) where - showbPrec = showbSequencePrec - INLINE_INST_FUN(showbPrec) - -instance TextShow1 Seq where - showbPrecWith sp = showbSequencePrecWith $ sp 0 - INLINE_INST_FUN(showbPrecWith) - -$(deriveTextShow ''ViewL) -$(deriveTextShow1 ''ViewL) - -$(deriveTextShow ''ViewR) -$(deriveTextShow1 ''ViewR) - -instance TextShow a => TextShow (Set a) where - showbPrec = showbSetPrec - INLINE_INST_FUN(showbPrec) - -instance TextShow1 Set where - showbPrecWith sp = showbSetPrecWith $ sp 0 - INLINE_INST_FUN(showbPrecWith) - -$(deriveTextShow ''Tree) -$(deriveTextShow1 ''Tree) +{-# LANGUAGE CPP #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS -fno-warn-orphans #-}+{-|+Module: TextShow.Data.Containers+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @containers@ library.++/Since: 2/+-}+module TextShow.Data.Containers (+ showbIntMapPrecWith+ , showbIntSetPrec+ , showbMapPrecWith2+ , showbSequencePrec+ , showbSequencePrecWith+ , showbViewLPrec+ , showbViewLPrecWith+ , showbViewRPrec+ , showbViewRPrecWith+ , showbSetPrec+ , showbSetPrecWith+ , showbTreePrec+ , showbTreePrecWith+ ) where++import qualified Data.Foldable as F++import qualified Data.IntMap as IM+import Data.IntMap (IntMap)+import qualified Data.IntSet as IS+import Data.IntSet (IntSet)+import qualified Data.Map as M+import Data.Map (Map)+import Data.Sequence (Seq, ViewL, ViewR)+import qualified Data.Set as Set+import Data.Set (Set)+import Data.Tree (Tree)++import TextShow (TextShow(showb, showbPrec), TextShow1(..), TextShow2(..),+ Builder, showbPrec1)+import TextShow.Data.Integral ()+import TextShow.Data.Tuple (showb2TupleWith2)+import TextShow.TH (deriveTextShow, deriveTextShow1)+import TextShow.Utils (showbUnaryList, showbUnaryListWith)++#include "inline.h"++-- | Convert an 'IntMap' to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbIntMapPrecWith :: (v -> Builder) -> Int -> IntMap v -> Builder+showbIntMapPrecWith sp p = showbUnaryListWith (showb2TupleWith2 showb sp) p . IM.toList+{-# INLINE showbIntMapPrecWith #-}++-- | Convert an 'IntSet' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbIntSetPrec :: Int -> IntSet -> Builder+showbIntSetPrec p = showbUnaryListWith showb p . IS.toList+{-# INLINE showbIntSetPrec #-}++-- | Convert a 'Map' to a 'Builder' with the given show functions and precedence.+--+-- /Since: 2/+showbMapPrecWith2 :: (k -> Builder) -> (v -> Builder) -> Int -> Map k v -> Builder+showbMapPrecWith2 sp1 sp2 p = showbUnaryListWith (showb2TupleWith2 sp1 sp2) p . M.toList+{-# INLINE showbMapPrecWith2 #-}++-- | Convert a 'Sequence' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbSequencePrec :: TextShow a => Int -> Seq a -> Builder+showbSequencePrec p = showbUnaryList p . F.toList+{-# INLINE showbSequencePrec #-}++-- | Convert a 'Sequence' to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbSequencePrecWith :: (a -> Builder) -> Int -> Seq a -> Builder+showbSequencePrecWith sp p = showbUnaryListWith sp p . F.toList+{-# INLINE showbSequencePrecWith #-}++-- | Convert a 'ViewL' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbViewLPrec :: TextShow a => Int -> ViewL a -> Builder+showbViewLPrec = showbPrec+{-# INLINE showbViewLPrec #-}++-- | Convert a 'ViewL' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbViewLPrecWith :: (a -> Builder) -> Int -> ViewL a -> Builder+showbViewLPrecWith sp = showbPrecWith $ const sp+{-# INLINE showbViewLPrecWith #-}++-- | Convert a 'ViewR' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbViewRPrec :: TextShow a => Int -> ViewR a -> Builder+showbViewRPrec = showbPrec+{-# INLINE showbViewRPrec #-}++-- | Convert a 'ViewR' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbViewRPrecWith :: (a -> Builder) -> Int -> ViewR a -> Builder+showbViewRPrecWith sp = showbPrecWith $ const sp+{-# INLINE showbViewRPrecWith #-}++-- | Convert a 'Set' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbSetPrec :: TextShow a => Int -> Set a -> Builder+showbSetPrec p = showbUnaryList p . Set.toList+{-# INLINE showbSetPrec #-}++-- | Convert a 'Set' to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbSetPrecWith :: (a -> Builder) -> Int -> Set a -> Builder+showbSetPrecWith sp p = showbUnaryListWith sp p . Set.toList+{-# INLINE showbSetPrecWith #-}++-- | Convert a 'Tree' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbTreePrec :: TextShow a => Int -> Tree a -> Builder+showbTreePrec = showbPrec+{-# INLINE showbTreePrec #-}++-- | Convert a 'Tree' to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbTreePrecWith :: (a -> Builder) -> Int -> Tree a -> Builder+showbTreePrecWith sp = showbPrecWith $ const sp+{-# INLINE showbTreePrecWith #-}++instance TextShow v => TextShow (IntMap v) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance TextShow1 IntMap where+ showbPrecWith sp = showbIntMapPrecWith $ sp 0+ INLINE_INST_FUN(showbPrecWith)++instance TextShow IntSet where+ showbPrec = showbIntSetPrec+ INLINE_INST_FUN(showbPrec)++instance (TextShow k, TextShow v) => TextShow (Map k v) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance TextShow k => TextShow1 (Map k) where+ showbPrecWith = showbPrecWith2 showbPrec+ INLINE_INST_FUN(showbPrecWith)++instance TextShow2 Map where+ showbPrecWith2 sp1 sp2 = showbMapPrecWith2 (sp1 0) (sp2 0)+ INLINE_INST_FUN(showbPrecWith2)++instance TextShow a => TextShow (Seq a) where+ showbPrec = showbSequencePrec+ INLINE_INST_FUN(showbPrec)++instance TextShow1 Seq where+ showbPrecWith sp = showbSequencePrecWith $ sp 0+ INLINE_INST_FUN(showbPrecWith)++$(deriveTextShow ''ViewL)+$(deriveTextShow1 ''ViewL)++$(deriveTextShow ''ViewR)+$(deriveTextShow1 ''ViewR)++instance TextShow a => TextShow (Set a) where+ showbPrec = showbSetPrec+ INLINE_INST_FUN(showbPrec)++instance TextShow1 Set where+ showbPrecWith sp = showbSetPrecWith $ sp 0+ INLINE_INST_FUN(showbPrecWith)++$(deriveTextShow ''Tree)+$(deriveTextShow1 ''Tree)
src/TextShow/Data/Functor/Trans.hs view
@@ -1,129 +1,129 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE OverloadedStrings #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Data.Functor.Trans -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for functor transformers. Note that an instance for -the 'Identity' transformer is found in @text-show@, since it is a part of -@base-4.8.0.0@ and later. - -/Since: 2/ --} -module TextShow.Data.Functor.Trans ( - showbComposePrecWith - , showbConstantPrecWith - , showbProductPrecWith - , showbReversePrecWith - , showbSumPrecWith - ) where - -import Data.Functor.Compose (Compose(..)) -import Data.Functor.Constant (Constant(..)) -import Data.Functor.Product (Product(..)) -import Data.Functor.Reverse (Reverse(..)) -import Data.Functor.Sum (Sum(..)) - -import TextShow (TextShow(showbPrec), TextShow1(..), TextShow2(..), - Builder, showbPrec1, showbUnaryWith, showbBinaryWith) - -#include "inline.h" - --- | Convert a 'Compose' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbComposePrecWith :: (TextShow1 f, TextShow1 g) - => (Int -> a -> Builder) - -> Int -> Compose f g a -> Builder -showbComposePrecWith sp p (Compose x) = - showbUnaryWith (showbPrecWith (showbPrecWith sp)) "Compose" p x -{-# INLINE showbComposePrecWith #-} - --- | Convert a 'Constant' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbConstantPrecWith :: (Int -> a -> Builder) -> Int -> Constant a b -> Builder -showbConstantPrecWith sp p (Constant x) = showbUnaryWith sp "Constant" p x -{-# INLINE showbConstantPrecWith #-} - --- | Convert a 'Product' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbProductPrecWith :: (TextShow1 f, TextShow1 g) - => (Int -> a -> Builder) - -> Int -> Product f g a -> Builder -showbProductPrecWith sp p (Pair x y) = - showbBinaryWith (showbPrecWith sp) (showbPrecWith sp) "Pair" p x y -{-# INLINE showbProductPrecWith #-} - --- | Convert a 'Reverse' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbReversePrecWith :: TextShow1 f - => (Int -> a -> Builder) - -> Int -> Reverse f a -> Builder -showbReversePrecWith sp p (Reverse x) = showbUnaryWith (showbPrecWith sp) "Reverse" p x -{-# INLINE showbReversePrecWith #-} - --- | Convert a 'Sum' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbSumPrecWith :: (TextShow1 f, TextShow1 g) - => (Int -> a -> Builder) - -> Int -> Sum f g a -> Builder -showbSumPrecWith sp p (InL x) = showbUnaryWith (showbPrecWith sp) "InL" p x -showbSumPrecWith sp p (InR y) = showbUnaryWith (showbPrecWith sp) "InR" p y -{-# INLINE showbSumPrecWith #-} - -instance (TextShow1 f, TextShow1 g, TextShow a) => TextShow (Compose f g a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance (TextShow1 f, TextShow1 g) => TextShow1 (Compose f g) where - showbPrecWith = showbComposePrecWith - INLINE_INST_FUN(showbPrecWith) - -instance TextShow a => TextShow (Constant a b) where - showbPrec = showbConstantPrecWith showbPrec - INLINE_INST_FUN(showbPrec) - -instance TextShow a => TextShow1 (Constant a) where - showbPrecWith = showbPrecWith2 showbPrec - INLINE_INST_FUN(showbPrecWith) - -instance TextShow2 Constant where - showbPrecWith2 sp _ = showbConstantPrecWith sp - INLINE_INST_FUN(showbPrecWith2) - -instance (TextShow1 f, TextShow1 g, TextShow a) => TextShow (Product f g a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance (TextShow1 f, TextShow1 g) => TextShow1 (Product f g) where - showbPrecWith = showbProductPrecWith - INLINE_INST_FUN(showbPrecWith) - -instance (TextShow1 f, TextShow a) => TextShow (Reverse f a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance TextShow1 f => TextShow1 (Reverse f) where - showbPrecWith = showbReversePrecWith - INLINE_INST_FUN(showbPrecWith) - -instance (TextShow1 f, TextShow1 g, TextShow a) => TextShow (Sum f g a) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance (TextShow1 f, TextShow1 g) => TextShow1 (Sum f g) where - showbPrecWith = showbSumPrecWith - INLINE_INST_FUN(showbPrecWith) +{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Data.Functor.Trans+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for functor transformers. Note that an instance for+the 'Identity' transformer is found in @text-show@, since it is a part of+@base-4.8.0.0@ and later.++/Since: 2/+-}+module TextShow.Data.Functor.Trans (+ showbComposePrecWith+ , showbConstantPrecWith+ , showbProductPrecWith+ , showbReversePrecWith+ , showbSumPrecWith+ ) where++import Data.Functor.Compose (Compose(..))+import Data.Functor.Constant (Constant(..))+import Data.Functor.Product (Product(..))+import Data.Functor.Reverse (Reverse(..))+import Data.Functor.Sum (Sum(..))++import TextShow (TextShow(showbPrec), TextShow1(..), TextShow2(..),+ Builder, showbPrec1, showbUnaryWith, showbBinaryWith)++#include "inline.h"++-- | Convert a 'Compose' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbComposePrecWith :: (TextShow1 f, TextShow1 g)+ => (Int -> a -> Builder)+ -> Int -> Compose f g a -> Builder+showbComposePrecWith sp p (Compose x) =+ showbUnaryWith (showbPrecWith (showbPrecWith sp)) "Compose" p x+{-# INLINE showbComposePrecWith #-}++-- | Convert a 'Constant' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbConstantPrecWith :: (Int -> a -> Builder) -> Int -> Constant a b -> Builder+showbConstantPrecWith sp p (Constant x) = showbUnaryWith sp "Constant" p x+{-# INLINE showbConstantPrecWith #-}++-- | Convert a 'Product' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbProductPrecWith :: (TextShow1 f, TextShow1 g)+ => (Int -> a -> Builder)+ -> Int -> Product f g a -> Builder+showbProductPrecWith sp p (Pair x y) =+ showbBinaryWith (showbPrecWith sp) (showbPrecWith sp) "Pair" p x y+{-# INLINE showbProductPrecWith #-}++-- | Convert a 'Reverse' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbReversePrecWith :: TextShow1 f+ => (Int -> a -> Builder)+ -> Int -> Reverse f a -> Builder+showbReversePrecWith sp p (Reverse x) = showbUnaryWith (showbPrecWith sp) "Reverse" p x+{-# INLINE showbReversePrecWith #-}++-- | Convert a 'Sum' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbSumPrecWith :: (TextShow1 f, TextShow1 g)+ => (Int -> a -> Builder)+ -> Int -> Sum f g a -> Builder+showbSumPrecWith sp p (InL x) = showbUnaryWith (showbPrecWith sp) "InL" p x+showbSumPrecWith sp p (InR y) = showbUnaryWith (showbPrecWith sp) "InR" p y+{-# INLINE showbSumPrecWith #-}++instance (TextShow1 f, TextShow1 g, TextShow a) => TextShow (Compose f g a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance (TextShow1 f, TextShow1 g) => TextShow1 (Compose f g) where+ showbPrecWith = showbComposePrecWith+ INLINE_INST_FUN(showbPrecWith)++instance TextShow a => TextShow (Constant a b) where+ showbPrec = showbConstantPrecWith showbPrec+ INLINE_INST_FUN(showbPrec)++instance TextShow a => TextShow1 (Constant a) where+ showbPrecWith = showbPrecWith2 showbPrec+ INLINE_INST_FUN(showbPrecWith)++instance TextShow2 Constant where+ showbPrecWith2 sp _ = showbConstantPrecWith sp+ INLINE_INST_FUN(showbPrecWith2)++instance (TextShow1 f, TextShow1 g, TextShow a) => TextShow (Product f g a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance (TextShow1 f, TextShow1 g) => TextShow1 (Product f g) where+ showbPrecWith = showbProductPrecWith+ INLINE_INST_FUN(showbPrecWith)++instance (TextShow1 f, TextShow a) => TextShow (Reverse f a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance TextShow1 f => TextShow1 (Reverse f) where+ showbPrecWith = showbReversePrecWith+ INLINE_INST_FUN(showbPrecWith)++instance (TextShow1 f, TextShow1 g, TextShow a) => TextShow (Sum f g a) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance (TextShow1 f, TextShow1 g) => TextShow1 (Sum f g) where+ showbPrecWith = showbSumPrecWith+ INLINE_INST_FUN(showbPrecWith)
src/TextShow/Data/List/NonEmpty.hs view
@@ -1,31 +1,31 @@-{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Data.List.NonEmpty -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' function for 'NonEmpty' lists. - -/Since: 2/ --} -module TextShow.Data.List.NonEmpty (showbNonEmptyPrecWith) where - -import Data.List.NonEmpty (NonEmpty) - -import TextShow (Builder, showbPrecWith) -import TextShow.TH (deriveTextShow, deriveTextShow1) - --- | Convert a 'NonEmpty' list to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbNonEmptyPrecWith :: (Int -> a -> Builder) -> Int -> NonEmpty a -> Builder -showbNonEmptyPrecWith = showbPrecWith -{-# INLINE showbNonEmptyPrecWith #-} - -$(deriveTextShow ''NonEmpty) -$(deriveTextShow1 ''NonEmpty) +{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Data.List.NonEmpty+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' function for 'NonEmpty' lists.++/Since: 2/+-}+module TextShow.Data.List.NonEmpty (showbNonEmptyPrecWith) where++import Data.List.NonEmpty (NonEmpty)++import TextShow (Builder, showbPrecWith)+import TextShow.TH (deriveTextShow, deriveTextShow1)++-- | Convert a 'NonEmpty' list to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbNonEmptyPrecWith :: (Int -> a -> Builder) -> Int -> NonEmpty a -> Builder+showbNonEmptyPrecWith = showbPrecWith+{-# INLINE showbNonEmptyPrecWith #-}++$(deriveTextShow ''NonEmpty)+$(deriveTextShow1 ''NonEmpty)
src/TextShow/Data/Semigroup.hs view
@@ -1,105 +1,105 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Data.Semigroup -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for @Semigroup@ data types. - -/Since: 2/ --} -module TextShow.Data.Semigroup ( - showbMinPrecWith - , showbMaxPrecWith - , showbFirstPrecWith - , showbLastPrecWith - , showbWrappedMonoidPrecWith - , showbOptionPrecWith - , showbArgPrecWith2 - ) where - -import Data.Semigroup (Min, Max, First, Last, WrappedMonoid, Option, Arg) - -import TextShow (Builder, showbPrecWith, showbPrecWith2) -import TextShow.TH (deriveTextShow, deriveTextShow1, deriveTextShow2) - -#include "inline.h" - --- | Convert a 'Min' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbMinPrecWith :: (Int -> a -> Builder) -> Int -> Min a -> Builder -showbMinPrecWith = showbPrecWith -{-# INLINE showbMinPrecWith #-} - --- | Convert a 'Max' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbMaxPrecWith :: (Int -> a -> Builder) -> Int -> Max a -> Builder -showbMaxPrecWith = showbPrecWith -{-# INLINE showbMaxPrecWith #-} - --- | Convert a 'First' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -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: 2/ -showbLastPrecWith :: (Int -> a -> Builder) -> Int -> Last a -> Builder -showbLastPrecWith = showbPrecWith -{-# INLINE showbLastPrecWith #-} - --- | Convert a 'WrappedMonoid' to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbWrappedMonoidPrecWith :: (Int -> m -> Builder) -> Int -> WrappedMonoid m -> Builder -showbWrappedMonoidPrecWith = showbPrecWith -{-# INLINE showbWrappedMonoidPrecWith #-} - --- | Convert an 'Option' value to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbOptionPrecWith :: (Int -> a -> Builder) -> Int -> Option a -> Builder -showbOptionPrecWith = showbPrecWith -{-# INLINE showbOptionPrecWith #-} - --- | Convert an 'Arg' value to a 'Builder' with the given show functions and precedence. --- --- /Since: 2/ -showbArgPrecWith2 :: (Int -> a -> Builder) -> (Int -> b -> Builder) - -> Int -> Arg a b -> Builder -showbArgPrecWith2 = showbPrecWith2 -{-# INLINE showbArgPrecWith2 #-} - -$(deriveTextShow ''Min) -$(deriveTextShow1 ''Min) - -$(deriveTextShow ''Max) -$(deriveTextShow1 ''Max) - -$(deriveTextShow ''First) -$(deriveTextShow1 ''First) - -$(deriveTextShow ''Last) -$(deriveTextShow1 ''Last) - -$(deriveTextShow ''WrappedMonoid) -$(deriveTextShow1 ''WrappedMonoid) - -$(deriveTextShow ''Option) -$(deriveTextShow1 ''Option) - -$(deriveTextShow ''Arg) -$(deriveTextShow1 ''Arg) -$(deriveTextShow2 ''Arg) +{-# LANGUAGE CPP #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Data.Semigroup+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for @Semigroup@ data types.++/Since: 2/+-}+module TextShow.Data.Semigroup (+ showbMinPrecWith+ , showbMaxPrecWith+ , showbFirstPrecWith+ , showbLastPrecWith+ , showbWrappedMonoidPrecWith+ , showbOptionPrecWith+ , showbArgPrecWith2+ ) where++import Data.Semigroup (Min, Max, First, Last, WrappedMonoid, Option, Arg)++import TextShow (Builder, showbPrecWith, showbPrecWith2)+import TextShow.TH (deriveTextShow, deriveTextShow1, deriveTextShow2)++#include "inline.h"++-- | Convert a 'Min' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbMinPrecWith :: (Int -> a -> Builder) -> Int -> Min a -> Builder+showbMinPrecWith = showbPrecWith+{-# INLINE showbMinPrecWith #-}++-- | Convert a 'Max' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbMaxPrecWith :: (Int -> a -> Builder) -> Int -> Max a -> Builder+showbMaxPrecWith = showbPrecWith+{-# INLINE showbMaxPrecWith #-}++-- | Convert a 'First' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+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: 2/+showbLastPrecWith :: (Int -> a -> Builder) -> Int -> Last a -> Builder+showbLastPrecWith = showbPrecWith+{-# INLINE showbLastPrecWith #-}++-- | Convert a 'WrappedMonoid' to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbWrappedMonoidPrecWith :: (Int -> m -> Builder) -> Int -> WrappedMonoid m -> Builder+showbWrappedMonoidPrecWith = showbPrecWith+{-# INLINE showbWrappedMonoidPrecWith #-}++-- | Convert an 'Option' value to a 'Builder' with the given show function+-- and precedence.+--+-- /Since: 2/+showbOptionPrecWith :: (Int -> a -> Builder) -> Int -> Option a -> Builder+showbOptionPrecWith = showbPrecWith+{-# INLINE showbOptionPrecWith #-}++-- | Convert an 'Arg' value to a 'Builder' with the given show functions and precedence.+--+-- /Since: 2/+showbArgPrecWith2 :: (Int -> a -> Builder) -> (Int -> b -> Builder)+ -> Int -> Arg a b -> Builder+showbArgPrecWith2 = showbPrecWith2+{-# INLINE showbArgPrecWith2 #-}++$(deriveTextShow ''Min)+$(deriveTextShow1 ''Min)++$(deriveTextShow ''Max)+$(deriveTextShow1 ''Max)++$(deriveTextShow ''First)+$(deriveTextShow1 ''First)++$(deriveTextShow ''Last)+$(deriveTextShow1 ''Last)++$(deriveTextShow ''WrappedMonoid)+$(deriveTextShow1 ''WrappedMonoid)++$(deriveTextShow ''Option)+$(deriveTextShow1 ''Option)++$(deriveTextShow ''Arg)+$(deriveTextShow1 ''Arg)+$(deriveTextShow2 ''Arg)
src/TextShow/Data/Tagged.hs view
@@ -1,41 +1,41 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE OverloadedStrings #-} -{-# OPTIONS -fno-warn-orphans #-} -{-| -Module: TextShow.Data.Tagged -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' function for 'Tagged' values. - -/Since: 2/ --} -module TextShow.Data.Tagged (showbTaggedPrecWith) where - -import Data.Tagged (Tagged(..)) -import TextShow (TextShow(showbPrec), TextShow1(..), TextShow2(..), - Builder, showbPrec1, showbUnaryWith) - -#include "inline.h" - --- | Convert a 'Tagged' value to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbTaggedPrecWith :: (Int -> b -> Builder) -> Int -> Tagged s b -> Builder -showbTaggedPrecWith sp p (Tagged b) = showbUnaryWith sp "Tagged" p b -{-# INLINE showbTaggedPrecWith #-} - -instance TextShow b => TextShow (Tagged s b) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance TextShow1 (Tagged s) where - showbPrecWith = showbTaggedPrecWith - INLINE_INST_FUN(showbPrecWith) - -instance TextShow2 Tagged where - showbPrecWith2 _ = showbTaggedPrecWith - INLINE_INST_FUN(showbPrecWith2) +{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS -fno-warn-orphans #-}+{-|+Module: TextShow.Data.Tagged+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' function for 'Tagged' values.++/Since: 2/+-}+module TextShow.Data.Tagged (showbTaggedPrecWith) where++import Data.Tagged (Tagged(..))+import TextShow (TextShow(showbPrec), TextShow1(..), TextShow2(..),+ Builder, showbPrec1, showbUnaryWith)++#include "inline.h"++-- | Convert a 'Tagged' value to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbTaggedPrecWith :: (Int -> b -> Builder) -> Int -> Tagged s b -> Builder+showbTaggedPrecWith sp p (Tagged b) = showbUnaryWith sp "Tagged" p b+{-# INLINE showbTaggedPrecWith #-}++instance TextShow b => TextShow (Tagged s b) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance TextShow1 (Tagged s) where+ showbPrecWith = showbTaggedPrecWith+ INLINE_INST_FUN(showbPrecWith)++instance TextShow2 Tagged where+ showbPrecWith2 _ = showbTaggedPrecWith+ INLINE_INST_FUN(showbPrecWith2)
src/TextShow/Data/Time.hs view
@@ -1,231 +1,231 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE OverloadedStrings #-} -#if MIN_VERSION_time(1,5,0) -{-# LANGUAGE TemplateHaskell #-} -#endif -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Data.Time -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @time@ library. - -/Since: 2/ --} -module TextShow.Data.Time ( - showbDay - , showbDiffTime - , showbUTCTime - , showbNominalDiffTime - , showbAbsoluteTime - , showbTimeZone - , showbTimeOfDay - , showbLocalTime - , showbZonedTime -#if MIN_VERSION_time(1,5,0) - , showbTimeLocalePrec -#endif - ) where - -import Data.Fixed (Pico) -import Data.Monoid.Compat -import Data.Semigroup (timesN) -import Data.Time.Calendar (Day, toGregorian) -import Data.Time.Clock (DiffTime, UTCTime, NominalDiffTime) -import Data.Time.Clock.TAI (AbsoluteTime, taiToUTCTime) -import Data.Time.Format (NumericPadOption) -import Data.Time.LocalTime (TimeZone(..), TimeOfDay(..), LocalTime(..), ZonedTime(..), - utc, utcToLocalTime, utcToZonedTime) - -import TextShow (TextShow(showb), Builder, FromStringShow(..), - fromString, lengthB, showbSpace, singleton) -import TextShow.Data.Fixed (showbFixed) -import TextShow.Data.Integral () - -#if MIN_VERSION_time(1,5,0) -import Data.Time.Format (TimeLocale) - -import TextShow (showbPrec) -import TextShow.TH (deriveTextShow) -#endif - -#include "inline.h" - --- | Convert a 'Day' into a 'Builder'. --- --- /Since: 2/ -showbDay :: Day -> Builder -showbDay = showbGregorian -{-# INLINE showbDay #-} - --- | Convert a 'DiffTime' into a 'Builder'. --- --- /Since: 2/ -showbDiffTime :: DiffTime -> Builder -showbDiffTime = showb . FromStringShow -{-# INLINE showbDiffTime #-} - --- | Convert a 'UTCTime' into a 'Builder'. --- --- /Since: 2/ -showbUTCTime :: UTCTime -> Builder -showbUTCTime = showb . utcToZonedTime utc -{-# INLINE showbUTCTime #-} - --- | Convert a 'NominalDiffTime' into a 'Builder'. --- --- /Since: 2/ -showbNominalDiffTime :: NominalDiffTime -> Builder -showbNominalDiffTime = showb . FromStringShow -{-# INLINE showbNominalDiffTime #-} - --- | Convert a 'AbsoluteTime' into a 'Builder'. --- --- /Since: 2/ -showbAbsoluteTime :: AbsoluteTime -> Builder -showbAbsoluteTime t = showbLocalTime (utcToLocalTime utc $ taiToUTCTime (const 0) t) - <> " TAI" -- ugly, but standard apparently -{-# INLINE showbAbsoluteTime #-} - --- | Convert a 'TimeZone' into a 'Builder'. --- --- /Since: 2/ -showbTimeZone :: TimeZone -> Builder -showbTimeZone zone@(TimeZone _ _ "") = timeZoneOffsetBuilder zone -showbTimeZone (TimeZone _ _ name) = fromString name -{-# INLINE showbTimeZone #-} - --- | Convert a 'TimeOfDay' into a 'Builder'. --- --- /Since: 2/ -showbTimeOfDay :: TimeOfDay -> Builder -showbTimeOfDay (TimeOfDay h m sec) = showb2 zeroOpt h - <> singleton ':' - <> showb2 zeroOpt m - <> singleton ':' - <> showb2Fixed zeroOpt sec -{-# INLINE showbTimeOfDay #-} - --- | Convert a 'LocalTime' into a 'Builder'. --- --- /Since: 2/ -showbLocalTime :: LocalTime -> Builder -showbLocalTime (LocalTime d t) = showbGregorian d <> showbSpace <> showb t -{-# INLINE showbLocalTime #-} - --- | Convert a 'ZonedTime' into a 'Builder'. --- --- /Since: 2/ -showbZonedTime :: ZonedTime -> Builder -showbZonedTime (ZonedTime t zone) = showb t <> showbSpace <> showb zone -{-# INLINE showbZonedTime #-} - -pad1 :: NumericPadOption -> Builder -> Builder -pad1 (Just c) b = singleton c <> b -pad1 _ b = b -{-# INLINE pad1 #-} - -padN :: Int -> Char -> Builder -> Builder -padN i _ b | i <= 0 = b -padN i c b = timesN (fromIntegral i) (singleton c) <> b -{-# INLINE padN #-} - -showb2 :: (Num t, Ord t, TextShow t) => NumericPadOption -> t -> Builder -showb2 = showbPaddedMin 2 -{-# INLINE showb2 #-} - -showb2Fixed :: NumericPadOption -> Pico -> Builder -showb2Fixed opt x | x < 10 = pad1 opt $ showbFixed True x -showb2Fixed _ x = showbFixed True x -{-# INLINE showb2Fixed #-} - -showb4 :: (Num t, Ord t, TextShow t) => NumericPadOption -> t -> Builder -showb4 = showbPaddedMin 4 -{-# INLINE showb4 #-} - -showbGregorian :: Day -> Builder -showbGregorian date = showb4 zeroOpt y - <> singleton '-' - <> showb2 zeroOpt m - <> singleton '-' - <> showb2 zeroOpt d - where - (y,m,d) = toGregorian date - -showbPaddedMin :: (Num t, Ord t, TextShow t) => Int -> NumericPadOption -> t -> Builder -showbPaddedMin _ Nothing i = showb i -showbPaddedMin pl opt i | i < 0 = singleton '-' <> showbPaddedMin pl opt (negate i) -showbPaddedMin pl (Just c) i = - let b = showb i - in padN (pl - fromIntegral (lengthB b)) c b - -showbT :: NumericPadOption -> Int -> Builder -showbT opt t = showb4 opt ((div t 60) * 100 + (mod t 60)) -{-# INLINE showbT #-} - -timeZoneOffsetBuilder' :: NumericPadOption -> TimeZone -> Builder -timeZoneOffsetBuilder' opt (TimeZone t _ _) | t < 0 = singleton '-' <> showbT opt (negate t) -timeZoneOffsetBuilder' opt (TimeZone t _ _) = singleton '+' <> showbT opt t -{-# INLINE timeZoneOffsetBuilder' #-} - -timeZoneOffsetBuilder :: TimeZone -> Builder -timeZoneOffsetBuilder = timeZoneOffsetBuilder' $ Just '0' -{-# INLINE timeZoneOffsetBuilder #-} - -zeroOpt :: NumericPadOption -zeroOpt = Just '0' -{-# INLINE zeroOpt #-} - -#if MIN_VERSION_time(1,5,0) --- | Convert a 'TimeLocale' to a 'Builder' with the given precedence. This function is --- available with @time-1.5@ or later. --- --- /Since: 2/ -showbTimeLocalePrec :: Int -> TimeLocale -> Builder -showbTimeLocalePrec = showbPrec -{-# INLINE showbTimeLocalePrec #-} -#endif - -instance TextShow Day where - showb = showbDay - INLINE_INST_FUN(showb) - -instance TextShow DiffTime where - showb = showbDiffTime - INLINE_INST_FUN(showb) - -instance TextShow UTCTime where - showb = showbUTCTime - INLINE_INST_FUN(showb) - -instance TextShow NominalDiffTime where - showb = showbNominalDiffTime - INLINE_INST_FUN(showb) - -instance TextShow AbsoluteTime where - showb = showbAbsoluteTime - INLINE_INST_FUN(showb) - -instance TextShow TimeZone where - showb = showbTimeZone - INLINE_INST_FUN(showb) - -instance TextShow TimeOfDay where - showb = showbTimeOfDay - INLINE_INST_FUN(showb) - -instance TextShow LocalTime where - showb = showbLocalTime - INLINE_INST_FUN(showb) - -instance TextShow ZonedTime where - showb = showbZonedTime - INLINE_INST_FUN(showb) - -#if MIN_VERSION_time(1,5,0) -$(deriveTextShow ''TimeLocale) -#endif +{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+#if MIN_VERSION_time(1,5,0)+{-# LANGUAGE TemplateHaskell #-}+#endif+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Data.Time+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @time@ library.++/Since: 2/+-}+module TextShow.Data.Time (+ showbDay+ , showbDiffTime+ , showbUTCTime+ , showbNominalDiffTime+ , showbAbsoluteTime+ , showbTimeZone+ , showbTimeOfDay+ , showbLocalTime+ , showbZonedTime+#if MIN_VERSION_time(1,5,0)+ , showbTimeLocalePrec+#endif+ ) where++import Data.Fixed (Pico)+import Data.Monoid.Compat+import Data.Semigroup (timesN)+import Data.Time.Calendar (Day, toGregorian)+import Data.Time.Clock (DiffTime, UTCTime, NominalDiffTime)+import Data.Time.Clock.TAI (AbsoluteTime, taiToUTCTime)+import Data.Time.Format (NumericPadOption)+import Data.Time.LocalTime (TimeZone(..), TimeOfDay(..), LocalTime(..), ZonedTime(..),+ utc, utcToLocalTime, utcToZonedTime)++import TextShow (TextShow(showb), Builder, FromStringShow(..),+ fromString, lengthB, showbSpace, singleton)+import TextShow.Data.Fixed (showbFixed)+import TextShow.Data.Integral ()++#if MIN_VERSION_time(1,5,0)+import Data.Time.Format (TimeLocale)++import TextShow (showbPrec)+import TextShow.TH (deriveTextShow)+#endif++#include "inline.h"++-- | Convert a 'Day' into a 'Builder'.+--+-- /Since: 2/+showbDay :: Day -> Builder+showbDay = showbGregorian+{-# INLINE showbDay #-}++-- | Convert a 'DiffTime' into a 'Builder'.+--+-- /Since: 2/+showbDiffTime :: DiffTime -> Builder+showbDiffTime = showb . FromStringShow+{-# INLINE showbDiffTime #-}++-- | Convert a 'UTCTime' into a 'Builder'.+--+-- /Since: 2/+showbUTCTime :: UTCTime -> Builder+showbUTCTime = showb . utcToZonedTime utc+{-# INLINE showbUTCTime #-}++-- | Convert a 'NominalDiffTime' into a 'Builder'.+--+-- /Since: 2/+showbNominalDiffTime :: NominalDiffTime -> Builder+showbNominalDiffTime = showb . FromStringShow+{-# INLINE showbNominalDiffTime #-}++-- | Convert a 'AbsoluteTime' into a 'Builder'.+--+-- /Since: 2/+showbAbsoluteTime :: AbsoluteTime -> Builder+showbAbsoluteTime t = showbLocalTime (utcToLocalTime utc $ taiToUTCTime (const 0) t)+ <> " TAI" -- ugly, but standard apparently+{-# INLINE showbAbsoluteTime #-}++-- | Convert a 'TimeZone' into a 'Builder'.+--+-- /Since: 2/+showbTimeZone :: TimeZone -> Builder+showbTimeZone zone@(TimeZone _ _ "") = timeZoneOffsetBuilder zone+showbTimeZone (TimeZone _ _ name) = fromString name+{-# INLINE showbTimeZone #-}++-- | Convert a 'TimeOfDay' into a 'Builder'.+--+-- /Since: 2/+showbTimeOfDay :: TimeOfDay -> Builder+showbTimeOfDay (TimeOfDay h m sec) = showb2 zeroOpt h+ <> singleton ':'+ <> showb2 zeroOpt m+ <> singleton ':'+ <> showb2Fixed zeroOpt sec+{-# INLINE showbTimeOfDay #-}++-- | Convert a 'LocalTime' into a 'Builder'.+--+-- /Since: 2/+showbLocalTime :: LocalTime -> Builder+showbLocalTime (LocalTime d t) = showbGregorian d <> showbSpace <> showb t+{-# INLINE showbLocalTime #-}++-- | Convert a 'ZonedTime' into a 'Builder'.+--+-- /Since: 2/+showbZonedTime :: ZonedTime -> Builder+showbZonedTime (ZonedTime t zone) = showb t <> showbSpace <> showb zone+{-# INLINE showbZonedTime #-}++pad1 :: NumericPadOption -> Builder -> Builder+pad1 (Just c) b = singleton c <> b+pad1 _ b = b+{-# INLINE pad1 #-}++padN :: Int -> Char -> Builder -> Builder+padN i _ b | i <= 0 = b+padN i c b = timesN (fromIntegral i) (singleton c) <> b+{-# INLINE padN #-}++showb2 :: (Num t, Ord t, TextShow t) => NumericPadOption -> t -> Builder+showb2 = showbPaddedMin 2+{-# INLINE showb2 #-}++showb2Fixed :: NumericPadOption -> Pico -> Builder+showb2Fixed opt x | x < 10 = pad1 opt $ showbFixed True x+showb2Fixed _ x = showbFixed True x+{-# INLINE showb2Fixed #-}++showb4 :: (Num t, Ord t, TextShow t) => NumericPadOption -> t -> Builder+showb4 = showbPaddedMin 4+{-# INLINE showb4 #-}++showbGregorian :: Day -> Builder+showbGregorian date = showb4 zeroOpt y+ <> singleton '-'+ <> showb2 zeroOpt m+ <> singleton '-'+ <> showb2 zeroOpt d+ where+ (y,m,d) = toGregorian date++showbPaddedMin :: (Num t, Ord t, TextShow t) => Int -> NumericPadOption -> t -> Builder+showbPaddedMin _ Nothing i = showb i+showbPaddedMin pl opt i | i < 0 = singleton '-' <> showbPaddedMin pl opt (negate i)+showbPaddedMin pl (Just c) i =+ let b = showb i+ in padN (pl - fromIntegral (lengthB b)) c b++showbT :: NumericPadOption -> Int -> Builder+showbT opt t = showb4 opt ((div t 60) * 100 + (mod t 60))+{-# INLINE showbT #-}++timeZoneOffsetBuilder' :: NumericPadOption -> TimeZone -> Builder+timeZoneOffsetBuilder' opt (TimeZone t _ _) | t < 0 = singleton '-' <> showbT opt (negate t)+timeZoneOffsetBuilder' opt (TimeZone t _ _) = singleton '+' <> showbT opt t+{-# INLINE timeZoneOffsetBuilder' #-}++timeZoneOffsetBuilder :: TimeZone -> Builder+timeZoneOffsetBuilder = timeZoneOffsetBuilder' $ Just '0'+{-# INLINE timeZoneOffsetBuilder #-}++zeroOpt :: NumericPadOption+zeroOpt = Just '0'+{-# INLINE zeroOpt #-}++#if MIN_VERSION_time(1,5,0)+-- | Convert a 'TimeLocale' to a 'Builder' with the given precedence. This function is+-- available with @time-1.5@ or later.+--+-- /Since: 2/+showbTimeLocalePrec :: Int -> TimeLocale -> Builder+showbTimeLocalePrec = showbPrec+{-# INLINE showbTimeLocalePrec #-}+#endif++instance TextShow Day where+ showb = showbDay+ INLINE_INST_FUN(showb)++instance TextShow DiffTime where+ showb = showbDiffTime+ INLINE_INST_FUN(showb)++instance TextShow UTCTime where+ showb = showbUTCTime+ INLINE_INST_FUN(showb)++instance TextShow NominalDiffTime where+ showb = showbNominalDiffTime+ INLINE_INST_FUN(showb)++instance TextShow AbsoluteTime where+ showb = showbAbsoluteTime+ INLINE_INST_FUN(showb)++instance TextShow TimeZone where+ showb = showbTimeZone+ INLINE_INST_FUN(showb)++instance TextShow TimeOfDay where+ showb = showbTimeOfDay+ INLINE_INST_FUN(showb)++instance TextShow LocalTime where+ showb = showbLocalTime+ INLINE_INST_FUN(showb)++instance TextShow ZonedTime where+ showb = showbZonedTime+ INLINE_INST_FUN(showb)++#if MIN_VERSION_time(1,5,0)+$(deriveTextShow ''TimeLocale)+#endif
src/TextShow/Data/UnorderedContainers.hs view
@@ -1,74 +1,74 @@-{-# LANGUAGE CPP #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Data.UnorderedContainers -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for 'HashMap's and 'HashSet's. - -/Since: 2/ --} -module TextShow.Data.UnorderedContainers ( - showbHashMapPrecWith2 - , showbHashSetPrec - , showbHashSetPrecWith - ) where - -import qualified Data.HashMap.Lazy as HM (toList) -import Data.HashMap.Lazy (HashMap) -import qualified Data.HashSet as HS (toList) -import Data.HashSet (HashSet) - -import TextShow (TextShow(showbPrec), TextShow1(..), TextShow2(..), - Builder, showbPrec1) -import TextShow.Data.Tuple (showb2TupleWith2) -import TextShow.Utils (showbUnaryList, showbUnaryListWith) - -#include "inline.h" - --- | Convert a 'HashMap' to a 'Builder' with the given show functions and precedence. --- --- /Since: 2/ -showbHashMapPrecWith2 :: (k -> Builder) -> (v -> Builder) - -> Int -> HashMap k v -> Builder -showbHashMapPrecWith2 sp1 sp2 p = - showbUnaryListWith (showb2TupleWith2 sp1 sp2) p . HM.toList -{-# INLINE showbHashMapPrecWith2 #-} - --- | Convert a 'HashSet' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbHashSetPrec :: TextShow a => Int -> HashSet a -> Builder -showbHashSetPrec p = showbUnaryList p . HS.toList -{-# INLINE showbHashSetPrec #-} - --- | Convert a 'HashSet' to a 'Builder' with the given show function and precedence. --- --- /Since: 2/ -showbHashSetPrecWith :: (a -> Builder) -> Int -> HashSet a -> Builder -showbHashSetPrecWith sp p = showbUnaryListWith sp p . HS.toList -{-# INLINE showbHashSetPrecWith #-} - -instance (TextShow k, TextShow v) => TextShow (HashMap k v) where - showbPrec = showbPrec1 - INLINE_INST_FUN(showbPrec) - -instance TextShow k => TextShow1 (HashMap k) where - showbPrecWith = showbPrecWith2 showbPrec - INLINE_INST_FUN(showbPrecWith) - -instance TextShow2 HashMap where - showbPrecWith2 sp1 sp2 = showbHashMapPrecWith2 (sp1 0) (sp2 0) - INLINE_INST_FUN(showbPrecWith2) - -instance TextShow a => TextShow (HashSet a) where - showbPrec = showbHashSetPrec - INLINE_INST_FUN(showbPrec) - -instance TextShow1 HashSet where - showbPrecWith sp = showbHashSetPrecWith $ sp 0 - INLINE_INST_FUN(showbPrecWith) +{-# LANGUAGE CPP #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Data.UnorderedContainers+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for 'HashMap's and 'HashSet's.++/Since: 2/+-}+module TextShow.Data.UnorderedContainers (+ showbHashMapPrecWith2+ , showbHashSetPrec+ , showbHashSetPrecWith+ ) where++import qualified Data.HashMap.Lazy as HM (toList)+import Data.HashMap.Lazy (HashMap)+import qualified Data.HashSet as HS (toList)+import Data.HashSet (HashSet)++import TextShow (TextShow(showbPrec), TextShow1(..), TextShow2(..),+ Builder, showbPrec1)+import TextShow.Data.Tuple (showb2TupleWith2)+import TextShow.Utils (showbUnaryList, showbUnaryListWith)++#include "inline.h"++-- | Convert a 'HashMap' to a 'Builder' with the given show functions and precedence.+--+-- /Since: 2/+showbHashMapPrecWith2 :: (k -> Builder) -> (v -> Builder)+ -> Int -> HashMap k v -> Builder+showbHashMapPrecWith2 sp1 sp2 p =+ showbUnaryListWith (showb2TupleWith2 sp1 sp2) p . HM.toList+{-# INLINE showbHashMapPrecWith2 #-}++-- | Convert a 'HashSet' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbHashSetPrec :: TextShow a => Int -> HashSet a -> Builder+showbHashSetPrec p = showbUnaryList p . HS.toList+{-# INLINE showbHashSetPrec #-}++-- | Convert a 'HashSet' to a 'Builder' with the given show function and precedence.+--+-- /Since: 2/+showbHashSetPrecWith :: (a -> Builder) -> Int -> HashSet a -> Builder+showbHashSetPrecWith sp p = showbUnaryListWith sp p . HS.toList+{-# INLINE showbHashSetPrecWith #-}++instance (TextShow k, TextShow v) => TextShow (HashMap k v) where+ showbPrec = showbPrec1+ INLINE_INST_FUN(showbPrec)++instance TextShow k => TextShow1 (HashMap k) where+ showbPrecWith = showbPrecWith2 showbPrec+ INLINE_INST_FUN(showbPrecWith)++instance TextShow2 HashMap where+ showbPrecWith2 sp1 sp2 = showbHashMapPrecWith2 (sp1 0) (sp2 0)+ INLINE_INST_FUN(showbPrecWith2)++instance TextShow a => TextShow (HashSet a) where+ showbPrec = showbHashSetPrec+ INLINE_INST_FUN(showbPrec)++instance TextShow1 HashSet where+ showbPrecWith sp = showbHashSetPrecWith $ sp 0+ INLINE_INST_FUN(showbPrecWith)
src/TextShow/Data/Vector.hs view
@@ -1,123 +1,144 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Data.Vector -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for @Vector@ types. - -/Since: 2/ --} -module TextShow.Data.Vector ( - showbVectorPrec - , showbVectorPrecWith - , showbVectorGenericPrec - , showbVectorGenericPrecWith - , showbVectorPrimitivePrec - , showbVectorStorablePrec - , showbVectorUnboxedPrec - , showbSizePrec - ) where - -import qualified Data.Vector as B (Vector) -import Data.Vector.Fusion.Stream.Size (Size) -import qualified Data.Vector.Generic as G (Vector) -import Data.Vector.Generic (toList) -import qualified Data.Vector.Primitive as P (Vector) -import Data.Vector.Primitive (Prim) -import qualified Data.Vector.Storable as S (Vector) -import qualified Data.Vector.Unboxed as U (Vector) -import Data.Vector.Unboxed (Unbox) - -import Foreign.Storable (Storable) - -import TextShow (TextShow(showbPrec), TextShow1(..), Builder) -import TextShow.TH (deriveTextShow) -import TextShow.Utils (showbUnaryList, showbUnaryListWith) - -#include "inline.h" - --- | Convert a boxed 'B.Vector' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbVectorPrec :: TextShow a => Int -> B.Vector a -> Builder -showbVectorPrec = showbVectorGenericPrec -{-# INLINE showbVectorPrec #-} - --- | Convert a boxed 'B.Vector' to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbVectorPrecWith :: (a -> Builder) -> Int -> B.Vector a -> Builder -showbVectorPrecWith = showbVectorGenericPrecWith -{-# INLINE showbVectorPrecWith #-} - --- | Convert a generic 'G.Vector' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbVectorGenericPrec :: (G.Vector v a, TextShow a) => Int -> v a -> Builder -showbVectorGenericPrec p = showbUnaryList p . toList -{-# INLINE showbVectorGenericPrec #-} - --- | Convert a generic 'G.Vector' to a 'Builder' with the given show function --- and precedence. --- --- /Since: 2/ -showbVectorGenericPrecWith :: G.Vector v a => (a -> Builder) -> Int -> v a -> Builder -showbVectorGenericPrecWith sp p = showbUnaryListWith sp p . toList -{-# INLINE showbVectorGenericPrecWith #-} - --- | Convert a primitive 'P.Vector' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbVectorPrimitivePrec :: (TextShow a, Prim a) => Int -> P.Vector a -> Builder -showbVectorPrimitivePrec = showbVectorGenericPrec -{-# INLINE showbVectorPrimitivePrec #-} - --- | Convert a storable 'S.Vector' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbVectorStorablePrec :: (TextShow a, Storable a) => Int -> S.Vector a -> Builder -showbVectorStorablePrec = showbVectorGenericPrec -{-# INLINE showbVectorStorablePrec #-} - --- | Convert an unboxed 'U.Vector' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbVectorUnboxedPrec :: (TextShow a, Unbox a) => Int -> U.Vector a -> Builder -showbVectorUnboxedPrec = showbVectorGenericPrec -{-# INLINE showbVectorUnboxedPrec #-} - --- | Convert a 'Size' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbSizePrec :: Int -> Size -> Builder -showbSizePrec = showbPrec -{-# INLINE showbSizePrec #-} - -instance TextShow a => TextShow (B.Vector a) where - showbPrec = showbVectorPrec - INLINE_INST_FUN(showbPrec) - -instance TextShow1 B.Vector where - showbPrecWith sp = showbVectorPrecWith $ sp 0 - INLINE_INST_FUN(showbPrecWith) - -instance (TextShow a, Prim a) => TextShow (P.Vector a) where - showbPrec = showbVectorPrimitivePrec - INLINE_INST_FUN(showbPrec) - -instance (TextShow a, Storable a) => TextShow (S.Vector a) where - showbPrec = showbVectorStorablePrec - INLINE_INST_FUN(showbPrec) - -instance (TextShow a, Unbox a) => TextShow (U.Vector a) where - showbPrec = showbVectorUnboxedPrec - INLINE_INST_FUN(showbPrec) - -$(deriveTextShow ''Size) +{-# LANGUAGE CPP #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Data.Vector+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for @Vector@ types.++/Since: 2/+-}+module TextShow.Data.Vector (+ showbVectorPrec+ , showbVectorPrecWith+ , showbVectorGenericPrec+ , showbVectorGenericPrecWith+ , showbVectorPrimitivePrec+ , showbVectorStorablePrec+ , showbVectorUnboxedPrec+ , showbSizePrec+ ) where++import qualified Data.Vector as B (Vector)+#if MIN_VERSION_vector(0,11,0)+import Data.Vector.Fusion.Bundle.Size (Size)+#else+import Data.Vector.Fusion.Stream.Size (Size)+#endif+import qualified Data.Vector.Generic as G (Vector)+import Data.Vector.Generic (toList)+import qualified Data.Vector.Primitive as P (Vector)+import Data.Vector.Primitive (Prim)+import qualified Data.Vector.Storable as S (Vector)+import qualified Data.Vector.Unboxed as U (Vector)+import Data.Vector.Unboxed (Unbox)++import Foreign.Storable (Storable)++import TextShow (TextShow(..), TextShow1(..), Builder)+import TextShow.TH (deriveTextShow)+#if !(MIN_VERSION_vector(0,11,0))+import TextShow.Utils (showbUnaryList, showbUnaryListWith)+#endif++#include "inline.h"++-- | Convert a boxed 'B.Vector' to a 'Builder' with the given precedence.+-- Note that with @vector-0.11@ and above, the precedence argument is ignored.+--+-- /Since: 2/+showbVectorPrec :: TextShow a => Int -> B.Vector a -> Builder+showbVectorPrec = showbVectorGenericPrec+{-# INLINE showbVectorPrec #-}++-- | Convert a boxed 'B.Vector' to a 'Builder' with the given show function+-- and precedence.+-- Note that with @vector-0.11@ and above, the precedence argument is ignored.+--+-- /Since: 2/+showbVectorPrecWith :: (a -> Builder) -> Int -> B.Vector a -> Builder+showbVectorPrecWith = showbVectorGenericPrecWith+{-# INLINE showbVectorPrecWith #-}++-- | Convert a generic 'G.Vector' to a 'Builder' with the given precedence.+-- Note that with @vector-0.11@ and above, the precedence argument is ignored.+--+-- /Since: 2/+showbVectorGenericPrec :: (G.Vector v a, TextShow a) => Int -> v a -> Builder+#if MIN_VERSION_vector(0,11,0)+showbVectorGenericPrec _ = showb . toList+#else+showbVectorGenericPrec p = showbUnaryList p . toList+#endif+{-# INLINE showbVectorGenericPrec #-}++-- | Convert a generic 'G.Vector' to a 'Builder' with the given show function+-- and precedence.+-- Note that with @vector-0.11@ and above, the precedence argument is ignored.+--+-- /Since: 2/+showbVectorGenericPrecWith :: G.Vector v a => (a -> Builder) -> Int -> v a -> Builder+#if MIN_VERSION_vector(0,11,0)+showbVectorGenericPrecWith sp p = showbPrecWith (const sp) p . toList+#else+showbVectorGenericPrecWith sp p = showbUnaryListWith sp p . toList+#endif+{-# INLINE showbVectorGenericPrecWith #-}++-- | Convert a primitive 'P.Vector' to a 'Builder' with the given precedence.+-- Note that with @vector-0.11@ and above, the precedence argument is ignored.+--+-- /Since: 2/+showbVectorPrimitivePrec :: (TextShow a, Prim a) => Int -> P.Vector a -> Builder+showbVectorPrimitivePrec = showbVectorGenericPrec+{-# INLINE showbVectorPrimitivePrec #-}++-- | Convert a storable 'S.Vector' to a 'Builder' with the given precedence.+-- Note that with @vector-0.11@ and above, the precedence argument is ignored.+--+-- /Since: 2/+showbVectorStorablePrec :: (TextShow a, Storable a) => Int -> S.Vector a -> Builder+showbVectorStorablePrec = showbVectorGenericPrec+{-# INLINE showbVectorStorablePrec #-}++-- | Convert an unboxed 'U.Vector' to a 'Builder' with the given precedence.+-- Note that with @vector-0.11@ and above, the precedence argument is ignored.+--+-- /Since: 2/+showbVectorUnboxedPrec :: (TextShow a, Unbox a) => Int -> U.Vector a -> Builder+showbVectorUnboxedPrec = showbVectorGenericPrec+{-# INLINE showbVectorUnboxedPrec #-}++-- | Convert a 'Size' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbSizePrec :: Int -> Size -> Builder+showbSizePrec = showbPrec+{-# INLINE showbSizePrec #-}++instance TextShow a => TextShow (B.Vector a) where+ showbPrec = showbVectorPrec+ INLINE_INST_FUN(showbPrec)++instance TextShow1 B.Vector where+ showbPrecWith sp = showbVectorPrecWith $ sp 0+ INLINE_INST_FUN(showbPrecWith)++instance (TextShow a, Prim a) => TextShow (P.Vector a) where+ showbPrec = showbVectorPrimitivePrec+ INLINE_INST_FUN(showbPrec)++instance (TextShow a, Storable a) => TextShow (S.Vector a) where+ showbPrec = showbVectorStorablePrec+ INLINE_INST_FUN(showbPrec)++instance (TextShow a, Unbox a) => TextShow (U.Vector a) where+ showbPrec = showbVectorUnboxedPrec+ INLINE_INST_FUN(showbPrec)++$(deriveTextShow ''Size)
src/TextShow/Instances.hs view
@@ -1,44 +1,44 @@-{-| -Module: TextShow.Instances -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Additional 'TextShow', 'TextShow1', and 'TextShow2' instances not provided -by @text-show@. - -/Since: 2/ --} -module TextShow.Instances () where - -import TextShow.Compiler.Hoopl () - -import TextShow.Control.Applicative.Trans () -import TextShow.Control.Monad.Trans () - -import TextShow.Data.Bifunctor () -import TextShow.Data.Binary () -import TextShow.Data.Containers () -import TextShow.Data.Functor.Trans () -import TextShow.Data.List.NonEmpty () -import TextShow.Data.Semigroup () -import TextShow.Data.Tagged () -import TextShow.Data.Time () -import TextShow.Data.UnorderedContainers () -import TextShow.Data.Vector () - -import TextShow.Language.Haskell.TH () - -import TextShow.System.Console.Haskeline () -import TextShow.System.Console.Terminfo () -import TextShow.System.Locale () -import TextShow.System.Posix () -import TextShow.System.Random () -import TextShow.System.Time () -import TextShow.System.Win32 () - -import TextShow.Text.PrettyPrint () - -import TextShow.Trace.Hpc () +{-|+Module: TextShow.Instances+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Additional 'TextShow', 'TextShow1', and 'TextShow2' instances not provided+by @text-show@.++/Since: 2/+-}+module TextShow.Instances () where++import TextShow.Compiler.Hoopl ()++import TextShow.Control.Applicative.Trans ()+import TextShow.Control.Monad.Trans ()++import TextShow.Data.Bifunctor ()+import TextShow.Data.Binary ()+import TextShow.Data.Containers ()+import TextShow.Data.Functor.Trans ()+import TextShow.Data.List.NonEmpty ()+import TextShow.Data.Semigroup ()+import TextShow.Data.Tagged ()+import TextShow.Data.Time ()+import TextShow.Data.UnorderedContainers ()+import TextShow.Data.Vector ()++import TextShow.Language.Haskell.TH ()++import TextShow.System.Console.Haskeline ()+import TextShow.System.Console.Terminfo ()+import TextShow.System.Locale ()+import TextShow.System.Posix ()+import TextShow.System.Random ()+import TextShow.System.Time ()+import TextShow.System.Win32 ()++import TextShow.Text.PrettyPrint ()++import TextShow.Trace.Hpc ()
src/TextShow/Language/Haskell/TH.hs view
@@ -1,515 +1,515 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE TypeSynonymInstances #-} -#if !(MIN_VERSION_template_haskell(2,10,0)) -{-# LANGUAGE MagicHash #-} -#endif -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Language.Haskell.TH -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @template-haskell@ library. - -/Since: 2/ --} -module TextShow.Language.Haskell.TH ( -#if MIN_VERSION_template_haskell(2,9,0) - showbAnnLookupPrec - , showbAnnTargetPrec, -#endif - showbBodyPrec - , showbCallconv -#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0)) - , showbClassInstancePrec -#endif - , showbClausePrec - , showbConPrec - , showbDecPrec - , showbExpPrec - , showbFamFlavour - , showbFixityPrec - , showbFixityDirection - , showbForeignPrec - , showbFunDepPrec - , showbGuardPrec - , showbInfoPrec -#if MIN_VERSION_template_haskell(2,8,0) - , showbInline -#else - , showbInlineSpecPrec -#endif - , showbKindPrec - , showbLitPrec - , showbLocPrec - , showbMatchPrec - , showbModNamePrec -#if MIN_VERSION_template_haskell(2,9,0) - , showbModulePrec - , showbModuleInfoPrec -#endif - , showbName - , showbName' - , showbOccNamePrec - , showbPatPrec -#if MIN_VERSION_template_haskell(2,8,0) - , showbPhasesPrec -#endif - , showbPkgNamePrec - , showbPragmaPrec - , showbPredPrec - , showbRangePrec -#if MIN_VERSION_template_haskell(2,9,0) - , showbRole -#endif -#if MIN_VERSION_template_haskell(2,8,0) - , showbRuleBndrPrec - , showbRuleMatch -#endif - , showbSafety - , showbStmtPrec - , showbStrict -#if MIN_VERSION_template_haskell(2,8,0) - , showbTyLitPrec -#endif - , showbTypePrec - , showbTyVarBndrPrec -#if MIN_VERSION_template_haskell(2,9,0) - , showbTySynEqnPrec -#endif - , showbDoc - ) where - -import Data.Char (isAlpha) -import Data.Maybe (fromJust) -import Data.Monoid.Compat -import qualified Data.Text.Lazy as TL (Text, dropWhile, null, tail) -import Data.Text.Lazy (uncons) - -#if !(MIN_VERSION_template_haskell(2,10,0)) -import GHC.Exts (Int(I#)) -#endif - -import Language.Haskell.TH.PprLib (Doc, to_HPJ_Doc) -import Language.Haskell.TH.Syntax - -import TextShow (TextShow(showb, showbPrec), Builder, - fromString, singleton, toLazyText) -import TextShow.Data.Integral (showbIntPrec) -import TextShow.Text.PrettyPrint (renderB) -import TextShow.TH (deriveTextShow) - --- | Convert a 'Body' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbBodyPrec :: Int -> Body -> Builder -showbBodyPrec = showbPrec - --- | Convert a 'Callconv' to a 'Builder'. --- --- /Since: 2/ -showbCallconv :: Callconv -> Builder -showbCallconv = showb - --- | Convert a 'Clause' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbClausePrec :: Int -> Clause -> Builder -showbClausePrec = showbPrec - --- | Convert a 'Con' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbConPrec :: Int -> Con -> Builder -showbConPrec = showbPrec - --- | Convert a 'Dec' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbDecPrec :: Int -> Dec -> Builder -showbDecPrec = showbPrec - --- | Convert an 'Exp' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbExpPrec :: Int -> Exp -> Builder -showbExpPrec = showbPrec - --- | Convert a 'FamFlavour' to a 'Builder'. --- --- /Since: 2/ -showbFamFlavour :: FamFlavour -> Builder -showbFamFlavour = showb - --- | Convert a 'Fixity' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbFixityPrec :: Int -> Fixity -> Builder -showbFixityPrec = showbPrec - --- | Convert a 'FixityDirection' to a 'Builder'. --- --- /Since: 2/ -showbFixityDirection :: FixityDirection -> Builder -showbFixityDirection = showb - --- | Convert a 'Foreign' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbForeignPrec :: Int -> Foreign -> Builder -showbForeignPrec = showbPrec - --- | Convert a 'FunDep' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbFunDepPrec :: Int -> FunDep -> Builder -showbFunDepPrec = showbPrec - --- | Convert a 'Guard' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbGuardPrec :: Int -> Guard -> Builder -showbGuardPrec = showbPrec - --- | Convert an 'Info' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbInfoPrec :: Int -> Info -> Builder -showbInfoPrec = showbPrec - --- | Convert a 'Kind' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbKindPrec :: Int -> Kind -> Builder -#if MIN_VERSION_template_haskell(2,8,0) -showbKindPrec = showbTypePrec -#else -showbKindPrec = showbPrec -#endif - --- | Convert a 'Lit' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbLitPrec :: Int -> Dec -> Builder -showbLitPrec = showbPrec - --- | Convert a 'Loc' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbLocPrec :: Int -> Loc -> Builder -showbLocPrec = showbPrec - --- | Convert a 'Match' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbMatchPrec :: Int -> Match -> Builder -showbMatchPrec = showbPrec - --- | Convert a 'ModName' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbModNamePrec :: Int -> ModName -> Builder -showbModNamePrec = showbPrec - --- | Convert a 'Name' to a 'Builder'. --- --- /Since: 2/ -showbName :: Name -> Builder -showbName = showbName' Alone - --- | Convert a 'Name' to a 'Builder' with the given 'NameIs' settings. --- --- /Since: 2/ -showbName' :: NameIs -> Name -> Builder -showbName' ni nm = case ni of - Alone -> nms - Applied - | pnam -> nms - | otherwise -> singleton '(' <> nms <> singleton ')' - Infix - | pnam -> singleton '`' <> nms <> singleton '`' - | otherwise -> nms - where - -- For now, we make the NameQ and NameG print the same, even though - -- NameQ is a qualified name (so what it means depends on what the - -- current scope is), and NameG is an original name (so its meaning - -- should be independent of what's in scope. - -- We may well want to distinguish them in the end. - -- Ditto NameU and NameL - nms :: Builder - nms = case nm of - Name occ NameS -> occB occ - Name occ (NameQ m) -> modB m <> singleton '.' <> occB occ - Name occ (NameG _ _ m) -> modB m <> singleton '.' <> occB occ - Name occ (NameU u) -> occB occ <> singleton '_' <> showbIntPrec 0 (mkInt u) - Name occ (NameL u) -> occB occ <> singleton '_' <> showbIntPrec 0 (mkInt u) - -#if MIN_VERSION_template_haskell(2,10,0) - mkInt = id -#else - mkInt i# = I# i# -#endif - - occB :: OccName -> Builder - occB = fromString . occString - - modB :: ModName -> Builder - modB = fromString . modString - - pnam :: Bool - pnam = classify $ toLazyText nms - - -- True if we are function style, e.g. f, [], (,) - -- False if we are operator style, e.g. +, :+ - classify :: TL.Text -> Bool - classify t - | TL.null t = False -- shouldn't happen; . operator is handled below - | otherwise = case fromJust $ uncons t of - (x, xs) -> if isAlpha x || (x `elem` "_[]()") - then let t' = TL.dropWhile (/= '.') xs - in if TL.null t' - then True - else classify $ TL.tail t' - else False - - --- | Convert an 'OccName' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbOccNamePrec :: Int -> OccName -> Builder -showbOccNamePrec = showbPrec - --- | Convert a 'Pat' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbPatPrec :: Int -> Pat -> Builder -showbPatPrec = showbPrec - --- | Convert a 'PkgName' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbPkgNamePrec :: Int -> PkgName -> Builder -showbPkgNamePrec = showbPrec - --- | Convert a 'Pragma' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbPragmaPrec :: Int -> Pragma -> Builder -showbPragmaPrec = showbPrec - --- | Convert a 'Pred' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbPredPrec :: Int -> Pred -> Builder -#if MIN_VERSION_template_haskell(2,10,0) -showbPredPrec = showbTypePrec -#else -showbPredPrec = showbPrec -#endif - --- | Convert a 'Range' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbRangePrec :: Int -> Range -> Builder -showbRangePrec = showbPrec - --- | Convert a 'Safety' to a 'Builder'. --- --- /Since: 2/ -showbSafety :: Safety -> Builder -showbSafety = showb - --- | Convert a 'Stmt' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbStmtPrec :: Int -> Stmt -> Builder -showbStmtPrec = showbPrec - --- | Convert a 'Strict' to a 'Builder'. --- --- /Since: 2/ -showbStrict :: Strict -> Builder -showbStrict = showb - --- | Convert a 'Type' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbTypePrec :: Int -> Type -> Builder -showbTypePrec = showbPrec - --- | Convert a 'TyVarBndr' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbTyVarBndrPrec :: Int -> TyVarBndr -> Builder -showbTyVarBndrPrec = showbPrec - --- | Convert a 'Doc' to a 'Builder'. --- --- /Since: 2/ -showbDoc :: Doc -> Builder -showbDoc = renderB . to_HPJ_Doc - -#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0)) --- | Convert a 'ClassInstance' to a 'Builder' with the given precedence. --- This function is only available with @template-haskell@ 2.5.0.0 or 2.6.0.0. --- --- /Since: 2/ -showbClassInstancePrec :: Int -> ClassInstance -> Builder -showbClassInstancePrec = showbPrec -#endif - -#if MIN_VERSION_template_haskell(2,8,0) --- | Convert an 'Inline' to a 'Builder'. --- This function is only available with @template-haskell-2.8.0.0@ or later. --- --- /Since: 2/ -showbInline :: Inline -> Builder -showbInline = showb - --- | Convert a 'Phases' to a 'Builder' with the given precedence. --- This function is only available with @template-haskell-2.8.0.0@ or later. --- --- /Since: 2/ -showbPhasesPrec :: Int -> Phases -> Builder -showbPhasesPrec = showbPrec - --- | Convert a 'RuleMatch' to a 'Builder'. --- This function is only available with @template-haskell-2.8.0.0@ or later. --- --- /Since: 2/ -showbRuleMatch :: RuleMatch -> Builder -showbRuleMatch = showb - --- | Convert a 'RuleBndr' to a 'Builder' with the given precedence. --- This function is only available with @template-haskell-2.8.0.0@ or later. --- --- /Since: 2/ -showbRuleBndrPrec :: Int -> RuleBndr -> Builder -showbRuleBndrPrec = showbPrec - --- | Convert a 'TyLit' to a 'Builder' with the given precedence. --- This function is only available with @template-haskell-2.8.0.0@ or later. --- --- /Since: 2/ -showbTyLitPrec :: Int -> TyLit -> Builder -showbTyLitPrec = showbPrec -#else --- | Convert an 'InlineSpec' to a 'Builder' with the given precedence. --- This function is only available with @template-haskell-2.7.0.0@ or earlier. --- --- /Since: 2/ -showbInlineSpecPrec :: Int -> InlineSpec -> Builder -showbInlineSpecPrec = showbPrec -#endif - -#if MIN_VERSION_template_haskell(2,9,0) --- | Convert an 'AnnLookup' to a 'Builder' with the given precedence. --- This function is only available with @template-haskell-2.9.0.0@ or later. --- --- /Since: 2/ -showbAnnLookupPrec :: Int -> AnnLookup -> Builder -showbAnnLookupPrec = showbPrec - --- | Convert an 'AnnTarget' to a 'Builder' with the given precedence. --- This function is only available with @template-haskell-2.9.0.0@ or later. --- --- /Since: 2/ -showbAnnTargetPrec :: Int -> AnnTarget -> Builder -showbAnnTargetPrec = showbPrec - --- | Convert a 'Module' to a 'Builder' with the given precedence. --- This function is only available with @template-haskell-2.9.0.0@ or later. --- --- /Since: 2/ -showbModulePrec :: Int -> Module -> Builder -showbModulePrec = showbPrec - --- | Convert a 'ModuleInfo' to a 'Builder' with the given precedence. --- This function is only available with @template-haskell-2.9.0.0@ or later. --- --- /Since: 2/ -showbModuleInfoPrec :: Int -> ModuleInfo -> Builder -showbModuleInfoPrec = showbPrec - --- | Convert a 'Role' to a 'Builder'. --- This function is only available with @template-haskell-2.9.0.0@ or later. --- --- /Since: 2/ -showbRole :: Role -> Builder -showbRole = showb - --- | Convert a 'TySynEqn' to a 'Builder' with the given precedence. --- This function is only available with @template-haskell-2.9.0.0@ or later. --- --- /Since: 2/ -showbTySynEqnPrec :: Int -> TySynEqn -> Builder -showbTySynEqnPrec = showbPrec -#endif - -$(deriveTextShow ''Body) -$(deriveTextShow ''Callconv) -$(deriveTextShow ''Clause) -$(deriveTextShow ''Con) -$(deriveTextShow ''Dec) -$(deriveTextShow ''Exp) -$(deriveTextShow ''FamFlavour) -$(deriveTextShow ''Fixity) -$(deriveTextShow ''FixityDirection) -$(deriveTextShow ''Foreign) -$(deriveTextShow ''FunDep) -$(deriveTextShow ''Guard) -$(deriveTextShow ''Info) -$(deriveTextShow ''Lit) -$(deriveTextShow ''Loc) -$(deriveTextShow ''Match) -$(deriveTextShow ''ModName) - -instance TextShow Name where - showb = showbName - -$(deriveTextShow ''OccName) -$(deriveTextShow ''Pat) -$(deriveTextShow ''PkgName) -$(deriveTextShow ''Pragma) -$(deriveTextShow ''Range) -$(deriveTextShow ''Safety) -$(deriveTextShow ''Stmt) -$(deriveTextShow ''Strict) -$(deriveTextShow ''Type) -$(deriveTextShow ''TyVarBndr) - -instance TextShow Doc where - showb = showbDoc - -#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0)) -$(deriveTextShow ''ClassInstance) -#endif - -#if MIN_VERSION_template_haskell(2,8,0) -$(deriveTextShow ''Inline) -$(deriveTextShow ''Phases) -$(deriveTextShow ''RuleBndr) -$(deriveTextShow ''RuleMatch) -$(deriveTextShow ''TyLit) -#else -$(deriveTextShow ''InlineSpec) -$(deriveTextShow ''Kind) -#endif - -#if MIN_VERSION_template_haskell(2,9,0) -$(deriveTextShow ''AnnLookup) -$(deriveTextShow ''AnnTarget) -$(deriveTextShow ''Module) -$(deriveTextShow ''ModuleInfo) -$(deriveTextShow ''Role) -$(deriveTextShow ''TySynEqn) -#endif - -#if !(MIN_VERSION_template_haskell(2,10,0)) -$(deriveTextShow ''Pred) -#endif +{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeSynonymInstances #-}+#if !(MIN_VERSION_template_haskell(2,10,0))+{-# LANGUAGE MagicHash #-}+#endif+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Language.Haskell.TH+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @template-haskell@ library.++/Since: 2/+-}+module TextShow.Language.Haskell.TH (+#if MIN_VERSION_template_haskell(2,9,0)+ showbAnnLookupPrec+ , showbAnnTargetPrec,+#endif+ showbBodyPrec+ , showbCallconv+#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0))+ , showbClassInstancePrec+#endif+ , showbClausePrec+ , showbConPrec+ , showbDecPrec+ , showbExpPrec+ , showbFamFlavour+ , showbFixityPrec+ , showbFixityDirection+ , showbForeignPrec+ , showbFunDepPrec+ , showbGuardPrec+ , showbInfoPrec+#if MIN_VERSION_template_haskell(2,8,0)+ , showbInline+#else+ , showbInlineSpecPrec+#endif+ , showbKindPrec+ , showbLitPrec+ , showbLocPrec+ , showbMatchPrec+ , showbModNamePrec+#if MIN_VERSION_template_haskell(2,9,0)+ , showbModulePrec+ , showbModuleInfoPrec+#endif+ , showbName+ , showbName'+ , showbOccNamePrec+ , showbPatPrec+#if MIN_VERSION_template_haskell(2,8,0)+ , showbPhasesPrec+#endif+ , showbPkgNamePrec+ , showbPragmaPrec+ , showbPredPrec+ , showbRangePrec+#if MIN_VERSION_template_haskell(2,9,0)+ , showbRole+#endif+#if MIN_VERSION_template_haskell(2,8,0)+ , showbRuleBndrPrec+ , showbRuleMatch+#endif+ , showbSafety+ , showbStmtPrec+ , showbStrict+#if MIN_VERSION_template_haskell(2,8,0)+ , showbTyLitPrec+#endif+ , showbTypePrec+ , showbTyVarBndrPrec+#if MIN_VERSION_template_haskell(2,9,0)+ , showbTySynEqnPrec+#endif+ , showbDoc+ ) where++import Data.Char (isAlpha)+import Data.Maybe (fromJust)+import Data.Monoid.Compat+import qualified Data.Text.Lazy as TL (Text, dropWhile, null, tail)+import Data.Text.Lazy (uncons)++#if !(MIN_VERSION_template_haskell(2,10,0))+import GHC.Exts (Int(I#))+#endif++import Language.Haskell.TH.PprLib (Doc, to_HPJ_Doc)+import Language.Haskell.TH.Syntax++import TextShow (TextShow(showb, showbPrec), Builder,+ fromString, singleton, toLazyText)+import TextShow.Data.Integral (showbIntPrec)+import TextShow.Text.PrettyPrint (renderB)+import TextShow.TH (deriveTextShow)++-- | Convert a 'Body' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbBodyPrec :: Int -> Body -> Builder+showbBodyPrec = showbPrec++-- | Convert a 'Callconv' to a 'Builder'.+--+-- /Since: 2/+showbCallconv :: Callconv -> Builder+showbCallconv = showb++-- | Convert a 'Clause' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbClausePrec :: Int -> Clause -> Builder+showbClausePrec = showbPrec++-- | Convert a 'Con' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbConPrec :: Int -> Con -> Builder+showbConPrec = showbPrec++-- | Convert a 'Dec' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbDecPrec :: Int -> Dec -> Builder+showbDecPrec = showbPrec++-- | Convert an 'Exp' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbExpPrec :: Int -> Exp -> Builder+showbExpPrec = showbPrec++-- | Convert a 'FamFlavour' to a 'Builder'.+--+-- /Since: 2/+showbFamFlavour :: FamFlavour -> Builder+showbFamFlavour = showb++-- | Convert a 'Fixity' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbFixityPrec :: Int -> Fixity -> Builder+showbFixityPrec = showbPrec++-- | Convert a 'FixityDirection' to a 'Builder'.+--+-- /Since: 2/+showbFixityDirection :: FixityDirection -> Builder+showbFixityDirection = showb++-- | Convert a 'Foreign' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbForeignPrec :: Int -> Foreign -> Builder+showbForeignPrec = showbPrec++-- | Convert a 'FunDep' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbFunDepPrec :: Int -> FunDep -> Builder+showbFunDepPrec = showbPrec++-- | Convert a 'Guard' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbGuardPrec :: Int -> Guard -> Builder+showbGuardPrec = showbPrec++-- | Convert an 'Info' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbInfoPrec :: Int -> Info -> Builder+showbInfoPrec = showbPrec++-- | Convert a 'Kind' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbKindPrec :: Int -> Kind -> Builder+#if MIN_VERSION_template_haskell(2,8,0)+showbKindPrec = showbTypePrec+#else+showbKindPrec = showbPrec+#endif++-- | Convert a 'Lit' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbLitPrec :: Int -> Dec -> Builder+showbLitPrec = showbPrec++-- | Convert a 'Loc' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbLocPrec :: Int -> Loc -> Builder+showbLocPrec = showbPrec++-- | Convert a 'Match' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbMatchPrec :: Int -> Match -> Builder+showbMatchPrec = showbPrec++-- | Convert a 'ModName' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbModNamePrec :: Int -> ModName -> Builder+showbModNamePrec = showbPrec++-- | Convert a 'Name' to a 'Builder'.+--+-- /Since: 2/+showbName :: Name -> Builder+showbName = showbName' Alone++-- | Convert a 'Name' to a 'Builder' with the given 'NameIs' settings.+--+-- /Since: 2/+showbName' :: NameIs -> Name -> Builder+showbName' ni nm = case ni of+ Alone -> nms+ Applied+ | pnam -> nms+ | otherwise -> singleton '(' <> nms <> singleton ')'+ Infix+ | pnam -> singleton '`' <> nms <> singleton '`'+ | otherwise -> nms+ where+ -- For now, we make the NameQ and NameG print the same, even though+ -- NameQ is a qualified name (so what it means depends on what the+ -- current scope is), and NameG is an original name (so its meaning+ -- should be independent of what's in scope.+ -- We may well want to distinguish them in the end.+ -- Ditto NameU and NameL+ nms :: Builder+ nms = case nm of+ Name occ NameS -> occB occ+ Name occ (NameQ m) -> modB m <> singleton '.' <> occB occ+ Name occ (NameG _ _ m) -> modB m <> singleton '.' <> occB occ+ Name occ (NameU u) -> occB occ <> singleton '_' <> showbIntPrec 0 (mkInt u)+ Name occ (NameL u) -> occB occ <> singleton '_' <> showbIntPrec 0 (mkInt u)++#if MIN_VERSION_template_haskell(2,10,0)+ mkInt = id+#else+ mkInt i# = I# i#+#endif++ occB :: OccName -> Builder+ occB = fromString . occString++ modB :: ModName -> Builder+ modB = fromString . modString++ pnam :: Bool+ pnam = classify $ toLazyText nms++ -- True if we are function style, e.g. f, [], (,)+ -- False if we are operator style, e.g. +, :++ classify :: TL.Text -> Bool+ classify t+ | TL.null t = False -- shouldn't happen; . operator is handled below+ | otherwise = case fromJust $ uncons t of+ (x, xs) -> if isAlpha x || (x `elem` "_[]()")+ then let t' = TL.dropWhile (/= '.') xs+ in if TL.null t'+ then True+ else classify $ TL.tail t'+ else False+++-- | Convert an 'OccName' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbOccNamePrec :: Int -> OccName -> Builder+showbOccNamePrec = showbPrec++-- | Convert a 'Pat' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbPatPrec :: Int -> Pat -> Builder+showbPatPrec = showbPrec++-- | Convert a 'PkgName' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbPkgNamePrec :: Int -> PkgName -> Builder+showbPkgNamePrec = showbPrec++-- | Convert a 'Pragma' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbPragmaPrec :: Int -> Pragma -> Builder+showbPragmaPrec = showbPrec++-- | Convert a 'Pred' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbPredPrec :: Int -> Pred -> Builder+#if MIN_VERSION_template_haskell(2,10,0)+showbPredPrec = showbTypePrec+#else+showbPredPrec = showbPrec+#endif++-- | Convert a 'Range' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbRangePrec :: Int -> Range -> Builder+showbRangePrec = showbPrec++-- | Convert a 'Safety' to a 'Builder'.+--+-- /Since: 2/+showbSafety :: Safety -> Builder+showbSafety = showb++-- | Convert a 'Stmt' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbStmtPrec :: Int -> Stmt -> Builder+showbStmtPrec = showbPrec++-- | Convert a 'Strict' to a 'Builder'.+--+-- /Since: 2/+showbStrict :: Strict -> Builder+showbStrict = showb++-- | Convert a 'Type' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbTypePrec :: Int -> Type -> Builder+showbTypePrec = showbPrec++-- | Convert a 'TyVarBndr' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbTyVarBndrPrec :: Int -> TyVarBndr -> Builder+showbTyVarBndrPrec = showbPrec++-- | Convert a 'Doc' to a 'Builder'.+--+-- /Since: 2/+showbDoc :: Doc -> Builder+showbDoc = renderB . to_HPJ_Doc++#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0))+-- | Convert a 'ClassInstance' to a 'Builder' with the given precedence.+-- This function is only available with @template-haskell@ 2.5.0.0 or 2.6.0.0.+--+-- /Since: 2/+showbClassInstancePrec :: Int -> ClassInstance -> Builder+showbClassInstancePrec = showbPrec+#endif++#if MIN_VERSION_template_haskell(2,8,0)+-- | Convert an 'Inline' to a 'Builder'.+-- This function is only available with @template-haskell-2.8.0.0@ or later.+--+-- /Since: 2/+showbInline :: Inline -> Builder+showbInline = showb++-- | Convert a 'Phases' to a 'Builder' with the given precedence.+-- This function is only available with @template-haskell-2.8.0.0@ or later.+--+-- /Since: 2/+showbPhasesPrec :: Int -> Phases -> Builder+showbPhasesPrec = showbPrec++-- | Convert a 'RuleMatch' to a 'Builder'.+-- This function is only available with @template-haskell-2.8.0.0@ or later.+--+-- /Since: 2/+showbRuleMatch :: RuleMatch -> Builder+showbRuleMatch = showb++-- | Convert a 'RuleBndr' to a 'Builder' with the given precedence.+-- This function is only available with @template-haskell-2.8.0.0@ or later.+--+-- /Since: 2/+showbRuleBndrPrec :: Int -> RuleBndr -> Builder+showbRuleBndrPrec = showbPrec++-- | Convert a 'TyLit' to a 'Builder' with the given precedence.+-- This function is only available with @template-haskell-2.8.0.0@ or later.+--+-- /Since: 2/+showbTyLitPrec :: Int -> TyLit -> Builder+showbTyLitPrec = showbPrec+#else+-- | Convert an 'InlineSpec' to a 'Builder' with the given precedence.+-- This function is only available with @template-haskell-2.7.0.0@ or earlier.+--+-- /Since: 2/+showbInlineSpecPrec :: Int -> InlineSpec -> Builder+showbInlineSpecPrec = showbPrec+#endif++#if MIN_VERSION_template_haskell(2,9,0)+-- | Convert an 'AnnLookup' to a 'Builder' with the given precedence.+-- This function is only available with @template-haskell-2.9.0.0@ or later.+--+-- /Since: 2/+showbAnnLookupPrec :: Int -> AnnLookup -> Builder+showbAnnLookupPrec = showbPrec++-- | Convert an 'AnnTarget' to a 'Builder' with the given precedence.+-- This function is only available with @template-haskell-2.9.0.0@ or later.+--+-- /Since: 2/+showbAnnTargetPrec :: Int -> AnnTarget -> Builder+showbAnnTargetPrec = showbPrec++-- | Convert a 'Module' to a 'Builder' with the given precedence.+-- This function is only available with @template-haskell-2.9.0.0@ or later.+--+-- /Since: 2/+showbModulePrec :: Int -> Module -> Builder+showbModulePrec = showbPrec++-- | Convert a 'ModuleInfo' to a 'Builder' with the given precedence.+-- This function is only available with @template-haskell-2.9.0.0@ or later.+--+-- /Since: 2/+showbModuleInfoPrec :: Int -> ModuleInfo -> Builder+showbModuleInfoPrec = showbPrec++-- | Convert a 'Role' to a 'Builder'.+-- This function is only available with @template-haskell-2.9.0.0@ or later.+--+-- /Since: 2/+showbRole :: Role -> Builder+showbRole = showb++-- | Convert a 'TySynEqn' to a 'Builder' with the given precedence.+-- This function is only available with @template-haskell-2.9.0.0@ or later.+--+-- /Since: 2/+showbTySynEqnPrec :: Int -> TySynEqn -> Builder+showbTySynEqnPrec = showbPrec+#endif++$(deriveTextShow ''Body)+$(deriveTextShow ''Callconv)+$(deriveTextShow ''Clause)+$(deriveTextShow ''Con)+$(deriveTextShow ''Dec)+$(deriveTextShow ''Exp)+$(deriveTextShow ''FamFlavour)+$(deriveTextShow ''Fixity)+$(deriveTextShow ''FixityDirection)+$(deriveTextShow ''Foreign)+$(deriveTextShow ''FunDep)+$(deriveTextShow ''Guard)+$(deriveTextShow ''Info)+$(deriveTextShow ''Lit)+$(deriveTextShow ''Loc)+$(deriveTextShow ''Match)+$(deriveTextShow ''ModName)++instance TextShow Name where+ showb = showbName++$(deriveTextShow ''OccName)+$(deriveTextShow ''Pat)+$(deriveTextShow ''PkgName)+$(deriveTextShow ''Pragma)+$(deriveTextShow ''Range)+$(deriveTextShow ''Safety)+$(deriveTextShow ''Stmt)+$(deriveTextShow ''Strict)+$(deriveTextShow ''Type)+$(deriveTextShow ''TyVarBndr)++instance TextShow Doc where+ showb = showbDoc++#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0))+$(deriveTextShow ''ClassInstance)+#endif++#if MIN_VERSION_template_haskell(2,8,0)+$(deriveTextShow ''Inline)+$(deriveTextShow ''Phases)+$(deriveTextShow ''RuleBndr)+$(deriveTextShow ''RuleMatch)+$(deriveTextShow ''TyLit)+#else+$(deriveTextShow ''InlineSpec)+$(deriveTextShow ''Kind)+#endif++#if MIN_VERSION_template_haskell(2,9,0)+$(deriveTextShow ''AnnLookup)+$(deriveTextShow ''AnnTarget)+$(deriveTextShow ''Module)+$(deriveTextShow ''ModuleInfo)+$(deriveTextShow ''Role)+$(deriveTextShow ''TySynEqn)+#endif++#if !(MIN_VERSION_template_haskell(2,10,0))+$(deriveTextShow ''Pred)+#endif
src/TextShow/System/Console/Haskeline.hs view
@@ -1,72 +1,72 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.System.Console.Haskeline -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @haskeline@ library. - -/Since: 2/ --} -module TextShow.System.Console.Haskeline ( - showbInterrupt - , showbPrefsPrec - , showbCompletionPrec - , showbHistory - ) where - -import System.Console.Haskeline (Interrupt, Prefs) -import System.Console.Haskeline.Completion (Completion) -import System.Console.Haskeline.History (History, historyLines) - -import TextShow (TextShow(showb, showbPrec), Builder, FromStringShow(..)) -import TextShow.TH (deriveTextShow) -import TextShow.Utils (showbUnaryListWith) - -#include "inline.h" - --- | Convert an 'Interrupt' to a 'Builder'. --- --- /Since: 2/ -showbInterrupt :: Interrupt -> Builder -showbInterrupt = showb -{-# INLINE showbInterrupt #-} - --- | Convert a 'Prefs' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbPrefsPrec :: Int -> Prefs -> Builder -showbPrefsPrec p = showbPrec p . FromStringShow -{-# INLINE showbPrefsPrec #-} - --- | Convert a 'Completion' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbCompletionPrec :: Int -> Completion -> Builder -showbCompletionPrec = showbPrec -{-# INLINE showbCompletionPrec #-} - --- | Convert a 'History' value to a 'Builder'. --- --- /Since: 2/ -showbHistory :: History -> Builder -showbHistory = showbUnaryListWith showb 0 . historyLines -{-# INLINE showbHistory #-} - -$(deriveTextShow ''Interrupt) - -instance TextShow Prefs where - showbPrec = showbPrefsPrec - INLINE_INST_FUN(showbPrec) - -$(deriveTextShow ''Completion) - -instance TextShow History where - showb = showbHistory - INLINE_INST_FUN(showb) +{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.System.Console.Haskeline+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @haskeline@ library.++/Since: 2/+-}+module TextShow.System.Console.Haskeline (+ showbInterrupt+ , showbPrefsPrec+ , showbCompletionPrec+ , showbHistory+ ) where++import System.Console.Haskeline (Interrupt, Prefs)+import System.Console.Haskeline.Completion (Completion)+import System.Console.Haskeline.History (History, historyLines)++import TextShow (TextShow(showb, showbPrec), Builder, FromStringShow(..))+import TextShow.TH (deriveTextShow)+import TextShow.Utils (showbUnaryListWith)++#include "inline.h"++-- | Convert an 'Interrupt' to a 'Builder'.+--+-- /Since: 2/+showbInterrupt :: Interrupt -> Builder+showbInterrupt = showb+{-# INLINE showbInterrupt #-}++-- | Convert a 'Prefs' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbPrefsPrec :: Int -> Prefs -> Builder+showbPrefsPrec p = showbPrec p . FromStringShow+{-# INLINE showbPrefsPrec #-}++-- | Convert a 'Completion' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbCompletionPrec :: Int -> Completion -> Builder+showbCompletionPrec = showbPrec+{-# INLINE showbCompletionPrec #-}++-- | Convert a 'History' value to a 'Builder'.+--+-- /Since: 2/+showbHistory :: History -> Builder+showbHistory = showbUnaryListWith showb 0 . historyLines+{-# INLINE showbHistory #-}++$(deriveTextShow ''Interrupt)++instance TextShow Prefs where+ showbPrec = showbPrefsPrec+ INLINE_INST_FUN(showbPrec)++$(deriveTextShow ''Completion)++instance TextShow History where+ showb = showbHistory+ INLINE_INST_FUN(showb)
src/TextShow/System/Console/Terminfo.hs view
@@ -1,56 +1,56 @@-{-# LANGUAGE CPP #-} - -#if !defined(mingw32_HOST_OS) -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -#endif - -{-| -Module: TextShow.System.Console.Terminfo -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @terminfo@ library. This module -only exports functions if using a Unix-like operating system (i.e., not Windows). - -/Since: 2/ --} -module TextShow.System.Console.Terminfo ( -#if defined(mingw32_HOST_OS) - ) where -#else - showbColorPrec - , showbSetupTermError - ) where - -import System.Console.Terminfo.Base (SetupTermError) -import System.Console.Terminfo.Color (Color) - -import TextShow (TextShow(showb, showbPrec), Builder, FromStringShow(..)) -import TextShow.TH (deriveTextShow) - -#include "inline.h" - --- | Convert a 'Color' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbColorPrec :: Int -> Color -> Builder -showbColorPrec = showbPrec -{-# INLINE showbColorPrec #-} - --- | Convert a 'SetupTermError' to a 'Builder'. --- --- /Since: 2/ -showbSetupTermError :: SetupTermError -> Builder -showbSetupTermError = showb . FromStringShow -{-# INLINE showbSetupTermError #-} - -$(deriveTextShow ''Color) - -instance TextShow SetupTermError where - showb = showbSetupTermError - INLINE_INST_FUN(showb) -#endif +{-# LANGUAGE CPP #-}++#if !defined(mingw32_HOST_OS)+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+#endif++{-|+Module: TextShow.System.Console.Terminfo+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @terminfo@ library. This module+only exports functions if using a Unix-like operating system (i.e., not Windows).++/Since: 2/+-}+module TextShow.System.Console.Terminfo (+#if defined(mingw32_HOST_OS)+ ) where+#else+ showbColorPrec+ , showbSetupTermError+ ) where++import System.Console.Terminfo.Base (SetupTermError)+import System.Console.Terminfo.Color (Color)++import TextShow (TextShow(showb, showbPrec), Builder, FromStringShow(..))+import TextShow.TH (deriveTextShow)++#include "inline.h"++-- | Convert a 'Color' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbColorPrec :: Int -> Color -> Builder+showbColorPrec = showbPrec+{-# INLINE showbColorPrec #-}++-- | Convert a 'SetupTermError' to a 'Builder'.+--+-- /Since: 2/+showbSetupTermError :: SetupTermError -> Builder+showbSetupTermError = showb . FromStringShow+{-# INLINE showbSetupTermError #-}++$(deriveTextShow ''Color)++instance TextShow SetupTermError where+ showb = showbSetupTermError+ INLINE_INST_FUN(showb)+#endif
src/TextShow/System/Directory.hs view
@@ -1,29 +1,29 @@-{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.System.Directory -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' function for 'Permissions'. - -/Since: 2/ --} -module TextShow.System.Directory (showbPermissionsPrec) where - -import System.Directory (Permissions) - -import TextShow (TextShow(showbPrec), Builder) -import TextShow.TH (deriveTextShow) - --- | Convert 'Permissions' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbPermissionsPrec :: Int -> Permissions -> Builder -showbPermissionsPrec = showbPrec -{-# INLINE showbPermissionsPrec #-} - -$(deriveTextShow ''Permissions) +{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.System.Directory+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' function for 'Permissions'.++/Since: 2/+-}+module TextShow.System.Directory (showbPermissionsPrec) where++import System.Directory (Permissions)++import TextShow (TextShow(showbPrec), Builder)+import TextShow.TH (deriveTextShow)++-- | Convert 'Permissions' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbPermissionsPrec :: Int -> Permissions -> Builder+showbPermissionsPrec = showbPrec+{-# INLINE showbPermissionsPrec #-}++$(deriveTextShow ''Permissions)
src/TextShow/System/Locale.hs view
@@ -1,29 +1,29 @@-{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.System.Locale -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' function for old 'TimeLocale's. - -/Since: 2/ --} -module TextShow.System.Locale (showbTimeLocalePrec) where - -import System.Locale (TimeLocale) - -import TextShow (TextShow(showbPrec), Builder) -import TextShow.TH (deriveTextShow) - --- | Convert a 'TimeLocale' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbTimeLocalePrec :: Int -> TimeLocale -> Builder -showbTimeLocalePrec = showbPrec -{-# INLINE showbTimeLocalePrec #-} - -$(deriveTextShow ''TimeLocale) +{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.System.Locale+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' function for old 'TimeLocale's.++/Since: 2/+-}+module TextShow.System.Locale (showbTimeLocalePrec) where++import System.Locale (TimeLocale)++import TextShow (TextShow(showbPrec), Builder)+import TextShow.TH (deriveTextShow)++-- | Convert a 'TimeLocale' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbTimeLocalePrec :: Int -> TimeLocale -> Builder+showbTimeLocalePrec = showbPrec+{-# INLINE showbTimeLocalePrec #-}++$(deriveTextShow ''TimeLocale)
src/TextShow/System/Posix.hs view
@@ -1,79 +1,79 @@-{-# LANGUAGE CPP #-} - -#if !defined(mingw32_HOST_OS) -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -#endif - -{-| -Module: TextShow.System.Posix -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @unix@ library. This module -only exports functions if using a Unix-like operating system (i.e., not Windows). - -/Since: 2/ --} -module TextShow.System.Posix ( -#if defined(mingw32_HOST_OS) - ) where -#else - showbRTLDFlags - , showbDLPrec - , showbProcessStatusPrec - , showbGroupEntryPrec - , showbUserEntryPrec - ) where - -import System.Posix.DynamicLinker (RTLDFlags, DL) -import System.Posix.Process (ProcessStatus) -import System.Posix.User (GroupEntry, UserEntry) - -import TextShow (Builder, showb, showbPrec) -import TextShow.TH (deriveTextShow) - --- | Convert an 'RTLDFlags' value to a 'Builder'. --- --- /Since: 2/ -showbRTLDFlags :: RTLDFlags -> Builder -showbRTLDFlags = showb -{-# INLINE showbRTLDFlags #-} - --- | Convert a 'DL' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbDLPrec :: Int -> DL -> Builder -showbDLPrec = showbPrec -{-# INLINE showbDLPrec #-} - --- | Convert a 'ProcessStatus' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbProcessStatusPrec :: Int -> ProcessStatus -> Builder -showbProcessStatusPrec = showbPrec -{-# INLINE showbProcessStatusPrec #-} - --- | Convert a 'GroupEntry' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbGroupEntryPrec :: Int -> GroupEntry -> Builder -showbGroupEntryPrec = showbPrec -{-# INLINE showbGroupEntryPrec #-} - --- | Convert a 'UserEntry' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbUserEntryPrec :: Int -> UserEntry -> Builder -showbUserEntryPrec = showbPrec -{-# INLINE showbUserEntryPrec #-} - -$(deriveTextShow ''RTLDFlags) -$(deriveTextShow ''DL) -$(deriveTextShow ''ProcessStatus) -$(deriveTextShow ''GroupEntry) -$(deriveTextShow ''UserEntry) -#endif +{-# LANGUAGE CPP #-}++#if !defined(mingw32_HOST_OS)+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+#endif++{-|+Module: TextShow.System.Posix+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @unix@ library. This module+only exports functions if using a Unix-like operating system (i.e., not Windows).++/Since: 2/+-}+module TextShow.System.Posix (+#if defined(mingw32_HOST_OS)+ ) where+#else+ showbRTLDFlags+ , showbDLPrec+ , showbProcessStatusPrec+ , showbGroupEntryPrec+ , showbUserEntryPrec+ ) where++import System.Posix.DynamicLinker (RTLDFlags, DL)+import System.Posix.Process (ProcessStatus)+import System.Posix.User (GroupEntry, UserEntry)++import TextShow (Builder, showb, showbPrec)+import TextShow.TH (deriveTextShow)++-- | Convert an 'RTLDFlags' value to a 'Builder'.+--+-- /Since: 2/+showbRTLDFlags :: RTLDFlags -> Builder+showbRTLDFlags = showb+{-# INLINE showbRTLDFlags #-}++-- | Convert a 'DL' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbDLPrec :: Int -> DL -> Builder+showbDLPrec = showbPrec+{-# INLINE showbDLPrec #-}++-- | Convert a 'ProcessStatus' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbProcessStatusPrec :: Int -> ProcessStatus -> Builder+showbProcessStatusPrec = showbPrec+{-# INLINE showbProcessStatusPrec #-}++-- | Convert a 'GroupEntry' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbGroupEntryPrec :: Int -> GroupEntry -> Builder+showbGroupEntryPrec = showbPrec+{-# INLINE showbGroupEntryPrec #-}++-- | Convert a 'UserEntry' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbUserEntryPrec :: Int -> UserEntry -> Builder+showbUserEntryPrec = showbPrec+{-# INLINE showbUserEntryPrec #-}++$(deriveTextShow ''RTLDFlags)+$(deriveTextShow ''DL)+$(deriveTextShow ''ProcessStatus)+$(deriveTextShow ''GroupEntry)+$(deriveTextShow ''UserEntry)+#endif
src/TextShow/System/Random.hs view
@@ -1,31 +1,31 @@-{-# LANGUAGE CPP #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.System.Random -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' function for 'StdGen'. - -/Since: 2/ --} -module TextShow.System.Random (showbStdGenPrec) where - -import System.Random (StdGen) -import TextShow (TextShow(showbPrec), Builder, FromStringShow(..)) - -#include "inline.h" - --- | Convert a 'StdGen' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbStdGenPrec :: Int -> StdGen -> Builder -showbStdGenPrec p = showbPrec p . FromStringShow -{-# INLINE showbStdGenPrec #-} - -instance TextShow StdGen where - showbPrec = showbStdGenPrec - INLINE_INST_FUN(showbPrec) +{-# LANGUAGE CPP #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.System.Random+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' function for 'StdGen'.++/Since: 2/+-}+module TextShow.System.Random (showbStdGenPrec) where++import System.Random (StdGen)+import TextShow (TextShow(showbPrec), Builder, FromStringShow(..))++#include "inline.h"++-- | Convert a 'StdGen' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbStdGenPrec :: Int -> StdGen -> Builder+showbStdGenPrec p = showbPrec p . FromStringShow+{-# INLINE showbStdGenPrec #-}++instance TextShow StdGen where+ showbPrec = showbStdGenPrec+ INLINE_INST_FUN(showbPrec)
src/TextShow/System/Time.hs view
@@ -1,74 +1,74 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.System.Time -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @old-time@ library. - -/Since: 2/ --} -module TextShow.System.Time ( - showbClockTime - , showbTimeDiffPrec - , showbCalendarTimePrec - , showbMonth - , showbDay - ) where - -import System.IO.Unsafe (unsafePerformIO) -import System.Time (ClockTime, TimeDiff, CalendarTime, Month, Day, - calendarTimeToString, toCalendarTime) - -import TextShow (TextShow(showb, showbPrec), Builder, fromString) -import TextShow.TH (deriveTextShow) - -#include "inline.h" - --- | Convert a 'ClockTime' to a 'Builder'. --- --- /Since: 2/ -showbClockTime :: ClockTime -> Builder -showbClockTime = fromString . calendarTimeToString . unsafePerformIO . toCalendarTime - --- | Convert a 'TimeDiff' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbTimeDiffPrec :: Int -> TimeDiff -> Builder -showbTimeDiffPrec = showbPrec -{-# INLINE showbTimeDiffPrec #-} - --- | Convert a 'CalendarTime' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbCalendarTimePrec :: Int -> CalendarTime -> Builder -showbCalendarTimePrec = showbPrec -{-# INLINE showbCalendarTimePrec #-} - --- | Convert a 'Month' to a 'Builder'. --- --- /Since: 2/ -showbMonth :: Month -> Builder -showbMonth = showb -{-# INLINE showbMonth #-} - --- | Convert a 'Day' to a 'Builder'. --- --- /Since: 2/ -showbDay :: Day -> Builder -showbDay = showb -{-# INLINE showbDay #-} - -instance TextShow ClockTime where - showb = showbClockTime - INLINE_INST_FUN(showb) - -$(deriveTextShow ''TimeDiff) -$(deriveTextShow ''CalendarTime) -$(deriveTextShow ''Month) -$(deriveTextShow ''Day) +{-# LANGUAGE CPP #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.System.Time+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @old-time@ library.++/Since: 2/+-}+module TextShow.System.Time (+ showbClockTime+ , showbTimeDiffPrec+ , showbCalendarTimePrec+ , showbMonth+ , showbDay+ ) where++import System.IO.Unsafe (unsafePerformIO)+import System.Time (ClockTime, TimeDiff, CalendarTime, Month, Day,+ calendarTimeToString, toCalendarTime)++import TextShow (TextShow(showb, showbPrec), Builder, fromString)+import TextShow.TH (deriveTextShow)++#include "inline.h"++-- | Convert a 'ClockTime' to a 'Builder'.+--+-- /Since: 2/+showbClockTime :: ClockTime -> Builder+showbClockTime = fromString . calendarTimeToString . unsafePerformIO . toCalendarTime++-- | Convert a 'TimeDiff' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbTimeDiffPrec :: Int -> TimeDiff -> Builder+showbTimeDiffPrec = showbPrec+{-# INLINE showbTimeDiffPrec #-}++-- | Convert a 'CalendarTime' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbCalendarTimePrec :: Int -> CalendarTime -> Builder+showbCalendarTimePrec = showbPrec+{-# INLINE showbCalendarTimePrec #-}++-- | Convert a 'Month' to a 'Builder'.+--+-- /Since: 2/+showbMonth :: Month -> Builder+showbMonth = showb+{-# INLINE showbMonth #-}++-- | Convert a 'Day' to a 'Builder'.+--+-- /Since: 2/+showbDay :: Day -> Builder+showbDay = showb+{-# INLINE showbDay #-}++instance TextShow ClockTime where+ showb = showbClockTime+ INLINE_INST_FUN(showb)++$(deriveTextShow ''TimeDiff)+$(deriveTextShow ''CalendarTime)+$(deriveTextShow ''Month)+$(deriveTextShow ''Day)
src/TextShow/System/Win32.hs view
@@ -1,125 +1,125 @@-{-# LANGUAGE CPP #-} - -#if defined(mingw32_HOST_OS) -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -#endif - -{-| -Module: TextShow.System.Win32 -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @Win32@ library. -This module only exports functions if using Windows. - -/Since: 2/ --} -module TextShow.System.Win32 ( -#if !defined(mingw32_HOST_OS) - ) where -#else - showbDebugEventInfoPrec - , showbExceptionPrec - , showb_BY_HANDLE_FILE_INFORMATION_Prec - , showb_WIN32_FILE_ATTRIBUTE_DATA_Prec - , showbProcessorArchitecturePrec - , showb_SYSTEM_INFO_Prec - , showb_FILETIME_Prec - , showb_SYSTEMTIME_Prec - , showb_TIME_ZONE_INFORMATION_Prec - , showbTimeZoneIdPrec - ) where - -import System.Win32.DebugApi (DebugEventInfo, Exception) -import System.Win32.File (BY_HANDLE_FILE_INFORMATION, WIN32_FILE_ATTRIBUTE_DATA) -import System.Win32.Info (ProcessorArchitecture, SYSTEM_INFO) -import System.Win32.Time (FILETIME, SYSTEMTIME, TIME_ZONE_INFORMATION, TimeZoneId) - -import TextShow (Builder, showb, showbPrec) -import TextShow.TH (deriveTextShow) - --- | Convert a 'DebugEventInfo' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbDebugEventInfoPrec :: Int -> DebugEventInfo -> Builder -showbDebugEventInfoPrec = showbPrec -{-# INLINE showbDebugEventInfoPrec #-} - --- | Convert an 'Exception' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbExceptionPrec :: Int -> Exception -> Builder -showbExceptionPrec = showbPrec -{-# INLINE showbExceptionPrec #-} - --- | Convert a 'BY_HANDLE_FILE_INFORMATION' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showb_BY_HANDLE_FILE_INFORMATION_Prec :: Int -> BY_HANDLE_FILE_INFORMATION -> Builder -showb_BY_HANDLE_FILE_INFORMATION_Prec = showbPrec -{-# INLINE showb_BY_HANDLE_FILE_INFORMATION_Prec #-} - --- | Convert a 'WIN32_FILE_ATTRIBUTE_DATA' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showb_WIN32_FILE_ATTRIBUTE_DATA_Prec :: Int -> WIN32_FILE_ATTRIBUTE_DATA -> Builder -showb_WIN32_FILE_ATTRIBUTE_DATA_Prec = showbPrec -{-# INLINE showb_WIN32_FILE_ATTRIBUTE_DATA_Prec #-} - --- | Convert a 'ProcessorArchitecture' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbProcessorArchitecturePrec :: Int -> ProcessorArchitecture -> Builder -showbProcessorArchitecturePrec = showbPrec -{-# INLINE showbProcessorArchitecturePrec #-} - --- | Convert a 'SYSTEM_INFO' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showb_SYSTEM_INFO_Prec :: Int -> SYSTEM_INFO -> Builder -showb_SYSTEM_INFO_Prec = showbPrec -{-# INLINE showb_SYSTEM_INFO_Prec #-} - --- | Convert a 'FILETIME' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showb_FILETIME_Prec :: Int -> FILETIME -> Builder -showb_FILETIME_Prec = showbPrec -{-# INLINE showb_FILETIME_Prec #-} - --- | Convert a 'SYSTEMTIME' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showb_SYSTEMTIME_Prec :: Int -> SYSTEMTIME -> Builder -showb_SYSTEMTIME_Prec = showbPrec -{-# INLINE showb_SYSTEMTIME_Prec #-} - --- | Convert a 'TIME_ZONE_INFORMATION' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showb_TIME_ZONE_INFORMATION_Prec :: Int -> TIME_ZONE_INFORMATION -> Builder -showb_TIME_ZONE_INFORMATION_Prec = showbPrec -{-# INLINE showb_TIME_ZONE_INFORMATION_Prec #-} - --- | Convert a 'TimeZoneId' to a 'Builder'. --- --- /Since: 2/ -showbTimeZoneIdPrec :: TimeZoneId -> Builder -showbTimeZoneIdPrec = showb -{-# INLINE showbTimeZoneIdPrec #-} - -$(deriveTextShow ''DebugEventInfo) -$(deriveTextShow ''Exception) -$(deriveTextShow ''BY_HANDLE_FILE_INFORMATION) -$(deriveTextShow ''WIN32_FILE_ATTRIBUTE_DATA) -$(deriveTextShow ''ProcessorArchitecture) -$(deriveTextShow ''SYSTEM_INFO) -$(deriveTextShow ''FILETIME) -$(deriveTextShow ''SYSTEMTIME) -$(deriveTextShow ''TIME_ZONE_INFORMATION) -$(deriveTextShow ''TimeZoneId) -#endif +{-# LANGUAGE CPP #-}++#if defined(mingw32_HOST_OS)+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+#endif++{-|+Module: TextShow.System.Win32+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @Win32@ library.+This module only exports functions if using Windows.++/Since: 2/+-}+module TextShow.System.Win32 (+#if !defined(mingw32_HOST_OS)+ ) where+#else+ showbDebugEventInfoPrec+ , showbExceptionPrec+ , showb_BY_HANDLE_FILE_INFORMATION_Prec+ , showb_WIN32_FILE_ATTRIBUTE_DATA_Prec+ , showbProcessorArchitecturePrec+ , showb_SYSTEM_INFO_Prec+ , showb_FILETIME_Prec+ , showb_SYSTEMTIME_Prec+ , showb_TIME_ZONE_INFORMATION_Prec+ , showbTimeZoneIdPrec+ ) where++import System.Win32.DebugApi (DebugEventInfo, Exception)+import System.Win32.File (BY_HANDLE_FILE_INFORMATION, WIN32_FILE_ATTRIBUTE_DATA)+import System.Win32.Info (ProcessorArchitecture, SYSTEM_INFO)+import System.Win32.Time (FILETIME, SYSTEMTIME, TIME_ZONE_INFORMATION, TimeZoneId)++import TextShow (Builder, showb, showbPrec)+import TextShow.TH (deriveTextShow)++-- | Convert a 'DebugEventInfo' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbDebugEventInfoPrec :: Int -> DebugEventInfo -> Builder+showbDebugEventInfoPrec = showbPrec+{-# INLINE showbDebugEventInfoPrec #-}++-- | Convert an 'Exception' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbExceptionPrec :: Int -> Exception -> Builder+showbExceptionPrec = showbPrec+{-# INLINE showbExceptionPrec #-}++-- | Convert a 'BY_HANDLE_FILE_INFORMATION' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showb_BY_HANDLE_FILE_INFORMATION_Prec :: Int -> BY_HANDLE_FILE_INFORMATION -> Builder+showb_BY_HANDLE_FILE_INFORMATION_Prec = showbPrec+{-# INLINE showb_BY_HANDLE_FILE_INFORMATION_Prec #-}++-- | Convert a 'WIN32_FILE_ATTRIBUTE_DATA' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showb_WIN32_FILE_ATTRIBUTE_DATA_Prec :: Int -> WIN32_FILE_ATTRIBUTE_DATA -> Builder+showb_WIN32_FILE_ATTRIBUTE_DATA_Prec = showbPrec+{-# INLINE showb_WIN32_FILE_ATTRIBUTE_DATA_Prec #-}++-- | Convert a 'ProcessorArchitecture' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbProcessorArchitecturePrec :: Int -> ProcessorArchitecture -> Builder+showbProcessorArchitecturePrec = showbPrec+{-# INLINE showbProcessorArchitecturePrec #-}++-- | Convert a 'SYSTEM_INFO' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showb_SYSTEM_INFO_Prec :: Int -> SYSTEM_INFO -> Builder+showb_SYSTEM_INFO_Prec = showbPrec+{-# INLINE showb_SYSTEM_INFO_Prec #-}++-- | Convert a 'FILETIME' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showb_FILETIME_Prec :: Int -> FILETIME -> Builder+showb_FILETIME_Prec = showbPrec+{-# INLINE showb_FILETIME_Prec #-}++-- | Convert a 'SYSTEMTIME' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showb_SYSTEMTIME_Prec :: Int -> SYSTEMTIME -> Builder+showb_SYSTEMTIME_Prec = showbPrec+{-# INLINE showb_SYSTEMTIME_Prec #-}++-- | Convert a 'TIME_ZONE_INFORMATION' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showb_TIME_ZONE_INFORMATION_Prec :: Int -> TIME_ZONE_INFORMATION -> Builder+showb_TIME_ZONE_INFORMATION_Prec = showbPrec+{-# INLINE showb_TIME_ZONE_INFORMATION_Prec #-}++-- | Convert a 'TimeZoneId' to a 'Builder'.+--+-- /Since: 2/+showbTimeZoneIdPrec :: TimeZoneId -> Builder+showbTimeZoneIdPrec = showb+{-# INLINE showbTimeZoneIdPrec #-}++$(deriveTextShow ''DebugEventInfo)+$(deriveTextShow ''Exception)+$(deriveTextShow ''BY_HANDLE_FILE_INFORMATION)+$(deriveTextShow ''WIN32_FILE_ATTRIBUTE_DATA)+$(deriveTextShow ''ProcessorArchitecture)+$(deriveTextShow ''SYSTEM_INFO)+$(deriveTextShow ''FILETIME)+$(deriveTextShow ''SYSTEMTIME)+$(deriveTextShow ''TIME_ZONE_INFORMATION)+$(deriveTextShow ''TimeZoneId)+#endif
src/TextShow/Text/PrettyPrint.hs view
@@ -1,106 +1,106 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Text.PrettyPrint -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @pretty@ library. - -/Since: 2/ --} -module TextShow.Text.PrettyPrint ( - renderB - , renderStyleB - , showbMode - , showbStylePrec - , showbTextDetailsPrec -#if MIN_VERSION_pretty(1,1,2) - , showbPrettyLevelPrec -#endif - ) where - -import Data.Monoid.Compat - -import Text.PrettyPrint.HughesPJ (Doc, Mode, Style(..), TextDetails(..), - fullRender, style) -#if MIN_VERSION_pretty(1,1,2) -import Text.PrettyPrint.HughesPJClass (PrettyLevel) -#endif - -import TextShow (TextShow(showb, showbPrec), Builder, fromString, singleton) -import TextShow.TH (deriveTextShow) - -#include "inline.h" - --- | Renders a 'Doc' to a 'Builder' using the default 'style'. --- --- /Since: 2/ -renderB :: Doc -> Builder -renderB = renderStyleB style -{-# INLINE renderB #-} - --- | Renders a 'Doc' to a 'Builder' using the given 'Style'. --- --- /Since: 2/ -renderStyleB :: Style -> Doc -> Builder -renderStyleB sty doc = fullRender (mode sty) - (lineLength sty) - (ribbonsPerLine sty) - txtPrinter - mempty - doc -{-# INLINE renderStyleB #-} - -txtPrinter :: TextDetails -> Builder -> Builder -txtPrinter (Chr c) b = singleton c <> b -txtPrinter (Str s') b = fromString s' <> b -txtPrinter (PStr s') b = fromString s' <> b -{-# INLINE txtPrinter #-} - --- | Convert a 'Mode' to a 'Builder'. --- --- /Since: 2/ -showbMode :: Mode -> Builder -showbMode = showb -{-# INLINE showbMode #-} - --- | Convert a 'Style' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbStylePrec :: Int -> Style -> Builder -showbStylePrec = showbPrec -{-# INLINE showbStylePrec #-} - --- | Convert 'TextDetails' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbTextDetailsPrec :: Int -> TextDetails -> Builder -showbTextDetailsPrec = showbPrec -{-# INLINE showbTextDetailsPrec #-} - -#if MIN_VERSION_pretty(1,1,2) --- | Convert a 'PrettyLevel' value to a 'Builder' with the given precedence. --- This function is only available with @pretty-1.1.2.0@ or later. --- --- /Since: 2/ -showbPrettyLevelPrec :: Int -> PrettyLevel -> Builder -showbPrettyLevelPrec = showbPrec -{-# INLINE showbPrettyLevelPrec #-} -#endif - -instance TextShow Doc where - showb = renderB - INLINE_INST_FUN(showb) - -$(deriveTextShow ''Mode) -$(deriveTextShow ''Style) -$(deriveTextShow ''TextDetails) - -#if MIN_VERSION_pretty(1,1,2) -$(deriveTextShow ''PrettyLevel) -#endif +{-# LANGUAGE CPP #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Text.PrettyPrint+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @pretty@ library.++/Since: 2/+-}+module TextShow.Text.PrettyPrint (+ renderB+ , renderStyleB+ , showbMode+ , showbStylePrec+ , showbTextDetailsPrec+#if MIN_VERSION_pretty(1,1,2)+ , showbPrettyLevelPrec+#endif+ ) where++import Data.Monoid.Compat++import Text.PrettyPrint.HughesPJ (Doc, Mode, Style(..), TextDetails(..),+ fullRender, style)+#if MIN_VERSION_pretty(1,1,2)+import Text.PrettyPrint.HughesPJClass (PrettyLevel)+#endif++import TextShow (TextShow(showb, showbPrec), Builder, fromString, singleton)+import TextShow.TH (deriveTextShow)++#include "inline.h"++-- | Renders a 'Doc' to a 'Builder' using the default 'style'.+--+-- /Since: 2/+renderB :: Doc -> Builder+renderB = renderStyleB style+{-# INLINE renderB #-}++-- | Renders a 'Doc' to a 'Builder' using the given 'Style'.+--+-- /Since: 2/+renderStyleB :: Style -> Doc -> Builder+renderStyleB sty doc = fullRender (mode sty)+ (lineLength sty)+ (ribbonsPerLine sty)+ txtPrinter+ mempty+ doc+{-# INLINE renderStyleB #-}++txtPrinter :: TextDetails -> Builder -> Builder+txtPrinter (Chr c) b = singleton c <> b+txtPrinter (Str s') b = fromString s' <> b+txtPrinter (PStr s') b = fromString s' <> b+{-# INLINE txtPrinter #-}++-- | Convert a 'Mode' to a 'Builder'.+--+-- /Since: 2/+showbMode :: Mode -> Builder+showbMode = showb+{-# INLINE showbMode #-}++-- | Convert a 'Style' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbStylePrec :: Int -> Style -> Builder+showbStylePrec = showbPrec+{-# INLINE showbStylePrec #-}++-- | Convert 'TextDetails' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbTextDetailsPrec :: Int -> TextDetails -> Builder+showbTextDetailsPrec = showbPrec+{-# INLINE showbTextDetailsPrec #-}++#if MIN_VERSION_pretty(1,1,2)+-- | Convert a 'PrettyLevel' value to a 'Builder' with the given precedence.+-- This function is only available with @pretty-1.1.2.0@ or later.+--+-- /Since: 2/+showbPrettyLevelPrec :: Int -> PrettyLevel -> Builder+showbPrettyLevelPrec = showbPrec+{-# INLINE showbPrettyLevelPrec #-}+#endif++instance TextShow Doc where+ showb = renderB+ INLINE_INST_FUN(showb)++$(deriveTextShow ''Mode)+$(deriveTextShow ''Style)+$(deriveTextShow ''TextDetails)++#if MIN_VERSION_pretty(1,1,2)+$(deriveTextShow ''PrettyLevel)+#endif
src/TextShow/Text/XHtml.hs view
@@ -1,87 +1,87 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Text.XHtml -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @xhtml@ library. - -/Since: 2/ --} -module TextShow.Text.XHtml ( - showbHtml - , showbHtmlList - , showbHtmlAttr - , showbHotLinkPrec - , showbHtmlTable - ) where - -import Data.Monoid.Compat - -import Text.XHtml.Frameset (Html, HtmlAttr, HotLink, - htmlAttrPair, renderHtmlFragment) -import Text.XHtml.Table (HtmlTable) - -import TextShow (TextShow(..), Builder, FromStringShow(..), fromString, singleton) -import TextShow.Data.Char (showbString) -import TextShow.TH (deriveTextShow) - -#include "inline.h" - --- | Convert an 'Html' value to a 'Builder'. --- --- /Since: 2/ -showbHtml :: Html -> Builder -showbHtml = fromString . renderHtmlFragment -{-# INLINE showbHtml #-} - --- | Convert a list of 'Html' values to a 'Builder'. --- --- /Since: 2/ -showbHtmlList :: [Html] -> Builder -showbHtmlList = mconcat . map showb -{-# INLINE showbHtmlList #-} - --- | Convert an 'HtmlAttr' to a 'Builder'. --- --- /Since: 2/ -showbHtmlAttr :: HtmlAttr -> Builder -showbHtmlAttr ha = case htmlAttrPair ha of - (str, val) -> fromString str <> singleton '=' <> showbString val -{-# INLINE showbHtmlAttr #-} - --- | Convert a 'HotLink' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbHotLinkPrec :: Int -> HotLink -> Builder -showbHotLinkPrec = showbPrec -{-# INLINE showbHotLinkPrec #-} - --- | Convert an 'HtmlTable' to a 'Builder'. --- --- /Since: 2/ -showbHtmlTable :: HtmlTable -> Builder -showbHtmlTable = showb . FromStringShow -{-# INLINE showbHtmlTable #-} - -instance TextShow Html where - showb = showbHtml - INLINE_INST_FUN(showb) - - showbList = showbHtmlList - INLINE_INST_FUN(showbList) - -instance TextShow HtmlAttr where - showb = showbHtmlAttr - INLINE_INST_FUN(showb) - -$(deriveTextShow ''HotLink) - -instance TextShow HtmlTable where - showb = showbHtmlTable - INLINE_INST_FUN(showb) +{-# LANGUAGE CPP #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Text.XHtml+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @xhtml@ library.++/Since: 2/+-}+module TextShow.Text.XHtml (+ showbHtml+ , showbHtmlList+ , showbHtmlAttr+ , showbHotLinkPrec+ , showbHtmlTable+ ) where++import Data.Monoid.Compat++import Text.XHtml.Frameset (Html, HtmlAttr, HotLink,+ htmlAttrPair, renderHtmlFragment)+import Text.XHtml.Table (HtmlTable)++import TextShow (TextShow(..), Builder, FromStringShow(..), fromString, singleton)+import TextShow.Data.Char (showbString)+import TextShow.TH (deriveTextShow)++#include "inline.h"++-- | Convert an 'Html' value to a 'Builder'.+--+-- /Since: 2/+showbHtml :: Html -> Builder+showbHtml = fromString . renderHtmlFragment+{-# INLINE showbHtml #-}++-- | Convert a list of 'Html' values to a 'Builder'.+--+-- /Since: 2/+showbHtmlList :: [Html] -> Builder+showbHtmlList = mconcat . map showb+{-# INLINE showbHtmlList #-}++-- | Convert an 'HtmlAttr' to a 'Builder'.+--+-- /Since: 2/+showbHtmlAttr :: HtmlAttr -> Builder+showbHtmlAttr ha = case htmlAttrPair ha of+ (str, val) -> fromString str <> singleton '=' <> showbString val+{-# INLINE showbHtmlAttr #-}++-- | Convert a 'HotLink' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbHotLinkPrec :: Int -> HotLink -> Builder+showbHotLinkPrec = showbPrec+{-# INLINE showbHotLinkPrec #-}++-- | Convert an 'HtmlTable' to a 'Builder'.+--+-- /Since: 2/+showbHtmlTable :: HtmlTable -> Builder+showbHtmlTable = showb . FromStringShow+{-# INLINE showbHtmlTable #-}++instance TextShow Html where+ showb = showbHtml+ INLINE_INST_FUN(showb)++ showbList = showbHtmlList+ INLINE_INST_FUN(showbList)++instance TextShow HtmlAttr where+ showb = showbHtmlAttr+ INLINE_INST_FUN(showb)++$(deriveTextShow ''HotLink)++instance TextShow HtmlTable where+ showb = showbHtmlTable+ INLINE_INST_FUN(showb)
src/TextShow/Trace/Hpc.hs view
@@ -1,104 +1,104 @@-{-# LANGUAGE CPP #-} -{-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -{-| -Module: TextShow.Trace.Hpc -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -Monomorphic 'TextShow' functions for data types in the @hpc@ library. - -/Since: 2/ --} -module TextShow.Trace.Hpc ( - showbMixPrec - , showbBoxLabelPrec - , showbCondBox - , showbTixPrec - , showbTixModulePrec - , showbHpcPos - , showbHash - ) where - -import Data.Monoid.Compat - -import TextShow (TextShow(showb, showbPrec), Builder, FromStringShow(..), singleton) -import TextShow.Data.Integral (showbIntPrec) -import TextShow.Data.Time () -import TextShow.TH (deriveTextShow) - -import Trace.Hpc.Mix (Mix, BoxLabel, CondBox) -import Trace.Hpc.Tix (Tix, TixModule) -import Trace.Hpc.Util (HpcPos, Hash, fromHpcPos) - -#include "inline.h" - --- | Convert a 'Mix' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbMixPrec :: Int -> Mix -> Builder -showbMixPrec = showbPrec -{-# INLINE showbMixPrec #-} - --- | Convert a 'BoxLabel' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbBoxLabelPrec :: Int -> BoxLabel -> Builder -showbBoxLabelPrec = showbPrec -{-# INLINE showbBoxLabelPrec #-} - --- | Convert a 'CondBox' to a 'Builder'. --- --- /Since: 2/ -showbCondBox :: CondBox -> Builder -showbCondBox = showb -{-# INLINE showbCondBox #-} - --- | Convert a 'Tix' value to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbTixPrec :: Int -> Tix -> Builder -showbTixPrec = showbPrec -{-# INLINE showbTixPrec #-} - --- | Convert a 'TixModule' to a 'Builder' with the given precedence. --- --- /Since: 2/ -showbTixModulePrec :: Int -> TixModule -> Builder -showbTixModulePrec = showbPrec -{-# INLINE showbTixModulePrec #-} - --- | Convert a 'HpcPos' to a 'Builder'. --- --- /Since: 2/ -showbHpcPos :: HpcPos -> Builder -showbHpcPos hp = case fromHpcPos hp of - (l1, c1, l2, c2) -> showbIntPrec 0 l1 - <> (singleton ':' <> showbIntPrec 0 c1) - <> (singleton '-' <> showbIntPrec 0 l2) - <> (singleton ':' <> showbIntPrec 0 c2) -{-# INLINE showbHpcPos #-} - --- | Convert a 'Hash' to a 'Builder'. --- --- /Since: 2/ -showbHash :: Hash -> Builder -showbHash = showb . FromStringShow -{-# INLINE showbHash #-} - -$(deriveTextShow ''Mix) -$(deriveTextShow ''BoxLabel) -$(deriveTextShow ''CondBox) -$(deriveTextShow ''Tix) -$(deriveTextShow ''TixModule) - -instance TextShow HpcPos where - showb = showbHpcPos - INLINE_INST_FUN(showb) - -instance TextShow Hash where - showb = showbHash - INLINE_INST_FUN(showb) +{-# LANGUAGE CPP #-}+{-# LANGUAGE TemplateHaskell #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-|+Module: TextShow.Trace.Hpc+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++Monomorphic 'TextShow' functions for data types in the @hpc@ library.++/Since: 2/+-}+module TextShow.Trace.Hpc (+ showbMixPrec+ , showbBoxLabelPrec+ , showbCondBox+ , showbTixPrec+ , showbTixModulePrec+ , showbHpcPos+ , showbHash+ ) where++import Data.Monoid.Compat++import TextShow (TextShow(showb, showbPrec), Builder, FromStringShow(..), singleton)+import TextShow.Data.Integral (showbIntPrec)+import TextShow.Data.Time ()+import TextShow.TH (deriveTextShow)++import Trace.Hpc.Mix (Mix, BoxLabel, CondBox)+import Trace.Hpc.Tix (Tix, TixModule)+import Trace.Hpc.Util (HpcPos, Hash, fromHpcPos)++#include "inline.h"++-- | Convert a 'Mix' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbMixPrec :: Int -> Mix -> Builder+showbMixPrec = showbPrec+{-# INLINE showbMixPrec #-}++-- | Convert a 'BoxLabel' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbBoxLabelPrec :: Int -> BoxLabel -> Builder+showbBoxLabelPrec = showbPrec+{-# INLINE showbBoxLabelPrec #-}++-- | Convert a 'CondBox' to a 'Builder'.+--+-- /Since: 2/+showbCondBox :: CondBox -> Builder+showbCondBox = showb+{-# INLINE showbCondBox #-}++-- | Convert a 'Tix' value to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbTixPrec :: Int -> Tix -> Builder+showbTixPrec = showbPrec+{-# INLINE showbTixPrec #-}++-- | Convert a 'TixModule' to a 'Builder' with the given precedence.+--+-- /Since: 2/+showbTixModulePrec :: Int -> TixModule -> Builder+showbTixModulePrec = showbPrec+{-# INLINE showbTixModulePrec #-}++-- | Convert a 'HpcPos' to a 'Builder'.+--+-- /Since: 2/+showbHpcPos :: HpcPos -> Builder+showbHpcPos hp = case fromHpcPos hp of+ (l1, c1, l2, c2) -> showbIntPrec 0 l1+ <> (singleton ':' <> showbIntPrec 0 c1)+ <> (singleton '-' <> showbIntPrec 0 l2)+ <> (singleton ':' <> showbIntPrec 0 c2)+{-# INLINE showbHpcPos #-}++-- | Convert a 'Hash' to a 'Builder'.+--+-- /Since: 2/+showbHash :: Hash -> Builder+showbHash = showb . FromStringShow+{-# INLINE showbHash #-}++$(deriveTextShow ''Mix)+$(deriveTextShow ''BoxLabel)+$(deriveTextShow ''CondBox)+$(deriveTextShow ''Tix)+$(deriveTextShow ''TixModule)++instance TextShow HpcPos where+ showb = showbHpcPos+ INLINE_INST_FUN(showb)++instance TextShow Hash where+ showb = showbHash+ INLINE_INST_FUN(showb)
src/TextShow/Utils.hs view
@@ -1,29 +1,29 @@-{-# LANGUAGE OverloadedStrings #-} -{-| -Module: TextShow.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 TextShow.Utils (showbUnaryListWith, showbUnaryList) where - -import TextShow (TextShow(showbPrec), Builder, showbUnaryWith) -import TextShow.Data.List (showbListWith) - --- | This pattern is used frequently when showing container types. -showbUnaryListWith :: (a -> Builder) -> Int -> [a] -> Builder -showbUnaryListWith sp p = showbUnaryWith (const $ showbListWith sp) "fromList" p -{-# INLINE showbUnaryListWith #-} - --- | This pattern is used frequently when showing container types. --- --- We define this separately from 'showbUnaryListWith' since calling 'showbPrec' on --- a list may result in different output than 'showbListWith' (since a 'Show' --- instance may override 'showbList'). -showbUnaryList :: TextShow a => Int -> [a] -> Builder -showbUnaryList p = showbUnaryWith showbPrec "fromList" p -{-# INLINE showbUnaryList #-} +{-# LANGUAGE OverloadedStrings #-}+{-|+Module: TextShow.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 TextShow.Utils (showbUnaryListWith, showbUnaryList) where++import TextShow (TextShow(showbPrec), Builder, showbUnaryWith)+import TextShow.Data.List (showbListWith)++-- | This pattern is used frequently when showing container types.+showbUnaryListWith :: (a -> Builder) -> Int -> [a] -> Builder+showbUnaryListWith sp p = showbUnaryWith (const $ showbListWith sp) "fromList" p+{-# INLINE showbUnaryListWith #-}++-- | This pattern is used frequently when showing container types.+--+-- We define this separately from 'showbUnaryListWith' since calling 'showbPrec' on+-- a list may result in different output than 'showbListWith' (since a 'Show'+-- instance may override 'showbList').+showbUnaryList :: TextShow a => Int -> [a] -> Builder+showbUnaryList p = showbUnaryWith showbPrec "fromList" p+{-# INLINE showbUnaryList #-}
tests/Spec/Compiler/HooplSpec.hs view
@@ -1,50 +1,50 @@-{-| -Module: Spec.Compiler.HooplSpec -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 @hoopl@ library. --} -module Spec.Compiler.HooplSpec (main, spec) where - -import Compiler.Hoopl (Label, LabelMap, LabelSet, Pointed, - Unique, UniqueMap, UniqueSet, C) -import Compiler.Hoopl.Passes.Dominator (DominatorNode, DominatorTree, DPath) - -import Instances.Compiler.Hoopl () - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Compiler.Hoopl () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "Label" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Label -> Bool) - describe "LabelMap Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> LabelMap Char -> Bool) - describe "LabelSet" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> LabelSet -> Bool) - describe "Pointed C C Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Pointed C C Int -> Bool) - describe "Unique" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Unique -> Bool) - describe "UniqueMap Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> UniqueMap Char -> Bool) - describe "UniqueSet" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> UniqueSet -> Bool) - describe "DominatorNode" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> DominatorNode -> Bool) - describe "DominatorTree" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> DominatorTree -> Bool) - describe "DPath" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> DPath -> Bool) +{-|+Module: Spec.Compiler.HooplSpec+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 @hoopl@ library.+-}+module Spec.Compiler.HooplSpec (main, spec) where++import Compiler.Hoopl (Label, LabelMap, LabelSet, Pointed,+ Unique, UniqueMap, UniqueSet, C)+import Compiler.Hoopl.Passes.Dominator (DominatorNode, DominatorTree, DPath)++import Instances.Compiler.Hoopl ()++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Compiler.Hoopl ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "Label" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Label -> Bool)+ describe "LabelMap Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> LabelMap Char -> Bool)+ describe "LabelSet" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> LabelSet -> Bool)+ describe "Pointed C C Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Pointed C C Int -> Bool)+ describe "Unique" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Unique -> Bool)+ describe "UniqueMap Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> UniqueMap Char -> Bool)+ describe "UniqueSet" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> UniqueSet -> Bool)+ describe "DominatorNode" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> DominatorNode -> Bool)+ describe "DominatorTree" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> DominatorTree -> Bool)+ describe "DPath" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> DPath -> Bool)
tests/Spec/Control/Applicative/TransSpec.hs view
@@ -1,33 +1,33 @@-{-| -Module: Spec.Control.Applicative.TransSpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for applicative functor transformers. --} -module Spec.Control.Applicative.TransSpec (main, spec) where - -import Control.Applicative.Backwards (Backwards) -import Control.Applicative.Lift (Lift) - -import Instances.Control.Applicative.Trans () - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Control.Applicative.Trans () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "Backwards Maybe Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Backwards Maybe Int -> Bool) - describe "Lift Maybe Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Lift Maybe Int -> Bool) +{-|+Module: Spec.Control.Applicative.TransSpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for applicative functor transformers.+-}+module Spec.Control.Applicative.TransSpec (main, spec) where++import Control.Applicative.Backwards (Backwards)+import Control.Applicative.Lift (Lift)++import Instances.Control.Applicative.Trans ()++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Control.Applicative.Trans ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "Backwards Maybe Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Backwards Maybe Int -> Bool)+ describe "Lift Maybe Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Lift Maybe Int -> Bool)
tests/Spec/Control/Monad/TransSpec.hs view
@@ -1,49 +1,49 @@-{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} -{-| -Module: Spec.Control.Monad.TransSpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for monad transformers. --} -module Spec.Control.Monad.TransSpec (main, spec) where - -import Control.Monad.Trans.Error (ErrorT) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Identity (IdentityT) -import Control.Monad.Trans.List (ListT) -import Control.Monad.Trans.Maybe (MaybeT) -import qualified Control.Monad.Trans.Writer.Lazy as WL (WriterT) -import qualified Control.Monad.Trans.Writer.Strict as WS (WriterT) - -import Instances.Control.Monad.Trans () - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Control.Monad.Trans () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "ErrorT Char Maybe Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> ErrorT Char Maybe Int -> Bool) - describe "ExceptT Char Maybe Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> ExceptT Char Maybe Int -> Bool) - describe "IdentityT Maybe Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> IdentityT Maybe Int -> Bool) - describe "ListT Maybe Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> ListT Maybe Char -> Bool) - describe "Maybe [] Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> MaybeT [] Int -> Bool) - describe "lazy WriterT String Maybe Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> WL.WriterT String Maybe Int -> Bool) - describe "strict WriterT String Maybe Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> WS.WriterT String Maybe Int -> Bool) +{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}+{-|+Module: Spec.Control.Monad.TransSpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for monad transformers.+-}+module Spec.Control.Monad.TransSpec (main, spec) where++import Control.Monad.Trans.Error (ErrorT)+import Control.Monad.Trans.Except (ExceptT)+import Control.Monad.Trans.Identity (IdentityT)+import Control.Monad.Trans.List (ListT)+import Control.Monad.Trans.Maybe (MaybeT)+import qualified Control.Monad.Trans.Writer.Lazy as WL (WriterT)+import qualified Control.Monad.Trans.Writer.Strict as WS (WriterT)++import Instances.Control.Monad.Trans ()++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Control.Monad.Trans ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "ErrorT Char Maybe Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ErrorT Char Maybe Int -> Bool)+ describe "ExceptT Char Maybe Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ExceptT Char Maybe Int -> Bool)+ describe "IdentityT Maybe Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> IdentityT Maybe Int -> Bool)+ describe "ListT Maybe Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ListT Maybe Char -> Bool)+ describe "Maybe [] Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> MaybeT [] Int -> Bool)+ describe "lazy WriterT String Maybe Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> WL.WriterT String Maybe Int -> Bool)+ describe "strict WriterT String Maybe Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> WS.WriterT String Maybe Int -> Bool)
tests/Spec/Data/BifunctorSpec.hs view
@@ -1,51 +1,51 @@-{-| -Module: Spec.Data.BifunctorSpec -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 @bifunctors@ library. --} -module Spec.Data.BifunctorSpec (main, spec) where - -import Data.Bifunctor.Biff (Biff) -import Data.Bifunctor.Clown (Clown) -import Data.Bifunctor.Flip (Flip) -import Data.Bifunctor.Join (Join) -import Data.Bifunctor.Joker (Joker) -import Data.Bifunctor.Product (Product) -import Data.Bifunctor.Tannen (Tannen) -import Data.Bifunctor.Wrapped (WrappedBifunctor) - -import Instances.Data.Bifunctor () - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Data.Bifunctor () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "Biff Either [] Maybe Char Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Biff Either [] Maybe Char Int -> Bool) - describe "Clown [] Char Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Clown [] Char Int -> Bool) - describe "Flip Either Int Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Flip Either Int Char -> Bool) - describe "Join Either Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Join Either Int -> Bool) - describe "Joker [] Char Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Joker [] Char Int -> Bool) - describe "Product Either ((,,) Bool) Int Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Product Either ((,,) Bool) Int Char -> Bool) - describe "Tannen Maybe Either Int Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Tannen Maybe Either Int Char -> Bool) - describe "WrappedBifunctor Either Int Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> WrappedBifunctor Either Int Char -> Bool) +{-|+Module: Spec.Data.BifunctorSpec+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 @bifunctors@ library.+-}+module Spec.Data.BifunctorSpec (main, spec) where++import Data.Bifunctor.Biff (Biff)+import Data.Bifunctor.Clown (Clown)+import Data.Bifunctor.Flip (Flip)+import Data.Bifunctor.Join (Join)+import Data.Bifunctor.Joker (Joker)+import Data.Bifunctor.Product (Product)+import Data.Bifunctor.Tannen (Tannen)+import Data.Bifunctor.Wrapped (WrappedBifunctor)++import Instances.Data.Bifunctor ()++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Data.Bifunctor ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "Biff Either [] Maybe Char Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Biff Either [] Maybe Char Int -> Bool)+ describe "Clown [] Char Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Clown [] Char Int -> Bool)+ describe "Flip Either Int Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Flip Either Int Char -> Bool)+ describe "Join Either Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Join Either Int -> Bool)+ describe "Joker [] Char Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Joker [] Char Int -> Bool)+ describe "Product Either ((,,) Bool) Int Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Product Either ((,,) Bool) Int Char -> Bool)+ describe "Tannen Maybe Either Int Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Tannen Maybe Either Int Char -> Bool)+ describe "WrappedBifunctor Either Int Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> WrappedBifunctor Either Int Char -> Bool)
tests/Spec/Data/BinarySpec.hs view
@@ -1,29 +1,29 @@-{-| -Module: Spec.Data.BinarySpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for 'Decoder's. --} -module Spec.Data.BinarySpec (main, spec) where - -import Data.Binary.Get.Internal (Decoder) - -import Instances.Data.Binary () - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Data.Binary () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel . describe "Decoder Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Decoder Int -> Bool) +{-|+Module: Spec.Data.BinarySpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for 'Decoder's.+-}+module Spec.Data.BinarySpec (main, spec) where++import Data.Binary.Get.Internal (Decoder)++import Instances.Data.Binary ()++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Data.Binary ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel . describe "Decoder Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Decoder Int -> Bool)
tests/Spec/Data/ContainersSpec.hs view
@@ -1,50 +1,50 @@-{-| -Module: Spec.Data.ContainersSpec -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 @containers@ library. --} -module Spec.Data.ContainersSpec (main, spec) where - -import Data.IntMap (IntMap) -import Data.IntSet (IntSet) -import Data.Map (Map) -import Data.Sequence (Seq, ViewL, ViewR) -import Data.Set (Set) -import Data.Tree (Tree) - -import Instances.Data.Containers () - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) -import Test.QuickCheck.Instances () - -import TextShow.Data.Containers () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "IntMap Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> IntMap Char -> Bool) - describe "IntSet" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> IntSet -> Bool) - describe "Map Char Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Map Char Char -> Bool) - describe "Sequence Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Seq Char -> Bool) - describe "ViewL Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> ViewL Char -> Bool) - describe "ViewR Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> ViewR Char -> Bool) - describe "Set Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Set Char -> Bool) - describe "Tree Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Tree Char -> Bool) +{-|+Module: Spec.Data.ContainersSpec+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 @containers@ library.+-}+module Spec.Data.ContainersSpec (main, spec) where++import Data.IntMap (IntMap)+import Data.IntSet (IntSet)+import Data.Map (Map)+import Data.Sequence (Seq, ViewL, ViewR)+import Data.Set (Set)+import Data.Tree (Tree)++import Instances.Data.Containers ()++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)+import Test.QuickCheck.Instances ()++import TextShow.Data.Containers ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "IntMap Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> IntMap Char -> Bool)+ describe "IntSet" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> IntSet -> Bool)+ describe "Map Char Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Map Char Char -> Bool)+ describe "Sequence Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Seq Char -> Bool)+ describe "ViewL Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ViewL Char -> Bool)+ describe "ViewR Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ViewR Char -> Bool)+ describe "Set Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Set Char -> Bool)+ describe "Tree Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Tree Char -> Bool)
tests/Spec/Data/Functor/TransSpec.hs view
@@ -1,42 +1,42 @@-{-| -Module: Spec.Data.Functor.TransSpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for functor transformers. --} -module Spec.Data.Functor.TransSpec (main, spec) where - -import Data.Functor.Compose (Compose) -import Data.Functor.Constant (Constant) -import Data.Functor.Product (Product) -import Data.Functor.Reverse (Reverse) -import Data.Functor.Sum (Sum) - -import Instances.Data.Functor.Trans () - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Data.Functor.Trans () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "Compose Maybe (Either Int) Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Compose Maybe (Either Int) Char -> Bool) - describe "Constant Int Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Constant Int Char -> Bool) - describe "Product Maybe (Either Int) Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Product Maybe (Either Int) Char -> Bool) - describe "Reverse Maybe Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Reverse Maybe Int -> Bool) - describe "Sum Maybe (Either Int) Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Sum Maybe (Either Int) Char -> Bool) +{-|+Module: Spec.Data.Functor.TransSpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for functor transformers.+-}+module Spec.Data.Functor.TransSpec (main, spec) where++import Data.Functor.Compose (Compose)+import Data.Functor.Constant (Constant)+import Data.Functor.Product (Product)+import Data.Functor.Reverse (Reverse)+import Data.Functor.Sum (Sum)++import Instances.Data.Functor.Trans ()++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Data.Functor.Trans ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "Compose Maybe (Either Int) Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Compose Maybe (Either Int) Char -> Bool)+ describe "Constant Int Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Constant Int Char -> Bool)+ describe "Product Maybe (Either Int) Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Product Maybe (Either Int) Char -> Bool)+ describe "Reverse Maybe Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Reverse Maybe Int -> Bool)+ describe "Sum Maybe (Either Int) Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Sum Maybe (Either Int) Char -> Bool)
tests/Spec/Data/List/NonEmptySpec.hs view
@@ -1,31 +1,31 @@-{-| -Module: Spec.Data.List.NonEmptySpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for 'NonEmpty' lists. --} -module Spec.Data.List.NonEmptySpec (main, spec) where - -import Data.List.NonEmpty (NonEmpty) - -import Instances.Data.List.NonEmpty () - -import Spec.Utils (prop_matchesTextShow, prop_genericTextShow, prop_genericTextShow1) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Data.List.NonEmpty () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel . describe "NonEmpty Char" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> NonEmpty Char -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> NonEmpty Char -> Bool) - prop "generic TextShow1" (prop_genericTextShow1 :: Int -> NonEmpty Char -> Bool) +{-|+Module: Spec.Data.List.NonEmptySpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for 'NonEmpty' lists.+-}+module Spec.Data.List.NonEmptySpec (main, spec) where++import Data.List.NonEmpty (NonEmpty)++import Instances.Data.List.NonEmpty ()++import Spec.Utils (prop_matchesTextShow, prop_genericTextShow, prop_genericTextShow1)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Data.List.NonEmpty ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel . describe "NonEmpty Char" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> NonEmpty Char -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> NonEmpty Char -> Bool)+ prop "generic TextShow1" (prop_genericTextShow1 :: Int -> NonEmpty Char -> Bool)
tests/Spec/Data/SemigroupSpec.hs view
@@ -1,56 +1,56 @@-{-| -Module: Spec.Data.SemigroupSpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for @Semigroup@ data types. --} -module Spec.Data.SemigroupSpec (main, spec) where - -import Data.Semigroup (Min, Max, First, Last, WrappedMonoid, Option, Arg) - -import Instances.Data.Semigroup () - -import Spec.Utils (prop_matchesTextShow, prop_genericTextShow, prop_genericTextShow1) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Data.Semigroup () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "Min Int" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Min Int -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Min Int -> Bool) - prop "generic TextShow1" (prop_genericTextShow1 :: Int -> Min Int -> Bool) - describe "Max Int" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Max Int -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Max Int -> Bool) - prop "generic TextShow1" (prop_genericTextShow1 :: Int -> Max Int -> Bool) - describe "First Int" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> First Int -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> First Int -> Bool) - prop "generic TextShow1" (prop_genericTextShow1 :: Int -> First Int -> Bool) - describe "Last Int" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Last Int -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Last Int -> Bool) - prop "generic TextShow1" (prop_genericTextShow1 :: Int -> Last Int -> Bool) - describe "WrappedMonoid Int" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> WrappedMonoid Int -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> WrappedMonoid Int -> Bool) - prop "generic TextShow1" (prop_genericTextShow1 :: Int -> WrappedMonoid Int -> Bool) - describe "Option Int" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Option Int -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Option Int -> Bool) - prop "generic TextShow1" (prop_genericTextShow1 :: Int -> Option Int -> Bool) - describe "Arg Int Int" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Arg Int Int -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Arg Int Int -> Bool) - prop "generic TextShow1" (prop_genericTextShow1 :: Int -> Arg Int Int -> Bool) +{-|+Module: Spec.Data.SemigroupSpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for @Semigroup@ data types.+-}+module Spec.Data.SemigroupSpec (main, spec) where++import Data.Semigroup (Min, Max, First, Last, WrappedMonoid, Option, Arg)++import Instances.Data.Semigroup ()++import Spec.Utils (prop_matchesTextShow, prop_genericTextShow, prop_genericTextShow1)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Data.Semigroup ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "Min Int" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Min Int -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Min Int -> Bool)+ prop "generic TextShow1" (prop_genericTextShow1 :: Int -> Min Int -> Bool)+ describe "Max Int" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Max Int -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Max Int -> Bool)+ prop "generic TextShow1" (prop_genericTextShow1 :: Int -> Max Int -> Bool)+ describe "First Int" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> First Int -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> First Int -> Bool)+ prop "generic TextShow1" (prop_genericTextShow1 :: Int -> First Int -> Bool)+ describe "Last Int" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Last Int -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Last Int -> Bool)+ prop "generic TextShow1" (prop_genericTextShow1 :: Int -> Last Int -> Bool)+ describe "WrappedMonoid Int" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> WrappedMonoid Int -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> WrappedMonoid Int -> Bool)+ prop "generic TextShow1" (prop_genericTextShow1 :: Int -> WrappedMonoid Int -> Bool)+ describe "Option Int" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Option Int -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Option Int -> Bool)+ prop "generic TextShow1" (prop_genericTextShow1 :: Int -> Option Int -> Bool)+ describe "Arg Int Int" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Arg Int Int -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Arg Int Int -> Bool)+ prop "generic TextShow1" (prop_genericTextShow1 :: Int -> Arg Int Int -> Bool)
tests/Spec/Data/TaggedSpec.hs view
@@ -1,29 +1,29 @@-{-| -Module: Spec.Data.TaggedSpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for 'Tagged' values. --} -module Spec.Data.TaggedSpec (main, spec) where - -import Data.Tagged (Tagged) - -import Instances.Data.Tagged () - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Data.Tagged () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel . describe "Tagged Char Int" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Tagged Char Int -> Bool) +{-|+Module: Spec.Data.TaggedSpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for 'Tagged' values.+-}+module Spec.Data.TaggedSpec (main, spec) where++import Data.Tagged (Tagged)++import Instances.Data.Tagged ()++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Data.Tagged ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel . describe "Tagged Char Int" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Tagged Char Int -> Bool)
tests/Spec/Data/TimeSpec.hs view
@@ -1,48 +1,48 @@-{-| -Module: Spec.Data.TimeSpec -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 @time@ library. --} -module Spec.Data.TimeSpec (main, spec) where - -import Data.Time.Calendar (Day) -import Data.Time.Clock (DiffTime, UTCTime, NominalDiffTime) -import Data.Time.Clock.TAI (AbsoluteTime) -import Data.Time.LocalTime (TimeZone, TimeOfDay, LocalTime, ZonedTime) - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) -import Test.QuickCheck.Instances () - -import TextShow.Data.Time () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "Day" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Day -> Bool) - describe "DiffTime" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> DiffTime -> Bool) - describe "UTCTime" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> UTCTime -> Bool) - describe "NominalDiffTime" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> NominalDiffTime -> Bool) - describe "AbsoluteTime" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> AbsoluteTime -> Bool) - describe "TimeZone" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> TimeZone -> Bool) - describe "TimeOfDay" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> TimeOfDay -> Bool) - describe "LocalTime" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> LocalTime -> Bool) - describe "ZonedTime" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> ZonedTime -> Bool) +{-|+Module: Spec.Data.TimeSpec+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 @time@ library.+-}+module Spec.Data.TimeSpec (main, spec) where++import Data.Time.Calendar (Day)+import Data.Time.Clock (DiffTime, UTCTime, NominalDiffTime)+import Data.Time.Clock.TAI (AbsoluteTime)+import Data.Time.LocalTime (TimeZone, TimeOfDay, LocalTime, ZonedTime)++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)+import Test.QuickCheck.Instances ()++import TextShow.Data.Time ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "Day" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Day -> Bool)+ describe "DiffTime" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> DiffTime -> Bool)+ describe "UTCTime" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> UTCTime -> Bool)+ describe "NominalDiffTime" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> NominalDiffTime -> Bool)+ describe "AbsoluteTime" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> AbsoluteTime -> Bool)+ describe "TimeZone" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TimeZone -> Bool)+ describe "TimeOfDay" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TimeOfDay -> Bool)+ describe "LocalTime" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> LocalTime -> Bool)+ describe "ZonedTime" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ZonedTime -> Bool)
tests/Spec/Data/UnorderedContainersSpec.hs view
@@ -1,32 +1,32 @@-{-| -Module: Spec.Data.UnorderedContainersSpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for 'HashMap's and 'HashSet's. --} -module Spec.Data.UnorderedContainersSpec (main, spec) where - -import Data.HashMap.Lazy (HashMap) -import Data.HashSet (HashSet) - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) -import Test.QuickCheck.Instances () - -import TextShow.Data.UnorderedContainers () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "HashMap Char Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> HashMap Char Char -> Bool) - describe "HashSet Char" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> HashSet Char -> Bool) +{-|+Module: Spec.Data.UnorderedContainersSpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for 'HashMap's and 'HashSet's.+-}+module Spec.Data.UnorderedContainersSpec (main, spec) where++import Data.HashMap.Lazy (HashMap)+import Data.HashSet (HashSet)++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)+import Test.QuickCheck.Instances ()++import TextShow.Data.UnorderedContainers ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "HashMap Char Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> HashMap Char Char -> Bool)+ describe "HashSet Char" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> HashSet Char -> Bool)
tests/Spec/Language/Haskell/THSpec.hs view
@@ -1,187 +1,187 @@-{-# LANGUAGE CPP #-} -{-| -Module: Spec.Language.Haskell.THSpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@QuickCheck@ properties for data types in the @template-haskell@ library. --} -module Spec.Language.Haskell.THSpec (main, spec) where - -import Instances.Language.Haskell.TH () - -import Language.Haskell.TH.Instances () -import Language.Haskell.TH.PprLib -import Language.Haskell.TH.Syntax - -import Spec.Utils (prop_matchesTextShow, prop_genericTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow (fromString) -import TextShow.Language.Haskell.TH (showbName') - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do -#if MIN_VERSION_template_haskell(2,9,0) - describe "AnnLookup" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> AnnLookup -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> AnnLookup -> Bool) - describe "AnnTarget" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> AnnTarget -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> AnnTarget -> Bool) -#endif - describe "Body" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Body -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Body -> Bool) - describe "Callconv" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Callconv -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Callconv -> Bool) -#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0)) - describe "ClassInstance" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> ClassInstance -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> ClassInstance -> Bool) -#endif - describe "Clause" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Clause -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Clause -> Bool) - describe "Con" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Con -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Con -> Bool) - describe "Dec" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Dec -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Dec -> Bool) - describe "Doc" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Doc -> Bool) - describe "Exp" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Exp -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Exp -> Bool) - describe "FamFlavour" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> FamFlavour -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> FamFlavour -> Bool) - describe "Fixity" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Fixity -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Fixity -> Bool) - describe "FixityDirection" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> FixityDirection -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> FixityDirection -> Bool) - describe "Foreign" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Foreign -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Foreign -> Bool) - describe "FunDep" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> FunDep -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> FunDep -> Bool) - describe "Guard" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Guard -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Guard -> Bool) - describe "Info" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Info -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Info -> Bool) -#if MIN_VERSION_template_haskell(2,8,0) - describe "Inline" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Inline -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Inline -> Bool) -#else - describe "InlineSpec" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> InlineSpec -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> InlineSpec -> Bool) -#endif - describe "Kind" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Kind -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Kind -> Bool) - describe "Lit" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Lit -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Lit -> Bool) - describe "Loc" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Loc -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Loc -> Bool) - describe "Match" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Match -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Match -> Bool) - describe "ModName" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> ModName -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> ModName -> Bool) -#if MIN_VERSION_template_haskell(2,9,0) - describe "Module" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Module -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Module -> Bool) - describe "ModuleInfo" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> ModuleInfo -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> ModuleInfo -> Bool) -#endif - describe "Name" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Name -> Bool) - describe "showbName'" $ do - prop "has the same output as showName" prop_showName' - describe "OccName" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> OccName -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> OccName -> Bool) - describe "Pat" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Pat -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Pat -> Bool) -#if MIN_VERSION_template_haskell(2,8,0) - describe "Phases" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Phases -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Phases -> Bool) -#endif - describe "PkgName" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> PkgName -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> PkgName -> Bool) - describe "Pred" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Pred -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Pred -> Bool) - describe "Pragma" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Pragma -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Pragma -> Bool) - describe "Range" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Range -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Range -> Bool) -#if MIN_VERSION_template_haskell(2,9,0) - describe "Role" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Role -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Role -> Bool) -#endif -#if MIN_VERSION_template_haskell(2,8,0) - describe "RuleBndr" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> RuleBndr -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> RuleBndr -> Bool) - describe "RuleMatch" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> RuleMatch -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> RuleMatch -> Bool) -#endif - describe "Safety" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Safety -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Safety -> Bool) - describe "Stmt" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Stmt -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Stmt -> Bool) - describe "Strict" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Strict -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Strict -> Bool) -#if MIN_VERSION_template_haskell(2,8,0) - describe "TyLit" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> TyLit -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> TyLit -> Bool) -#endif - describe "Type" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Type -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> Type -> Bool) -#if MIN_VERSION_template_haskell(2,9,0) - describe "TySynEqn" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> TySynEqn -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> TySynEqn -> Bool) -#endif - describe "TyVarBndr" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> TyVarBndr -> Bool) - prop "generic TextShow" (prop_genericTextShow :: Int -> TyVarBndr -> Bool) - --- | Verifies that `showName'` and `showbName'` have the same output. -prop_showName' :: NameIs -> Name -> Bool -prop_showName' nameIs name = fromString (showName' nameIs name) == showbName' nameIs name +{-# LANGUAGE CPP #-}+{-|+Module: Spec.Language.Haskell.THSpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@QuickCheck@ properties for data types in the @template-haskell@ library.+-}+module Spec.Language.Haskell.THSpec (main, spec) where++import Instances.Language.Haskell.TH ()++import Language.Haskell.TH.Instances ()+import Language.Haskell.TH.PprLib+import Language.Haskell.TH.Syntax++import Spec.Utils (prop_matchesTextShow, prop_genericTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow (fromString)+import TextShow.Language.Haskell.TH (showbName')++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+#if MIN_VERSION_template_haskell(2,9,0)+ describe "AnnLookup" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> AnnLookup -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> AnnLookup -> Bool)+ describe "AnnTarget" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> AnnTarget -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> AnnTarget -> Bool)+#endif+ describe "Body" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Body -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Body -> Bool)+ describe "Callconv" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Callconv -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Callconv -> Bool)+#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0))+ describe "ClassInstance" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ClassInstance -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> ClassInstance -> Bool)+#endif+ describe "Clause" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Clause -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Clause -> Bool)+ describe "Con" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Con -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Con -> Bool)+ describe "Dec" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Dec -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Dec -> Bool)+ describe "Doc" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Doc -> Bool)+ describe "Exp" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Exp -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Exp -> Bool)+ describe "FamFlavour" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> FamFlavour -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> FamFlavour -> Bool)+ describe "Fixity" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Fixity -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Fixity -> Bool)+ describe "FixityDirection" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> FixityDirection -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> FixityDirection -> Bool)+ describe "Foreign" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Foreign -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Foreign -> Bool)+ describe "FunDep" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> FunDep -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> FunDep -> Bool)+ describe "Guard" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Guard -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Guard -> Bool)+ describe "Info" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Info -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Info -> Bool)+#if MIN_VERSION_template_haskell(2,8,0)+ describe "Inline" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Inline -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Inline -> Bool)+#else+ describe "InlineSpec" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> InlineSpec -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> InlineSpec -> Bool)+#endif+ describe "Kind" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Kind -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Kind -> Bool)+ describe "Lit" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Lit -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Lit -> Bool)+ describe "Loc" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Loc -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Loc -> Bool)+ describe "Match" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Match -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Match -> Bool)+ describe "ModName" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ModName -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> ModName -> Bool)+#if MIN_VERSION_template_haskell(2,9,0)+ describe "Module" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Module -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Module -> Bool)+ describe "ModuleInfo" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ModuleInfo -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> ModuleInfo -> Bool)+#endif+ describe "Name" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Name -> Bool)+ describe "showbName'" $ do+ prop "has the same output as showName" prop_showName'+ describe "OccName" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> OccName -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> OccName -> Bool)+ describe "Pat" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Pat -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Pat -> Bool)+#if MIN_VERSION_template_haskell(2,8,0)+ describe "Phases" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Phases -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Phases -> Bool)+#endif+ describe "PkgName" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> PkgName -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> PkgName -> Bool)+ describe "Pred" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Pred -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Pred -> Bool)+ describe "Pragma" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Pragma -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Pragma -> Bool)+ describe "Range" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Range -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Range -> Bool)+#if MIN_VERSION_template_haskell(2,9,0)+ describe "Role" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Role -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Role -> Bool)+#endif+#if MIN_VERSION_template_haskell(2,8,0)+ describe "RuleBndr" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> RuleBndr -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> RuleBndr -> Bool)+ describe "RuleMatch" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> RuleMatch -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> RuleMatch -> Bool)+#endif+ describe "Safety" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Safety -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Safety -> Bool)+ describe "Stmt" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Stmt -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Stmt -> Bool)+ describe "Strict" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Strict -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Strict -> Bool)+#if MIN_VERSION_template_haskell(2,8,0)+ describe "TyLit" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TyLit -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> TyLit -> Bool)+#endif+ describe "Type" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Type -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Type -> Bool)+#if MIN_VERSION_template_haskell(2,9,0)+ describe "TySynEqn" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TySynEqn -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> TySynEqn -> Bool)+#endif+ describe "TyVarBndr" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TyVarBndr -> Bool)+ prop "generic TextShow" (prop_genericTextShow :: Int -> TyVarBndr -> Bool)++-- | Verifies that `showName'` and `showbName'` have the same output.+prop_showName' :: NameIs -> Name -> Bool+prop_showName' nameIs name = fromString (showName' nameIs name) == showbName' nameIs name
tests/Spec/System/Console/HaskelineSpec.hs view
@@ -1,41 +1,41 @@-{-| -Module: Spec.System.Console.HaskelineSpec -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 @haskeline@ library. --} -module Spec.System.Console.HaskelineSpec (main, spec) where - -import Instances.System.Console.Haskeline () - -import Spec.Utils (prop_matchesTextShow) - -import System.Console.Haskeline (Interrupt, defaultPrefs) -import System.Console.Haskeline.Completion (Completion) -import System.Console.Haskeline.History (History) - -import Test.Hspec (Spec, describe, hspec, it, parallel, shouldBe) -import Test.Hspec.QuickCheck (prop) - -import TextShow (FromStringShow(..), showb) -import TextShow.System.Console.Haskeline () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "Interrupt" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Interrupt -> Bool) --- describe "Prefs" $ --- prop "TextShow instance" (prop_matchesTextShow :: Int -> Prefs -> Bool) - describe "defaultPrefs" $ - it "should have coinciding string and text Show output" $ showb (FromStringShow defaultPrefs) `shouldBe` showb defaultPrefs - describe "Completion" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Completion -> Bool) - describe "History" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> History -> Bool) +{-|+Module: Spec.System.Console.HaskelineSpec+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 @haskeline@ library.+-}+module Spec.System.Console.HaskelineSpec (main, spec) where++import Instances.System.Console.Haskeline ()++import Spec.Utils (prop_matchesTextShow)++import System.Console.Haskeline (Interrupt, defaultPrefs)+import System.Console.Haskeline.Completion (Completion)+import System.Console.Haskeline.History (History)++import Test.Hspec (Spec, describe, hspec, it, parallel, shouldBe)+import Test.Hspec.QuickCheck (prop)++import TextShow (FromStringShow(..), showb)+import TextShow.System.Console.Haskeline ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "Interrupt" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Interrupt -> Bool)+-- describe "Prefs" $+-- prop "TextShow instance" (prop_matchesTextShow :: Int -> Prefs -> Bool)+ describe "defaultPrefs" $+ it "should have coinciding string and text Show output" $ showb (FromStringShow defaultPrefs) `shouldBe` showb defaultPrefs+ describe "Completion" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Completion -> Bool)+ describe "History" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> History -> Bool)
tests/Spec/System/Console/TerminfoSpec.hs view
@@ -1,44 +1,44 @@-{-# LANGUAGE CPP #-} -{-| -Module: Spec.System.Console.TerminfoSpec -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 @terminfo@ library. --} -module Spec.System.Console.TerminfoSpec (main, spec) where - -import Prelude () -import Prelude.Compat - -import Test.Hspec (Spec, hspec, parallel) - -#if !defined(mingw32_HOST_OS) -import Instances.System.Console.Terminfo () - -import Spec.Utils (prop_matchesTextShow) - -import System.Console.Terminfo.Color (Color) - -import Test.Hspec (describe) -import Test.Hspec.QuickCheck (prop) - -import TextShow.System.Console.Terminfo () -#endif - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do -#if !defined(mingw32_HOST_OS) - describe "Color" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Color -> Bool) --- describe "SetupTermError" $ --- prop "TextShow instance" (prop_matchesTextShow :: Int -> SetupTermError -> Bool) -#else - pure () -#endif +{-# LANGUAGE CPP #-}+{-|+Module: Spec.System.Console.TerminfoSpec+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 @terminfo@ library.+-}+module Spec.System.Console.TerminfoSpec (main, spec) where++import Prelude ()+import Prelude.Compat++import Test.Hspec (Spec, hspec, parallel)++#if !defined(mingw32_HOST_OS)+import Instances.System.Console.Terminfo ()++import Spec.Utils (prop_matchesTextShow)++import System.Console.Terminfo.Color (Color)++import Test.Hspec (describe)+import Test.Hspec.QuickCheck (prop)++import TextShow.System.Console.Terminfo ()+#endif++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+#if !defined(mingw32_HOST_OS)+ describe "Color" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Color -> Bool)+-- describe "SetupTermError" $+-- prop "TextShow instance" (prop_matchesTextShow :: Int -> SetupTermError -> Bool)+#else+ pure ()+#endif
tests/Spec/System/DirectorySpec.hs view
@@ -1,42 +1,42 @@-{-# LANGUAGE CPP #-} -{-| -Module: Spec.System.DirectorySpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for 'Permissions'. --} -module Spec.System.DirectorySpec (main, spec) where - -import Prelude () -import Prelude.Compat - -import Test.Hspec (Spec, hspec, parallel) - -#if MIN_VERSION_directory(1,1,0) -import Instances.System.Directory () - -import Spec.Utils (prop_matchesTextShow) - -import System.Directory (Permissions) - -import Test.Hspec (describe) -import Test.Hspec.QuickCheck (prop) - -import TextShow.System.Directory () -#endif - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ -#if MIN_VERSION_directory(1,1,0) - describe "Permissions" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Permissions -> Bool) -#else - pure () -#endif +{-# LANGUAGE CPP #-}+{-|+Module: Spec.System.DirectorySpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for 'Permissions'.+-}+module Spec.System.DirectorySpec (main, spec) where++import Prelude ()+import Prelude.Compat++import Test.Hspec (Spec, hspec, parallel)++#if MIN_VERSION_directory(1,1,0)+import Instances.System.Directory ()++import Spec.Utils (prop_matchesTextShow)++import System.Directory (Permissions)++import Test.Hspec (describe)+import Test.Hspec.QuickCheck (prop)++import TextShow.System.Directory ()+#endif++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $+#if MIN_VERSION_directory(1,1,0)+ describe "Permissions" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Permissions -> Bool)+#else+ pure ()+#endif
tests/Spec/System/LocaleSpec.hs view
@@ -1,29 +1,29 @@-{-| -Module: Spec.System.LocaleSpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for old 'TimeLocale's. --} -module Spec.System.LocaleSpec (main, spec) where - -import Instances.System.Locale () - -import Spec.Utils (prop_matchesTextShow) - -import System.Locale (TimeLocale) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.System.Locale () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel . describe "TimeLocale" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> TimeLocale -> Bool) +{-|+Module: Spec.System.LocaleSpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for old 'TimeLocale's.+-}+module Spec.System.LocaleSpec (main, spec) where++import Instances.System.Locale ()++import Spec.Utils (prop_matchesTextShow)++import System.Locale (TimeLocale)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.System.Locale ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel . describe "TimeLocale" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TimeLocale -> Bool)
tests/Spec/System/PosixSpec.hs view
@@ -1,52 +1,52 @@-{-# LANGUAGE CPP #-} -{-| -Module: Spec.System.PosixSpec -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 @unix@ library. --} -module Spec.System.PosixSpec (main, spec) where - -import Prelude () -import Prelude.Compat - -import Test.Hspec (Spec, hspec, parallel) - -#if !defined(mingw32_HOST_OS) -import Instances.System.Posix () - -import Spec.Utils (prop_matchesTextShow) - -import System.Posix.DynamicLinker (RTLDFlags, DL) -import System.Posix.Process (ProcessStatus) -import System.Posix.User (GroupEntry, UserEntry) - -import Test.Hspec (describe) -import Test.Hspec.QuickCheck (prop) - -import TextShow.System.Posix () -#endif - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do -#if !defined(mingw32_HOST_OS) - describe "RTLDFlags" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> RTLDFlags -> Bool) - describe "DL" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> DL -> Bool) - describe "ProcessStatus" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> ProcessStatus -> Bool) - describe "GroupEntry" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> GroupEntry -> Bool) - describe "UserEntry" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> UserEntry -> Bool) -#else - pure () -#endif +{-# LANGUAGE CPP #-}+{-|+Module: Spec.System.PosixSpec+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 @unix@ library.+-}+module Spec.System.PosixSpec (main, spec) where++import Prelude ()+import Prelude.Compat++import Test.Hspec (Spec, hspec, parallel)++#if !defined(mingw32_HOST_OS)+import Instances.System.Posix ()++import Spec.Utils (prop_matchesTextShow)++import System.Posix.DynamicLinker (RTLDFlags, DL)+import System.Posix.Process (ProcessStatus)+import System.Posix.User (GroupEntry, UserEntry)++import Test.Hspec (describe)+import Test.Hspec.QuickCheck (prop)++import TextShow.System.Posix ()+#endif++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+#if !defined(mingw32_HOST_OS)+ describe "RTLDFlags" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> RTLDFlags -> Bool)+ describe "DL" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> DL -> Bool)+ describe "ProcessStatus" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ProcessStatus -> Bool)+ describe "GroupEntry" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> GroupEntry -> Bool)+ describe "UserEntry" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> UserEntry -> Bool)+#else+ pure ()+#endif
tests/Spec/System/RandomSpec.hs view
@@ -1,29 +1,29 @@-{-| -Module: Spec.System.RandomSpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@hspec@ tests for 'StdGen' values. --} -module Spec.System.RandomSpec (main, spec) where - -import Instances.System.Random () - -import Spec.Utils (prop_matchesTextShow) - -import System.Random (StdGen) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.System.Random () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel . describe "StdGen" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> StdGen -> Bool) +{-|+Module: Spec.System.RandomSpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@hspec@ tests for 'StdGen' values.+-}+module Spec.System.RandomSpec (main, spec) where++import Instances.System.Random ()++import Spec.Utils (prop_matchesTextShow)++import System.Random (StdGen)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.System.Random ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel . describe "StdGen" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> StdGen -> Bool)
tests/Spec/System/TimeSpec.hs view
@@ -1,37 +1,37 @@-{-| -Module: Spec.System.TimeSpec -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Provisional -Portability: GHC - -@QuickCheck@ properties for data types in @old-time@. --} -module Spec.System.TimeSpec (main, spec) where - -import Spec.Utils (prop_matchesTextShow) - -import System.Time (ClockTime, TimeDiff, CalendarTime, Month, Day) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) -import Test.QuickCheck.Instances () - -import TextShow.System.Time () - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "ClockTime" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> ClockTime -> Bool) - describe "TimeDiff" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> TimeDiff -> Bool) - describe "CalendarTime" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> CalendarTime -> Bool) - describe "Month" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Month -> Bool) - describe "Day" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Day -> Bool) +{-|+Module: Spec.System.TimeSpec+Copyright: (C) 2014-2015 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Stability: Provisional+Portability: GHC++@QuickCheck@ properties for data types in @old-time@.+-}+module Spec.System.TimeSpec (main, spec) where++import Spec.Utils (prop_matchesTextShow)++import System.Time (ClockTime, TimeDiff, CalendarTime, Month, Day)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)+import Test.QuickCheck.Instances ()++import TextShow.System.Time ()++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "ClockTime" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ClockTime -> Bool)+ describe "TimeDiff" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TimeDiff -> Bool)+ describe "CalendarTime" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> CalendarTime -> Bool)+ describe "Month" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Month -> Bool)+ describe "Day" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Day -> Bool)
tests/Spec/System/Win32Spec.hs view
@@ -1,63 +1,63 @@-{-# LANGUAGE CPP #-} -{-| -Module: Spec.System.Win32Spec -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 @Win32@ library. --} -module Spec.System.Win32Spec (main, spec) where - -import Prelude () -import Prelude.Compat - -import Test.Hspec (Spec, hspec, parallel) - -#if defined(mingw32_HOST_OS) -import Instances.System.Win32 () - -import Spec.Utils (prop_matchesTextShow) - -import System.Win32.DebugApi (DebugEventInfo, Exception) -import System.Win32.File (BY_HANDLE_FILE_INFORMATION, WIN32_FILE_ATTRIBUTE_DATA) -import System.Win32.Info (ProcessorArchitecture, SYSTEM_INFO) -import System.Win32.Time (FILETIME, SYSTEMTIME, TIME_ZONE_INFORMATION, TimeZoneId) - -import Test.Hspec (describe) -import Test.Hspec.QuickCheck (prop) - -import TextShow.System.Win32 () -#endif - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do -#if defined(mingw32_HOST_OS) - describe "DebugEventInfo" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> DebugEventInfo -> Bool) - describe "Exception" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Exception -> Bool) - describe "BY_HANDLE_FILE_INFORMATION" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> BY_HANDLE_FILE_INFORMATION -> Bool) - describe "WIN32_FILE_ATTRIBUTE_DATA" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> WIN32_FILE_ATTRIBUTE_DATA -> Bool) - describe "ProcessorArchitecture" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> ProcessorArchitecture -> Bool) - describe "SYSTEM_INFO" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> SYSTEM_INFO -> Bool) - describe "FILETIME" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> FILETIME -> Bool) - describe "SYSTEMTIME" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> SYSTEMTIME -> Bool) - describe "TIME_ZONE_INFORMATION" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> TIME_ZONE_INFORMATION -> Bool) - describe "TimeZoneId" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> TimeZoneId -> Bool) -#else - pure () -#endif +{-# LANGUAGE CPP #-}+{-|+Module: Spec.System.Win32Spec+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 @Win32@ library.+-}+module Spec.System.Win32Spec (main, spec) where++import Prelude ()+import Prelude.Compat++import Test.Hspec (Spec, hspec, parallel)++#if defined(mingw32_HOST_OS)+import Instances.System.Win32 ()++import Spec.Utils (prop_matchesTextShow)++import System.Win32.DebugApi (DebugEventInfo, Exception)+import System.Win32.File (BY_HANDLE_FILE_INFORMATION, WIN32_FILE_ATTRIBUTE_DATA)+import System.Win32.Info (ProcessorArchitecture, SYSTEM_INFO)+import System.Win32.Time (FILETIME, SYSTEMTIME, TIME_ZONE_INFORMATION, TimeZoneId)++import Test.Hspec (describe)+import Test.Hspec.QuickCheck (prop)++import TextShow.System.Win32 ()+#endif++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+#if defined(mingw32_HOST_OS)+ describe "DebugEventInfo" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> DebugEventInfo -> Bool)+ describe "Exception" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Exception -> Bool)+ describe "BY_HANDLE_FILE_INFORMATION" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> BY_HANDLE_FILE_INFORMATION -> Bool)+ describe "WIN32_FILE_ATTRIBUTE_DATA" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> WIN32_FILE_ATTRIBUTE_DATA -> Bool)+ describe "ProcessorArchitecture" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> ProcessorArchitecture -> Bool)+ describe "SYSTEM_INFO" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> SYSTEM_INFO -> Bool)+ describe "FILETIME" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> FILETIME -> Bool)+ describe "SYSTEMTIME" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> SYSTEMTIME -> Bool)+ describe "TIME_ZONE_INFORMATION" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TIME_ZONE_INFORMATION -> Bool)+ describe "TimeZoneId" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TimeZoneId -> Bool)+#else+ pure ()+#endif
tests/Spec/Text/PrettyPrintSpec.hs view
@@ -1,63 +1,63 @@-{-# LANGUAGE CPP #-} -{-| -Module: Spec.Text.PrettyPrintSpec -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 @pretty@ library. --} -module Spec.Text.PrettyPrintSpec (main, spec) where - -import Instances.Text.PrettyPrint () - -import Spec.Utils (prop_matchesTextShow) -#if MIN_VERSION_pretty(1,1,2) -import Spec.Utils (prop_genericTextShow) -#endif - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import Text.PrettyPrint.HughesPJ (Doc, Mode, Style, TextDetails {-, renderStyle -}) -#if MIN_VERSION_pretty(1,1,2) -import Text.PrettyPrint.HughesPJClass (PrettyLevel) -#endif --- import TextShow (fromString) -import TextShow.Text.PrettyPrint () -- (renderStyleB) - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "Doc" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Doc -> Bool) - -- TODO: Figure out why this randomly stalls forever --- describe "renderStyleB" $ do --- prop "has the same output as renderStyle" prop_renderStyle - describe "Mode" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Mode -> Bool) -#if MIN_VERSION_pretty(1,1,2) - prop "generic TextShow" (prop_genericTextShow :: Int -> Mode -> Bool) -#endif - describe "Style" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> Style -> Bool) -#if MIN_VERSION_pretty(1,1,2) - prop "generic TextShow" (prop_genericTextShow :: Int -> Style -> Bool) -#endif - describe "TextDetails" $ do - prop "TextShow instance" (prop_matchesTextShow :: Int -> TextDetails -> Bool) -#if MIN_VERSION_pretty(1,1,2) - prop "generic TextShow" (prop_genericTextShow :: Int -> TextDetails -> Bool) -#endif -#if MIN_VERSION_pretty(1,1,2) - describe "PrettyLevel" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> PrettyLevel -> Bool) -#endif - --- | Verifies that the output of 'renderStyle' and 'renderStyleB' coincides. --- prop_renderStyle :: Style -> Doc -> Bool --- prop_renderStyle sty doc = fromString (renderStyle sty doc) == renderStyleB sty doc +{-# LANGUAGE CPP #-}+{-|+Module: Spec.Text.PrettyPrintSpec+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 @pretty@ library.+-}+module Spec.Text.PrettyPrintSpec (main, spec) where++import Instances.Text.PrettyPrint ()++import Spec.Utils (prop_matchesTextShow)+#if MIN_VERSION_pretty(1,1,2)+import Spec.Utils (prop_genericTextShow)+#endif++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import Text.PrettyPrint.HughesPJ (Doc, Mode, Style, TextDetails {-, renderStyle -})+#if MIN_VERSION_pretty(1,1,2)+import Text.PrettyPrint.HughesPJClass (PrettyLevel)+#endif+-- import TextShow (fromString)+import TextShow.Text.PrettyPrint () -- (renderStyleB)++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "Doc" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Doc -> Bool)+ -- TODO: Figure out why this randomly stalls forever+-- describe "renderStyleB" $ do+-- prop "has the same output as renderStyle" prop_renderStyle+ describe "Mode" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Mode -> Bool)+#if MIN_VERSION_pretty(1,1,2)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Mode -> Bool)+#endif+ describe "Style" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Style -> Bool)+#if MIN_VERSION_pretty(1,1,2)+ prop "generic TextShow" (prop_genericTextShow :: Int -> Style -> Bool)+#endif+ describe "TextDetails" $ do+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TextDetails -> Bool)+#if MIN_VERSION_pretty(1,1,2)+ prop "generic TextShow" (prop_genericTextShow :: Int -> TextDetails -> Bool)+#endif+#if MIN_VERSION_pretty(1,1,2)+ describe "PrettyLevel" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> PrettyLevel -> Bool)+#endif++-- | Verifies that the output of 'renderStyle' and 'renderStyleB' coincides.+-- prop_renderStyle :: Style -> Doc -> Bool+-- prop_renderStyle sty doc = fromString (renderStyle sty doc) == renderStyleB sty doc
tests/Spec/Text/XHtmlSpec.hs view
@@ -1,38 +1,38 @@-{-| -Module: Spec.Text.XHtmlSpec -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 @xhtml@ library. --} -module Spec.Text.XHtmlSpec (main, spec) where - -import Instances.Text.XHtml () - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Text.XHtml () -import Text.XHtml.Frameset (Html, HtmlAttr, HotLink) -import Text.XHtml.Table (HtmlTable) - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "Html" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Html -> Bool) - describe "[Html]" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> [Html] -> Bool) - describe "HtmlAttr" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> HtmlAttr -> Bool) - describe "HotLink" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> HotLink -> Bool) - describe "HtmlTable" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> HtmlTable -> Bool) +{-|+Module: Spec.Text.XHtmlSpec+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 @xhtml@ library.+-}+module Spec.Text.XHtmlSpec (main, spec) where++import Instances.Text.XHtml ()++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Text.XHtml ()+import Text.XHtml.Frameset (Html, HtmlAttr, HotLink)+import Text.XHtml.Table (HtmlTable)++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "Html" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Html -> Bool)+ describe "[Html]" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> [Html] -> Bool)+ describe "HtmlAttr" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> HtmlAttr -> Bool)+ describe "HotLink" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> HotLink -> Bool)+ describe "HtmlTable" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> HtmlTable -> Bool)
tests/Spec/Trace/HpcSpec.hs view
@@ -1,44 +1,44 @@-{-| -Module: Spec.Trace.HpcSpec -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 @hpc@ library. --} -module Spec.Trace.HpcSpec (main, spec) where - -import Instances.Trace.Hpc () - -import Spec.Utils (prop_matchesTextShow) - -import Test.Hspec (Spec, describe, hspec, parallel) -import Test.Hspec.QuickCheck (prop) - -import TextShow.Trace.Hpc () - -import Trace.Hpc.Mix (Mix, BoxLabel, CondBox) -import Trace.Hpc.Tix (Tix, TixModule) -import Trace.Hpc.Util (HpcPos, Hash) - -main :: IO () -main = hspec spec - -spec :: Spec -spec = parallel $ do - describe "Mix" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Mix -> Bool) - describe "BoxLabel" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> BoxLabel -> Bool) - describe "CondBox" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> CondBox -> Bool) - describe "Tix" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Tix -> Bool) - describe "TixModule" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> TixModule -> Bool) - describe "HpcPos" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> HpcPos -> Bool) - describe "Hash" $ - prop "TextShow instance" (prop_matchesTextShow :: Int -> Hash -> Bool) +{-|+Module: Spec.Trace.HpcSpec+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 @hpc@ library.+-}+module Spec.Trace.HpcSpec (main, spec) where++import Instances.Trace.Hpc ()++import Spec.Utils (prop_matchesTextShow)++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.Hspec.QuickCheck (prop)++import TextShow.Trace.Hpc ()++import Trace.Hpc.Mix (Mix, BoxLabel, CondBox)+import Trace.Hpc.Tix (Tix, TixModule)+import Trace.Hpc.Util (HpcPos, Hash)++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ do+ describe "Mix" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Mix -> Bool)+ describe "BoxLabel" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> BoxLabel -> Bool)+ describe "CondBox" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> CondBox -> Bool)+ describe "Tix" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Tix -> Bool)+ describe "TixModule" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> TixModule -> Bool)+ describe "HpcPos" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> HpcPos -> Bool)+ describe "Hash" $+ prop "TextShow instance" (prop_matchesTextShow :: Int -> Hash -> Bool)
tests/Spec/Utils.hs view
@@ -1,66 +1,66 @@-{-# 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 - -@QuickCheck@ property-related utility functions. --} -module Spec.Utils ( - prop_matchesTextShow - , prop_genericTextShow - , prop_genericTextShow1 - ) where - -#if __GLASGOW_HASKELL__ >= 704 -import GHC.Generics (Generic, Rep) -# if __GLASGOW_HASKELL__ >= 706 -import GHC.Generics (Generic1, Rep1) -# endif -import TextShow.Generic -#endif - -import TextShow (TextShow(..), FromStringShow(..)) -#if __GLASGOW_HASKELL__ >= 706 -import TextShow (TextShow1(..), Builder) -#endif - --- | Verifies that a type's @Show@ instances coincide for both 'String's and 'Text', --- irrespective of precedence. -prop_matchesTextShow :: (Show a, TextShow a) => Int -> a -> Bool -prop_matchesTextShow p x = showbPrec p (FromStringShow x) == showbPrec p x - --- | Verifies that a type's 'TextShow' instance coincides with the output produced --- by the equivalent 'Generic' functions. -#if __GLASGOW_HASKELL__ >= 704 -prop_genericTextShow :: (TextShow a, Generic a, GTextShow (Rep a)) - => Int -> a -> Bool -prop_genericTextShow p x = showbPrec p x == genericShowbPrec p x -#else -prop_genericTextShow :: Int -> a -> Bool -prop_genericTextShow _ _ = True -#endif - --- | Verifies that a type's 'TextShow1' instance coincides with the output produced --- by the equivalent 'Generic1' functions. -#if __GLASGOW_HASKELL__ >= 706 -prop_genericTextShow1 :: (TextShow1 f, Generic1 f, GTextShow1 (Rep1 f)) - => Int -> f a -> Bool -prop_genericTextShow1 p x = showbPrecWith showb27Prec p x - == genericShowbPrecWith showb27Prec p x -#else -prop_genericTextShow1 :: Int -> f a -> Bool -prop_genericTextShow1 _ _ = True -#endif - -#if __GLASGOW_HASKELL__ >= 706 --- | Show the number 27, which certain parody singer-songwriters find humorous. --- Useful for testing higher-order 'TextShow' classes. -showb27Prec :: Int -> a -> Builder -showb27Prec p _ = showbPrec p $ Just (27 :: Int) -#endif +{-# 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++@QuickCheck@ property-related utility functions.+-}+module Spec.Utils (+ prop_matchesTextShow+ , prop_genericTextShow+ , prop_genericTextShow1+ ) where++#if __GLASGOW_HASKELL__ >= 704+import GHC.Generics (Generic, Rep)+# if __GLASGOW_HASKELL__ >= 706+import GHC.Generics (Generic1, Rep1)+# endif+import TextShow.Generic+#endif++import TextShow (TextShow(..), FromStringShow(..))+#if __GLASGOW_HASKELL__ >= 706+import TextShow (TextShow1(..), Builder)+#endif++-- | Verifies that a type's @Show@ instances coincide for both 'String's and 'Text',+-- irrespective of precedence.+prop_matchesTextShow :: (Show a, TextShow a) => Int -> a -> Bool+prop_matchesTextShow p x = showbPrec p (FromStringShow x) == showbPrec p x++-- | Verifies that a type's 'TextShow' instance coincides with the output produced+-- by the equivalent 'Generic' functions.+#if __GLASGOW_HASKELL__ >= 704+prop_genericTextShow :: (TextShow a, Generic a, GTextShow (Rep a))+ => Int -> a -> Bool+prop_genericTextShow p x = showbPrec p x == genericShowbPrec p x+#else+prop_genericTextShow :: Int -> a -> Bool+prop_genericTextShow _ _ = True+#endif++-- | Verifies that a type's 'TextShow1' instance coincides with the output produced+-- by the equivalent 'Generic1' functions.+#if __GLASGOW_HASKELL__ >= 706+prop_genericTextShow1 :: (TextShow1 f, Generic1 f, GTextShow1 (Rep1 f))+ => Int -> f a -> Bool+prop_genericTextShow1 p x = showbPrecWith showb27Prec p x+ == genericShowbPrecWith showb27Prec p x+#else+prop_genericTextShow1 :: Int -> f a -> Bool+prop_genericTextShow1 _ _ = True+#endif++#if __GLASGOW_HASKELL__ >= 706+-- | Show the number 27, which certain parody singer-songwriters find humorous.+-- Useful for testing higher-order 'TextShow' classes.+showb27Prec :: Int -> a -> Builder+showb27Prec p _ = showbPrec p $ Just (27 :: Int)+#endif
text-show-instances.cabal view
@@ -1,245 +1,245 @@-name: text-show-instances -version: 2 -synopsis: Additional instances for text-show -description: @text-show-instances@ is a supplemental library to @text-show@ - that provides additional @Show@ instances for data types in - common Haskell libraries and GHC dependencies that are not - encompassed by @text-show@. Currently, @text-show-instances@ - covers these libraries: - . - * @<http://hackage.haskell.org/package/bifunctors bifunctors>@ - . - * @<http://hackage.haskell.org/package/binary binary>@ - . - * @<http://hackage.haskell.org/package/containers containers>@ - . - * @<http://hackage.haskell.org/package/directory directory>@ - . - * @<http://hackage.haskell.org/package/haskeline haskeline>@ - . - * @<http://hackage.haskell.org/package/hoopl hoopl>@ - . - * @<http://hackage.haskell.org/package/hpc hpc>@ - . - * @<http://hackage.haskell.org/package/old-locale old-locale>@ - . - * @<http://hackage.haskell.org/package/old-time old-time>@ - . - * @<http://hackage.haskell.org/package/pretty pretty>@ - . - * @<http://hackage.haskell.org/package/random random>@ - . - * @<http://hackage.haskell.org/package/semigroups semigroups>@ - . - * @<http://hackage.haskell.org/package/tagged tagged>@ - . - * @<http://hackage.haskell.org/package/template-haskell template-haskell>@ - . - * @<http://hackage.haskell.org/package/terminfo terminfo>@ - . - * @<http://hackage.haskell.org/package/time time>@ - . - * @<http://hackage.haskell.org/package/transformers transformers>@ - . - * @<http://hackage.haskell.org/package/unix unix>@ - . - * @<http://hackage.haskell.org/package/unordered-containers unordered-containers>@ - . - * @<http://hackage.haskell.org/package/vector vector>@ - . - * @<http://hackage.haskell.org/package/Win32 Win32>@ - . - * @<http://hackage.haskell.org/package/xhtml xhtml>@ - . - One can use these instances by importing - "TextShow.Instances". Alternatively, there are monomorphic - versions of the @showb@ function available in the other submodules - of "TextShow.. -homepage: https://github.com/RyanGlScott/text-show-instances -bug-reports: https://github.com/RyanGlScott/text-show-instances/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/inline.h -cabal-version: >=1.10 - -source-repository head - type: git - location: https://github.com/RyanGlScott/text-show-instances - -library - exposed-modules: TextShow.Instances - - TextShow.Compiler.Hoopl - TextShow.Control.Applicative.Trans - TextShow.Control.Monad.Trans - TextShow.Data.Bifunctor - TextShow.Data.Binary - TextShow.Data.Containers - TextShow.Data.Functor.Trans - TextShow.Data.List.NonEmpty - TextShow.Data.Semigroup - TextShow.Data.Tagged - TextShow.Data.Time - TextShow.Data.UnorderedContainers - TextShow.Data.Vector - TextShow.Language.Haskell.TH - TextShow.System.Console.Haskeline - TextShow.System.Directory - TextShow.System.Locale - TextShow.System.Random - TextShow.System.Time - TextShow.Text.PrettyPrint - TextShow.Text.XHtml - TextShow.Trace.Hpc - - -- Only exports functions if using Windows - TextShow.System.Win32 - - -- Only exports functions if not using Windows - TextShow.System.Console.Terminfo - TextShow.System.Posix - other-modules: TextShow.Utils - build-depends: base >= 4.3 && < 5 - , base-compat >= 0.8.1 && < 1 - , bifunctors >= 5 && < 6 - , binary >= 0.6 && < 0.8 - , bytestring >= 0.9 && < 0.11 - , containers >= 0.1 && < 0.6 - , directory >= 1 && < 1.3 - , haskeline >= 0.7 && < 0.8 - , hoopl >= 3.8.7 && < 3.11 - , hpc >= 0.5 && < 0.7 - , old-locale >= 1 && < 1.1 - , old-time >= 1 && < 1.2 - , pretty >= 1 && < 1.2 - , random >= 1.0.1 && < 1.2 - , semigroups >= 0.16.2 && < 1 - , tagged >= 0.4.4 && < 1 - , template-haskell >= 2.5 && < 2.11 - , text >= 0.11.1 && < 1.3 - , text-show >= 2 && < 2.1 - , time >= 0.1 && < 1.6 - , transformers >= 0.2.1 && < 0.5 - , transformers-compat >= 0.3 && < 1 - , unordered-containers >= 0.2 && < 0.3 - , vector >= 0.9 && < 0.11 - , xhtml >= 3000.2 && < 3000.3 - hs-source-dirs: src - default-language: Haskell2010 - ghc-options: -Wall - include-dirs: include - includes: inline.h - install-includes: inline.h - - if os(windows) - build-depends: Win32 >= 2.1 && < 2.4 - else - build-depends: terminfo >= 0.3.2 && < 0.5 - , unix >= 2 && < 2.8 - -test-suite text-show-instances-spec - type: exitcode-stdio-1.0 - main-is: Spec.hs - other-modules: Instances.Compiler.Hoopl - Instances.Control.Applicative.Trans - Instances.Control.Monad.Trans - Instances.Data.Bifunctor - Instances.Data.Binary - Instances.Data.Containers - Instances.Data.Functor.Trans - Instances.Data.List.NonEmpty - Instances.Data.Semigroup - Instances.Data.Tagged - Instances.Language.Haskell.TH - Instances.Miscellaneous - Instances.System.Console.Haskeline - Instances.System.Directory - Instances.System.Locale - Instances.System.Random - Instances.Text.PrettyPrint - Instances.Text.XHtml - Instances.Trace.Hpc - Instances.Utils - - -- Only exports functions if using Windows - Instances.System.Win32 - - -- Only exports functions if not using Windows - Instances.System.Console.Terminfo - Instances.System.Posix - - Spec.Compiler.HooplSpec - Spec.Control.Applicative.TransSpec - Spec.Control.Monad.TransSpec - Spec.Data.BifunctorSpec - Spec.Data.BinarySpec - Spec.Data.ContainersSpec - Spec.Data.Functor.TransSpec - Spec.Data.List.NonEmptySpec - Spec.Data.SemigroupSpec - Spec.Data.TaggedSpec - Spec.Data.TimeSpec - Spec.Data.UnorderedContainersSpec - Spec.Language.Haskell.THSpec - Spec.System.Console.HaskelineSpec - Spec.System.DirectorySpec - Spec.System.LocaleSpec - Spec.System.RandomSpec - Spec.System.TimeSpec - Spec.Text.PrettyPrintSpec - Spec.Text.XHtmlSpec - Spec.Trace.HpcSpec - Spec.Utils - - -- Only exports functions if using Windows - Spec.System.Win32Spec - - -- Only exports functions if not using Windows - Spec.System.Console.TerminfoSpec - Spec.System.PosixSpec - build-depends: base >= 4.3 && < 5 - , base-compat >= 0.8.1 && < 1 - , bifunctors >= 5 && < 6 - , binary >= 0.6 && < 0.8 - , bytestring >= 0.9 && < 0.11 - , containers >= 0.1 && < 0.6 - , directory >= 1 && < 1.3 - , ghc-prim - , haskeline >= 0.7 && < 0.8 - , hoopl >= 3.8.7 && < 3.11 - , hpc >= 0.5 && < 0.7 - , hspec >= 2 && < 3 - , old-locale >= 1 && < 1.1 - , old-time >= 1 && < 1.2 - , pretty >= 1 && < 1.2 - , QuickCheck >= 2.5 && < 3 - , quickcheck-instances >= 0.1 && < 0.4 - , random >= 1.0.1 && < 1.2 - , semigroups >= 0.8.4 && < 1 - , tagged >= 0.4.4 && < 1 - , template-haskell >= 2.5 && < 2.11 - , text-show >= 2 && < 2.1 - , text-show-instances == 2 - , th-orphans >= 0.12 && < 1 - , time >= 0.1 && < 1.6 - , transformers >= 0.2.1 && < 0.5 - , transformers-compat >= 0.3 && < 1 - , unordered-containers >= 0.2 && < 0.3 - , vector >= 0.9 && < 0.11 - , xhtml >= 3000.2 && < 3000.3 - hs-source-dirs: tests - default-language: Haskell2010 - ghc-options: -Wall -threaded -rtsopts - - if os(windows) - build-depends: Win32 >= 2.1 && < 2.4 - else - build-depends: terminfo >= 0.3.2 && < 0.5 - , unix >= 2 && < 2.8 +name: text-show-instances+version: 2.0.1+synopsis: Additional instances for text-show+description: @text-show-instances@ is a supplemental library to @text-show@+ that provides additional @Show@ instances for data types in+ common Haskell libraries and GHC dependencies that are not+ encompassed by @text-show@. Currently, @text-show-instances@+ covers these libraries:+ .+ * @<http://hackage.haskell.org/package/bifunctors bifunctors>@+ .+ * @<http://hackage.haskell.org/package/binary binary>@+ .+ * @<http://hackage.haskell.org/package/containers containers>@+ .+ * @<http://hackage.haskell.org/package/directory directory>@+ .+ * @<http://hackage.haskell.org/package/haskeline haskeline>@+ .+ * @<http://hackage.haskell.org/package/hoopl hoopl>@+ .+ * @<http://hackage.haskell.org/package/hpc hpc>@+ .+ * @<http://hackage.haskell.org/package/old-locale old-locale>@+ .+ * @<http://hackage.haskell.org/package/old-time old-time>@+ .+ * @<http://hackage.haskell.org/package/pretty pretty>@+ .+ * @<http://hackage.haskell.org/package/random random>@+ .+ * @<http://hackage.haskell.org/package/semigroups semigroups>@+ .+ * @<http://hackage.haskell.org/package/tagged tagged>@+ .+ * @<http://hackage.haskell.org/package/template-haskell template-haskell>@+ .+ * @<http://hackage.haskell.org/package/terminfo terminfo>@+ .+ * @<http://hackage.haskell.org/package/time time>@+ .+ * @<http://hackage.haskell.org/package/transformers transformers>@+ .+ * @<http://hackage.haskell.org/package/unix unix>@+ .+ * @<http://hackage.haskell.org/package/unordered-containers unordered-containers>@+ .+ * @<http://hackage.haskell.org/package/vector vector>@+ .+ * @<http://hackage.haskell.org/package/Win32 Win32>@+ .+ * @<http://hackage.haskell.org/package/xhtml xhtml>@+ .+ One can use these instances by importing+ "TextShow.Instances". Alternatively, there are monomorphic+ versions of the @showb@ function available in the other submodules+ of "TextShow".+homepage: https://github.com/RyanGlScott/text-show-instances+bug-reports: https://github.com/RyanGlScott/text-show-instances/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/inline.h+cabal-version: >=1.10++source-repository head+ type: git+ location: https://github.com/RyanGlScott/text-show-instances++library+ exposed-modules: TextShow.Instances++ TextShow.Compiler.Hoopl+ TextShow.Control.Applicative.Trans+ TextShow.Control.Monad.Trans+ TextShow.Data.Bifunctor+ TextShow.Data.Binary+ TextShow.Data.Containers+ TextShow.Data.Functor.Trans+ TextShow.Data.List.NonEmpty+ TextShow.Data.Semigroup+ TextShow.Data.Tagged+ TextShow.Data.Time+ TextShow.Data.UnorderedContainers+ TextShow.Data.Vector+ TextShow.Language.Haskell.TH+ TextShow.System.Console.Haskeline+ TextShow.System.Directory+ TextShow.System.Locale+ TextShow.System.Random+ TextShow.System.Time+ TextShow.Text.PrettyPrint+ TextShow.Text.XHtml+ TextShow.Trace.Hpc++ -- Only exports functions if using Windows+ TextShow.System.Win32++ -- Only exports functions if not using Windows+ TextShow.System.Console.Terminfo+ TextShow.System.Posix+ other-modules: TextShow.Utils+ build-depends: base >= 4.3 && < 5+ , base-compat >= 0.8.1 && < 1+ , bifunctors >= 5 && < 6+ , binary >= 0.6 && < 0.8+ , bytestring >= 0.9 && < 0.11+ , containers >= 0.1 && < 0.6+ , directory >= 1 && < 1.3+ , haskeline >= 0.7 && < 0.8+ , hoopl >= 3.8.7 && < 3.11+ , hpc >= 0.5 && < 0.7+ , old-locale >= 1 && < 1.1+ , old-time >= 1 && < 1.2+ , pretty >= 1 && < 1.2+ , random >= 1.0.1 && < 1.2+ , semigroups >= 0.16.2 && < 1+ , tagged >= 0.4.4 && < 1+ , template-haskell >= 2.5 && < 2.11+ , text >= 0.11.1 && < 1.3+ , text-show >= 2 && < 2.1+ , time >= 0.1 && < 1.6+ , transformers >= 0.2.1 && < 0.5+ , transformers-compat >= 0.3 && < 1+ , unordered-containers >= 0.2 && < 0.3+ , vector >= 0.9 && < 0.12+ , xhtml >= 3000.2 && < 3000.3+ hs-source-dirs: src+ default-language: Haskell2010+ ghc-options: -Wall+ include-dirs: include+ includes: inline.h+ install-includes: inline.h++ if os(windows)+ build-depends: Win32 >= 2.1 && < 2.4+ else+ build-depends: terminfo >= 0.3.2 && < 0.5+ , unix >= 2 && < 2.8++test-suite text-show-instances-spec+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ other-modules: Instances.Compiler.Hoopl+ Instances.Control.Applicative.Trans+ Instances.Control.Monad.Trans+ Instances.Data.Bifunctor+ Instances.Data.Binary+ Instances.Data.Containers+ Instances.Data.Functor.Trans+ Instances.Data.List.NonEmpty+ Instances.Data.Semigroup+ Instances.Data.Tagged+ Instances.Language.Haskell.TH+ Instances.Miscellaneous+ Instances.System.Console.Haskeline+ Instances.System.Directory+ Instances.System.Locale+ Instances.System.Random+ Instances.Text.PrettyPrint+ Instances.Text.XHtml+ Instances.Trace.Hpc+ Instances.Utils++ -- Only exports functions if using Windows+ Instances.System.Win32++ -- Only exports functions if not using Windows+ Instances.System.Console.Terminfo+ Instances.System.Posix++ Spec.Compiler.HooplSpec+ Spec.Control.Applicative.TransSpec+ Spec.Control.Monad.TransSpec+ Spec.Data.BifunctorSpec+ Spec.Data.BinarySpec+ Spec.Data.ContainersSpec+ Spec.Data.Functor.TransSpec+ Spec.Data.List.NonEmptySpec+ Spec.Data.SemigroupSpec+ Spec.Data.TaggedSpec+ Spec.Data.TimeSpec+ Spec.Data.UnorderedContainersSpec+ Spec.Language.Haskell.THSpec+ Spec.System.Console.HaskelineSpec+ Spec.System.DirectorySpec+ Spec.System.LocaleSpec+ Spec.System.RandomSpec+ Spec.System.TimeSpec+ Spec.Text.PrettyPrintSpec+ Spec.Text.XHtmlSpec+ Spec.Trace.HpcSpec+ Spec.Utils++ -- Only exports functions if using Windows+ Spec.System.Win32Spec++ -- Only exports functions if not using Windows+ Spec.System.Console.TerminfoSpec+ Spec.System.PosixSpec+ build-depends: base >= 4.3 && < 5+ , base-compat >= 0.8.1 && < 1+ , bifunctors >= 5 && < 6+ , binary >= 0.6 && < 0.8+ , bytestring >= 0.9 && < 0.11+ , containers >= 0.1 && < 0.6+ , directory >= 1 && < 1.3+ , ghc-prim+ , haskeline >= 0.7 && < 0.8+ , hoopl >= 3.8.7 && < 3.11+ , hpc >= 0.5 && < 0.7+ , hspec >= 2 && < 3+ , old-locale >= 1 && < 1.1+ , old-time >= 1 && < 1.2+ , pretty >= 1 && < 1.2+ , QuickCheck >= 2.5 && < 3+ , quickcheck-instances >= 0.1 && < 0.4+ , random >= 1.0.1 && < 1.2+ , semigroups >= 0.8.4 && < 1+ , tagged >= 0.4.4 && < 1+ , template-haskell >= 2.5 && < 2.11+ , text-show >= 2 && < 2.1+ , text-show-instances == 2.0.1+ , th-orphans >= 0.12 && < 1+ , time >= 0.1 && < 1.6+ , transformers >= 0.2.1 && < 0.5+ , transformers-compat >= 0.3 && < 1+ , unordered-containers >= 0.2 && < 0.3+ , vector >= 0.9 && < 0.12+ , xhtml >= 3000.2 && < 3000.3+ hs-source-dirs: tests+ default-language: Haskell2010+ ghc-options: -Wall -threaded -rtsopts++ if os(windows)+ build-depends: Win32 >= 2.1 && < 2.4+ else+ build-depends: terminfo >= 0.3.2 && < 0.5+ , unix >= 2 && < 2.8