to-string-class (empty) → 0.1
raw patch · 4 files changed
+103/−0 lines, 4 filesdep +basesetup-changed
Dependencies added: base
Files
- Data/String/ToString.hs +35/−0
- LICENSE +30/−0
- Setup.hs +2/−0
- to-string-class.cabal +36/−0
+ Data/String/ToString.hs view
@@ -0,0 +1,35 @@+{-# LANGUAGE TypeSynonymInstances #-}++--------------------------------------------------------------------------------+-- |+-- Module : Data.String.ToString+-- Copyright : (c) 2009 Bas van Dijk+-- License : BSD3 (see the file LICENSE)+-- Maintainer : v.dijk.bas@gmail.com+-- Stability : Stable+--+--------------------------------------------------------------------------------++module Data.String.ToString+ ( ToString+ , toString+ , fromToString+ )+ where++import Data.String (IsString, fromString)++class ToString s where+ -- | Convert a string-like type to a 'String'.+ toString :: s -> String++instance ToString String where+ toString = id++instance ToString Char where+ toString = (:[])++-- | General coercion between string-like types.+fromToString :: (IsString s2, ToString s1) => s1 -> s2+fromToString = fromString . toString+
+ 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-class.cabal view
@@ -0,0 +1,36 @@+Name: to-string-class+Version: 0.1+Synopsis: Converting string-like types to Strings.+Description: This library provides the class:+ .+ class ToString s where toString :: s -> String+ .+ Instances for String and Char are provided.+ For other instances see the package:+ .+ <http://hackage.haskell.org/package/to-string-instances>+ .+ Also included is a general coercion function between string-like types:+ .+ fromToString :: (IsString s2, ToString s1) => s1 -> s2+ .+ fromToString = fromString . toString+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-class/++Library+ Build-Depends: base == 4.*+ Exposed-modules: Data.String.ToString+ Ghc-options: -O2 -Wall