to-string-instances (empty) → 0.1
raw patch · 4 files changed
+183/−0 lines, 4 filesdep +basedep +bytestringdep +prettysetup-changed
Dependencies added: base, bytestring, pretty, text, to-string-class
Files
- Data/String/ToString/Instances.hs +77/−0
- LICENSE +30/−0
- Setup.hs +2/−0
- to-string-instances.cabal +74/−0
+ Data/String/ToString/Instances.hs view
@@ -0,0 +1,77 @@+{-# LANGUAGE CPP #-}++--------------------------------------------------------------------------------+-- |+-- Module : Data.String.ToString.Instances+-- Copyright : (c) 2009 Bas van Dijk+-- License : BSD3 (see the file LICENSE)+-- Maintainer : v.dijk.bas@gmail.com+-- Stability : Stable+--+-- This module exports the following instances for the 'ToString' class:+--+-- * 'ShowS'+--+-- * 'ByteString'+--+-- * 'DString'+--+-- * 'Doc'+--+-- * 'Text'+--+-- Note that the instances can be enabled or disabled based on cabal flags.+--+--------------------------------------------------------------------------------++module Data.String.ToString.Instances where++import Data.String.ToString (ToString, toString)++#ifdef SHOWS+import qualified Text.Show+#endif++#ifdef BYTESTRING+import qualified Data.ByteString.Char8+#endif++#ifdef DOC+import qualified Text.PrettyPrint+#endif++#ifdef TEXT+import qualified Data.Text+import qualified Data.Text.Lazy+#endif+++--------------------------------------------------------------------------------+-- ToString instances+--------------------------------------------------------------------------------++#ifdef SHOWS+instance ToString Text.Show.ShowS where+ toString s = s []+#endif++#ifdef BYTESTRING+instance ToString Data.ByteString.Char8.ByteString where+ toString = Data.ByteString.Char8.unpack+#endif++#ifdef DOC+instance ToString Text.PrettyPrint.Doc where+ toString = Text.PrettyPrint.render+#endif++#ifdef TEXT+instance ToString Data.Text.Text where+ toString = Data.Text.unpack++instance ToString Data.Text.Lazy.Text where+ toString = Data.Text.Lazy.unpack+#endif+++-- The End ---------------------------------------------------------------------
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2009, Bas van Dijk+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Bas van Dijk nor the names of his+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ to-string-instances.cabal view
@@ -0,0 +1,74 @@+Name: to-string-instances+Version: 0.1+Synopsis: Instances for the ToString class.+Description: This library provides the following instances+ for the ToString class:+ .+ * ShowS+ .+ * ByteString+ .+ * DString+ .+ * Doc+ .+ * Text+ .+ Note that the instances can be enabled or disabled+ based on cabal flags.+ .+ The idea is that eventually all packages providing string-like+ types will provide instances for ToString themselves.+ In the mean time this package is here to provide them.+Category: Data+License: BSD3+License-file: LICENSE+Author: Bas van Dijk <v.dijk.bas@gmail.com>+Maintainer: Bas van Dijk <v.dijk.bas@gmail.com>+Copyright: 2009 Bas van Dijk <v.dijk.bas@gmail.com>+Cabal-version: >= 1.6+Build-Type: Simple+Stability: Stable+Extra-Source-Files: LICENSE++Source-repository head+ Type: darcs+ Location: http://code.haskell.org/~basvandijk/code/to-string-instances/++Flag ShowS+ Description: Add ShowS support.+ Default: True++Flag ByteString+ Description: Add ByteString support.+ Default: True++Flag Doc+ Description: Add Doc support.+ Default: True++Flag Text+ Description: Add Text support.+ Default: True++Library+ Build-Depends: to-string-class == 0.1.*+ Exposed-modules: Data.String.ToString.Instances+ Ghc-options: -O2 -Wall -fno-warn-orphans++ if flag(ShowS)+ CPP-Options: -DSHOWS+ Build-Depends: base == 4.*+ Extensions: TypeSynonymInstances++ if flag(ByteString)+ CPP-Options: -DBYTESTRING+ Build-Depends: bytestring == 0.9.*++ if flag(Doc)+ CPP-Options: -DDOC+ Build-Depends: pretty == 1.0.*++ if flag(Text)+ CPP-Options: -DTEXT+ Build-Depends: text == 0.4.*