-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strictness and laziness ergonomics #317
Comments
In my experience, type synonyms aren't that great. They're expanded sometimes by GHC (never consistently), which means you can easily end up with confusing messaging from the compiler. This basically forces you to keep this information in your head at all times. I certainly do agree that there needs to be a much stronger distinction between the two |
@kozross As I can understand this argument for Servant's type aliases, which are pretty much indecipherable without good knowledge of the library's inner working, I have a hard time imagining being confused by |
One irritating thing that i see a lot in Haddock is something like: toLazyText :: Foo -> Text
toStrictText :: Foo -> Text An One way to cut the Gordian knot here is to deprecate |
We should push for a broader adoption of proper streaming abstractions instead of Lazy Text for IO. |
If we decide that deprecating the |
To be quite honest, I don't think it will ever be considered unless we are certain that the ecosystem is ready for the migration (which means pedagogical materials for learners, adoption by popular libraries and projects, etc). |
I agree with @parsonsmatt - lazy Text should go. I would also be quite happy to assist with the necessary writing. |
No one forces people to use lazy I understand why people damn lazy I/O. But it is only a small facet of lazy Deprecating |
I talked to Snoyman about In any case, deprecating any part of |
Not to mention that (for |
I must reiterate: no one forces people to use lazy Sticking to a topic, I think it is a good idea. To avoid undesirable expansion of type synonyms, we can actually do things vice versa, defining |
@Bodigrim I completely disagree. Try using a library which uses lazy But I agree, this is off-topic, so I'll stop. |
@Kleidukos I'm not sure such a community migration will ever happen unless driven aggressively by us. Alternatives and better solutions, both semantically and performance-wise, to lazy |
Back to the topic, Making it other way around (defining |
@Bodigrim I don't know very well the release policy of |
@Kleidukos I expect that the next release of |
Now back to off-topic :)
If a library uses a lazy However, if laziness is there for a purpose, then I'm not sure that returning a lazy |
@Bodigrim I agree that the lack of a standard streaming library is the real problem here. |
The fact that we have both lazy and strict
Text
types without any marker outside of their namespace is rather unfortunate.In pretty big codebases or modules, it's also easy to forget that
Data.Text.Lazy
was imported.This is why, inspired by Kowainik's work, I would like to introduce the following type alias:
What it does
What it does not
A similar ticket was opened in the haskell/bytestring repo: haskell/bytestring#375
The text was updated successfully, but these errors were encountered: