linear-base
linear-base copied to clipboard
Which `IO` to export in `Prelude`
Currently, our Prelude.Linear is exporting the non-linear IO type; just because it is what Prelude has. But, we have a linear IO implementation, and one might argue that it should be the default one.
I do not have a clear opinion on this. I think:
Linear.IO:
- (+) Fits the spirit of linear base.
- (+) It supports lifting non-linear IO actions (
fromSystemIO*family of functions), so it is not overly restrictive. - (-) It will probably force us to export
Controlfunctors. - (-) Might be an unnecessary overhead for people who don't use linear IO, and they might be the majority.
non-linear IO:
- (+) Probably less surprising to users and easier to use.
- (-) Requires us to also export a bunch of unrestricted stuff to be usable (unrestricted functors, simple IO functions like
print).
I guess another option is to not have any IO type exported, and expect users to make an explicit choice. Which would actually be my preference if there is no clear verdict.