packages feed

string-convert 3.0.1 → 4.0.0.1

raw patch · 2 files changed

+13/−31 lines, 2 files

Files

Text/StringConvert.hs view
@@ -3,10 +3,10 @@ -- strict), and String, are supported. -- -- To hook custom string types into the conversion mechanism, implement both--- @FromString@ and @ToString@ for your type.+-- @IsString@ and @ToString@ for your type. {-#LANGUAGE FlexibleInstances #-} module Text.StringConvert-( FromString+( IsString , fromString , ToString , toString@@ -19,24 +19,7 @@ import qualified Data.ByteString.UTF8 as UTF8 import qualified Data.ByteString.Lazy.UTF8 as LUTF8 import qualified Data.ByteString.Lazy as LBS--class FromString a where-    fromString :: String -> a--instance FromString [Char] where-    fromString = id--instance FromString Text.Text where-    fromString = Text.pack--instance FromString LText.Text where-    fromString = LText.pack--instance FromString UTF8.ByteString where-    fromString = UTF8.fromString--instance FromString LUTF8.ByteString where-    fromString = LUTF8.fromString+import Data.String (IsString (..))  -- | Defines how a given type should be converted to String. -- If at all possible, the conversion should be loss-less, and if encodings are@@ -70,11 +53,11 @@ {-# RULES "s/LBS->BS" s = LBS.toStrict #-} {-# RULES "s/BS->LBS" s = LBS.fromStrict #-} --- conversions to and from string can be done through the ToString / FromString+-- conversions to and from string can be done through the ToString / IsString -- classes {-# RULES "s/->String" s = toString #-} {-# RULES "s/String->" s = fromString #-}  {-# NOINLINE s #-}-s :: (ToString a, FromString b) => a -> b+s :: (ToString a, IsString b) => a -> b s = fromString . toString
string-convert.cabal view
@@ -1,31 +1,30 @@--- Initial string-convert.cabal generated by cabal init.  For further+-- Initial string-convert.cabal generated by cabal init.  For further  -- documentation, see http://haskell.org/cabal/users-guide/  name:                string-convert-version:             3.0.1+version:             4.0.0.1 synopsis:            Universal string conversions-description:         Provides functions and typeclasses for transparent-                     conversions between various string types.+description:         Provide unified conversion functions between any two string-like types. homepage:            https://bitbucket.org/tdammers/string-convert license:             BSD3 license-file:        LICENSE author:              Tobias Dammers maintainer:          tdammers@gmail.com-copyright:           2016 Tobias Dammers+-- copyright:            category:            Text build-type:          Simple--- extra-source-files:+-- extra-source-files:   cabal-version:       >=1.10  library   exposed-modules:     Text.StringConvert-  -- other-modules:-  -- other-extensions:+  -- other-modules:       +  -- other-extensions:       build-depends: base >=4.5 && <5.0                , bytestring                , text                , utf8-string-  -- hs-source-dirs:+  -- hs-source-dirs:         default-language:    Haskell2010 test-suite tests   build-depends: base >= 4.5 && <5.0