External Publication
Visit Post

From-text: type class to convert from Text

Haskell Community [Unofficial] May 22, 2026
Source

Hackage

from-text

Type class to convert from Text

I released a new package which provides

class IsText a where
  fromText :: Text -> a

aiming to simplify conversion from Text to other textual data types, including ByteArray, ByteString and OsPath. It uses UTF-8 when converting to binary types without an associated encoding.

There is an overwhelming number of alternative packages for text conversions. To name a few in no particular order:

  • text-conversions
  • string-conv
  • ttc
  • text-convert
  • lawful-conversions
  • witch
  • unwitch

At the moment none of them provide conversions from Text to OsPath. I could not decide which one to contribute such function to, so decided to create a new package.

Discussion in the ATmosphere

Loading comments...