Merge pull request #118 from protolude/strconv
Migrate show to use Conv.StringConv
This commit is contained in:
+88
-84
@@ -1,114 +1,118 @@
|
|||||||
name: protolude
|
name: protolude
|
||||||
version: 0.3.0
|
version: 0.3.0
|
||||||
synopsis: A small prelude.
|
synopsis: A small prelude.
|
||||||
description: A sensible set of defaults for writing custom Preludes.
|
description: A sensible set of defaults for writing custom Preludes.
|
||||||
homepage: https://github.com/sdiehl/protolude
|
homepage: https://github.com/sdiehl/protolude
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Stephen Diehl
|
author: Stephen Diehl
|
||||||
maintainer: stephen.m.diehl@gmail.com
|
maintainer: stephen.m.diehl@gmail.com
|
||||||
copyright: 2016-2020 Stephen Diehl
|
copyright: 2016-2020 Stephen Diehl
|
||||||
category: Prelude
|
category: Prelude
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
cabal-version: >=1.10
|
cabal-version: >=1.10
|
||||||
bug-reports: https://github.com/sdiehl/protolude/issues
|
bug-reports: https://github.com/sdiehl/protolude/issues
|
||||||
tested-with:
|
tested-with:
|
||||||
GHC == 7.6.1,
|
GHC ==7.6.1
|
||||||
GHC == 7.6.2,
|
|| ==7.6.2
|
||||||
GHC == 7.6.3,
|
|| ==7.6.3
|
||||||
GHC == 7.8.1,
|
|| ==7.8.1
|
||||||
GHC == 7.8.2,
|
|| ==7.8.2
|
||||||
GHC == 7.8.3,
|
|| ==7.8.3
|
||||||
GHC == 7.8.4,
|
|| ==7.8.4
|
||||||
GHC == 7.10.1,
|
|| ==7.10.1
|
||||||
GHC == 7.10.2,
|
|| ==7.10.2
|
||||||
GHC == 7.10.3,
|
|| ==7.10.3
|
||||||
GHC == 8.0.1,
|
|| ==8.0.1
|
||||||
GHC == 8.2.1,
|
|| ==8.2.1
|
||||||
GHC == 8.4.1,
|
|| ==8.4.1
|
||||||
GHC == 8.6.1,
|
|| ==8.6.1
|
||||||
GHC == 8.8.1
|
|| ==8.8.1
|
||||||
GHC == 8.10.1
|
|| ==8.10.1
|
||||||
extra-source-files: README.md ChangeLog.md
|
|
||||||
|
extra-source-files:
|
||||||
|
README.md
|
||||||
|
ChangeLog.md
|
||||||
|
|
||||||
flag dev
|
flag dev
|
||||||
description: Build development tools
|
description: Build development tools
|
||||||
manual: True
|
manual: True
|
||||||
default: False
|
default: False
|
||||||
|
|
||||||
Source-Repository head
|
source-repository head
|
||||||
type: git
|
type: git
|
||||||
location: git@github.com:protolude/protolude.git
|
location: git@github.com:protolude/protolude.git
|
||||||
|
|
||||||
library
|
library
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
Protolude
|
Protolude
|
||||||
|
Protolude.Applicative
|
||||||
Protolude.Base
|
Protolude.Base
|
||||||
Protolude.Monad
|
Protolude.Bifunctor
|
||||||
Protolude.Safe
|
|
||||||
Protolude.List
|
|
||||||
Protolude.Bool
|
Protolude.Bool
|
||||||
Protolude.Show
|
Protolude.CallStack
|
||||||
Protolude.Conv
|
Protolude.Conv
|
||||||
Protolude.ConvertText
|
Protolude.ConvertText
|
||||||
Protolude.Either
|
|
||||||
Protolude.Functor
|
|
||||||
Protolude.Semiring
|
|
||||||
Protolude.Bifunctor
|
|
||||||
Protolude.Applicative
|
|
||||||
Protolude.Error
|
|
||||||
Protolude.Panic
|
|
||||||
Protolude.CallStack
|
|
||||||
Protolude.Exceptions
|
|
||||||
Protolude.Partial
|
|
||||||
Protolude.Debug
|
Protolude.Debug
|
||||||
|
Protolude.Either
|
||||||
|
Protolude.Error
|
||||||
|
Protolude.Exceptions
|
||||||
|
Protolude.Functor
|
||||||
|
Protolude.List
|
||||||
|
Protolude.Monad
|
||||||
|
Protolude.Panic
|
||||||
|
Protolude.Partial
|
||||||
|
Protolude.Safe
|
||||||
|
Protolude.Semiring
|
||||||
|
Protolude.Show
|
||||||
Protolude.Unsafe
|
Protolude.Unsafe
|
||||||
|
|
||||||
default-extensions:
|
default-extensions:
|
||||||
NoImplicitPrelude
|
NoImplicitPrelude
|
||||||
OverloadedStrings
|
|
||||||
FlexibleContexts
|
FlexibleContexts
|
||||||
MultiParamTypeClasses
|
MultiParamTypeClasses
|
||||||
|
OverloadedStrings
|
||||||
|
|
||||||
ghc-options:
|
ghc-options: -Wall -fwarn-implicit-prelude
|
||||||
-Wall
|
|
||||||
-fwarn-implicit-prelude
|
|
||||||
|
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.6 && <4.15,
|
array >=0.4 && <0.6
|
||||||
array >= 0.4 && <0.6,
|
, async >=2.0 && <2.3
|
||||||
ghc-prim >= 0.3 && <0.7,
|
, base >=4.6 && <4.15
|
||||||
async >= 2.0 && <2.3,
|
, bytestring >=0.10 && <0.11
|
||||||
deepseq >= 1.3 && <1.5,
|
, containers >=0.5 && <0.7
|
||||||
containers >= 0.5 && <0.7,
|
, deepseq >=1.3 && <1.5
|
||||||
hashable >= 1.2 && <1.4,
|
, ghc-prim >=0.3 && <0.7
|
||||||
transformers >= 0.2 && <0.6,
|
, hashable >=1.2 && <1.4
|
||||||
text >= 1.2 && <1.3,
|
, mtl >=2.1 && <2.3
|
||||||
stm >= 2.4 && <2.6,
|
, mtl-compat >=0.2 && <0.3
|
||||||
bytestring >= 0.10 && <0.11,
|
, stm >=2.4 && <2.6
|
||||||
mtl >= 2.1 && <2.3,
|
, text >=1.2 && <1.3
|
||||||
mtl-compat >= 0.2 && <0.3,
|
, transformers >=0.2 && <0.6
|
||||||
transformers-compat >= 0.4 && <0.7
|
, transformers-compat >=0.4 && <0.7
|
||||||
if !impl(ghc >= 8.0)
|
|
||||||
Build-Depends: fail >= 4.9 && <4.10
|
|
||||||
|
|
||||||
hs-source-dirs: src
|
if !impl(ghc >=8.0)
|
||||||
default-language: Haskell2010
|
build-depends: fail ==4.9.*
|
||||||
|
|
||||||
|
hs-source-dirs: src
|
||||||
|
default-language: Haskell2010
|
||||||
|
|
||||||
executable exports
|
executable exports
|
||||||
main-is: Exports.hs
|
main-is: Exports.hs
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
if flag(dev)
|
if flag(dev)
|
||||||
buildable: True
|
buildable: True
|
||||||
|
|
||||||
else
|
else
|
||||||
buildable: False
|
buildable: False
|
||||||
|
|
||||||
build-depends:
|
build-depends:
|
||||||
protolude,
|
base >=4.6 && <4.15
|
||||||
base >= 4.6 && <4.15,
|
, directory
|
||||||
ghc,
|
, filepath
|
||||||
ghc-paths,
|
, ghc
|
||||||
directory,
|
, ghc-paths
|
||||||
process,
|
, mtl
|
||||||
transformers,
|
, process
|
||||||
mtl,
|
, protolude
|
||||||
filepath
|
, transformers
|
||||||
|
|||||||
+3
-2
@@ -153,6 +153,7 @@ import Protolude.ConvertText as ConvertText
|
|||||||
import Protolude.Panic as Panic
|
import Protolude.Panic as Panic
|
||||||
import Protolude.Exceptions as Exception
|
import Protolude.Exceptions as Exception
|
||||||
import Protolude.Semiring as Semiring
|
import Protolude.Semiring as Semiring
|
||||||
|
import qualified Protolude.Conv as Conv
|
||||||
|
|
||||||
import Protolude.Base as Base hiding (
|
import Protolude.Base as Base hiding (
|
||||||
putStr -- Overriden by Show.putStr
|
putStr -- Overriden by Show.putStr
|
||||||
@@ -982,8 +983,8 @@ liftIO1 = (.) liftIO
|
|||||||
liftIO2 :: MonadIO m => (a -> b -> IO c) -> a -> b -> m c
|
liftIO2 :: MonadIO m => (a -> b -> IO c) -> a -> b -> m c
|
||||||
liftIO2 = ((.).(.)) liftIO
|
liftIO2 = ((.).(.)) liftIO
|
||||||
|
|
||||||
show :: (Show a, ConvertText String b) => a -> b
|
show :: (Show a, Conv.StringConv String b) => a -> b
|
||||||
show x = ConvertText.toS (PBase.show x)
|
show x = Conv.toS (PBase.show x)
|
||||||
{-# SPECIALIZE show :: Show a => a -> Text #-}
|
{-# SPECIALIZE show :: Show a => a -> Text #-}
|
||||||
{-# SPECIALIZE show :: Show a => a -> LText #-}
|
{-# SPECIALIZE show :: Show a => a -> LText #-}
|
||||||
{-# SPECIALIZE show :: Show a => a -> String #-}
|
{-# SPECIALIZE show :: Show a => a -> String #-}
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ instance ConvertText LT.Text String where toS = LT.unpack
|
|||||||
instance ConvertText LT.Text T.Text where toS = LT.toStrict
|
instance ConvertText LT.Text T.Text where toS = LT.toStrict
|
||||||
instance ConvertText LT.Text LT.Text where toS = id
|
instance ConvertText LT.Text LT.Text where toS = id
|
||||||
|
|
||||||
|
instance ConvertText LB.ByteString B.ByteString where toS = LB.toStrict
|
||||||
|
instance ConvertText LB.ByteString LB.ByteString where toS = id
|
||||||
|
|
||||||
|
instance ConvertText B.ByteString B.ByteString where toS = id
|
||||||
|
instance ConvertText B.ByteString LB.ByteString where toS = LB.fromStrict
|
||||||
|
|
||||||
toUtf8 :: ConvertText a T.Text => a -> B.ByteString
|
toUtf8 :: ConvertText a T.Text => a -> B.ByteString
|
||||||
toUtf8 =
|
toUtf8 =
|
||||||
encodeUtf8 . toS
|
encodeUtf8 . toS
|
||||||
|
|||||||
Reference in New Issue
Block a user