packages feed

base58string 0.9.0 → 0.9.1

raw patch · 2 files changed

+7/−2 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Base58String: fromText :: Text -> Base58String

Files

base58string.cabal view
@@ -1,6 +1,6 @@ name: base58string
 category: Data
-version: 0.9.0
+version: 0.9.1
 license: MIT
 license-file: LICENSE
 copyright: (c) 2015 Leon Mergen
src/Data/Base58String.hs view
@@ -4,7 +4,8 @@                          , toBinary
                          , fromBytes
                          , toBytes
-                         , toText ) where
+                         , toText
+                         , fromText ) where
 
 import           Control.Applicative    ((<$>), pure)
 import Control.Monad (liftM)
@@ -70,6 +71,10 @@ -- | Access to a 'T.Text' representation of the 'Base58String'
 toText :: Base58String -> T.Text
 toText (Base58String bs) = TE.decodeUtf8 bs
+
+-- | Converts a 'T.Text' representation to a 'Base58String'
+fromText :: T.Text -> Base58String
+fromText = b58String . TE.encodeUtf8
 
 -- | Our mapping table from binary to base58, based on Bitcoin's table
 bitcoinTable :: BS.ByteString