Monthly Downloads: 21
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Data     Codec     Utf8    
Latest version: v0.1.0.4

utf8-conversions alternatives and similar packages

Based on the "utf8" category.
Alternatively, view utf8-conversions alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of utf8-conversions or a related project?

Add another 'utf8' Package


utf8-conversions A string conversion library that assumes utf8

Build Status License

This package provides a Data.Convertible.Utf8 library for easy conversion of many string types in Haskell


import Data.Convertible.Utf8 (convert)

string :: String
string = "Hello world"

bytestring :: ByteString
bytestring = convert string

text :: Text
text = convert bytestring

A typeclass that represents something that can be converted. A Convertible a b instance represents an a that can be converted to a b.

class Convertible a b where
  convert :: a -> b


  • String
  • ByteString
  • ByteStringBuilder
  • LazyByteString
  • ByteStringShort
  • Text
  • LazyText
  • TextBuilder
  • TextShort

Supports type conversion between the above types. Byte string is assumed to be in utf-8 encoding.


String conversion in haskell is more difficult than in other languages and needs to be easier.

In particular, the OverloadedStrings pragma does not work properly when creating a ByteString.

So why not other conversion libraries? There are many other conversion libraries that use the Maybe type for safety or are not explicitly stated as utf8.

Libraries that use maybe types are very labor intensive. Libraries that do not explicitly state UTF8 are insecure

Therefore, this library clearly states that it assumes UTF8 and performs the conversion without using the MAYBE type, which is both safe and easy.

Get involved!

If there's a bug or a better way to convert, please report it!

*Note that all licence references and agreements mentioned in the utf8-conversions README section above are relevant to that project's source code only.