Commits

FlorianHartwig  committed d0a6420

Add ToBencode instance for String

  • Participants
  • Parent commits f83a574

Comments (0)

Files changed (1)

File src/Data/AttoBencode/Types.hs

 
 import qualified Data.Map as M
 import Data.ByteString (ByteString)
+import qualified Data.ByteString.Char8 as B
 
 -- | The Haskell data type for Bencode values
 data BValue = BString !ByteString
 instance ToBencode ByteString where
     toBencode = BString
 
+instance ToBencode String where
+    toBencode = BString . B.pack
+
 instance ToBencode Integer where
     toBencode = BInt