[Haskell-cafe] System.IO but not with Data.String?

Hilco Wijbenga hilco.wijbenga at gmail.com
Thu May 9 19:29:22 UTC 2024


Hi all,

We have Text and ByteString as alternatives to String but as soon as
you want to do anything IO related (read a file, get a directory's
content, et cetera) it seems your only option is to use String.

For an occasional IO action, this is obviously irrelevant but for a
compiler, a build system, or anything else that does a lot of IO this
seems like it would be(come) an issue. So I was wondering what would
be involved in adding (portable) support for System.IO with an
alternative to String (this alternative does not necessarily need to
be Text or ByteString).

I did a little bit of research into how GHC handles this and there
appear to be several other String types in the GHC tree, including
ByteString(?). How feasible is an alternative System.IO API? How tied
to GHC would such an alternative need to be? To be clear, I am not
looking to _replace_ System.IO but to _add_ an alternative API (and
not a wrapper that maps to/from String).

Please do not assume I necessarily know what I am talking about!
Especially, when it comes to the "portable" part. :-)

Cheers,
Hilco


More information about the Haskell-Cafe mailing list