{"slug": "from-text-type-class-to-convert-from-text", "title": "From-text: type class to convert from Text", "summary": "A new Haskell package introduces the `IsText` type class with a `fromText` function to simplify conversion from `Text` to other textual data types like `ByteArray`, `ByteString`, and `OsPath`, using UTF-8 for binary types. The author created this package because existing alternatives do not support conversion from `Text` to `OsPath`, and they could not decide which existing library to contribute this functionality to.", "body_md": "I released a new package which provides\nclass IsText a where\nfromText :: Text -> a\naiming to simplify conversion from Text\nto other textual data types, including ByteArray\n, ByteString\nand OsPath\n. It uses UTF-8 when converting to binary types without an associated encoding.\nThere is an overwhelming number of alternative packages for text conversions. To name a few in no particular order:\nAt the moment none of them provide conversions from Text\nto OsPath\n. I could not decide which one to contribute such function to, so decided to create a new package.", "url": "https://wpnews.pro/news/from-text-type-class-to-convert-from-text", "canonical_source": "https://discourse.haskell.org/t/from-text-type-class-to-convert-from-text/14150#post_1", "published_at": "2026-05-22 21:18:32+00:00", "updated_at": "2026-05-22 21:35:12.307238+00:00", "lang": "en", "topics": ["developer-tools", "open-source", "data"], "entities": ["ByteArray", "ByteString", "OsPath", "Text"], "alternates": {"html": "https://wpnews.pro/news/from-text-type-class-to-convert-from-text", "markdown": "https://wpnews.pro/news/from-text-type-class-to-convert-from-text.md", "text": "https://wpnews.pro/news/from-text-type-class-to-convert-from-text.txt", "jsonld": "https://wpnews.pro/news/from-text-type-class-to-convert-from-text.jsonld"}}