Skip to content
Snippets Groups Projects
Unverified Commit f1e25143 authored by glguy's avatar glguy Committed by GitHub
Browse files

Merge pull request #24 from gwils/fromChar

Add fromChar function
parents 24c8a542 9971280e
Branches master
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ module Data.ByteString.UTF8
, drop
, span
, break
, fromChar
, fromString
, toString
, foldl
......@@ -43,6 +44,10 @@ import Prelude hiding (take,drop,splitAt,span,break,foldr,foldl,length,lines)
import Codec.Binary.UTF8.String(encode)
import Codec.Binary.UTF8.Generic (buncons)
-- | Converts a Haskell char into a UTF8 encoded bytestring.
fromChar :: Char -> B.ByteString
fromChar x = fromString [x]
-- | Converts a Haskell string into a UTF8 encoded bytestring.
fromString :: String -> B.ByteString
fromString xs = B.pack (encode xs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment