-
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
Add tshow function #183
Comments
A variant of this has been proposed before (and rejected) in #106. |
That's actually a different thing. The |
Perhaps it would make sense as |
I don't have much of an opinion what the name is. I'm just interested in squashing the unnecessary proliferation and fragmentation of pointless reimplementations of this function. |
Hi there! Is this issue still relevant? If so, would any of the maintainers be interested in providing some mentorship/general help on resolving this so that the newcomers and first-time contributors would have an easier time? I would like to add this as one of the issues for the upcoming Haskell Weekly's Call for Participation section. See discussion in #75. These are the guidelines we'd like to stick to in the future:
Thank you! |
This is definitely still relevant, and it's a very easy issue to fix. The main question at this point is maintainer buy-in. |
Personally, I've written this function upwards of 20 times. +1 |
I'd prefer the minimum possible code for a performant text show be added to
text and to implement this function with that.
On Jul 13, 2017 11:59 AM, "Remy Goldschmidt" <notifications@github.com> wrote:
Personally, I've written this function upwards of 20 times. +1
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#183 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AANyNy8i4HiUZMy0dTDc5OvTSlRbINXfks5sNkzVgaJpZM4NmxR5>
.
|
@codygman That makes sense, although I think there might actually be two different things people are talking about here:
To me, these both seem very useful, and possibly quite different. For (2), I'm not sure what kinds of implementations people have in mind, but it seems like it might be a lot more involved than (1). In particular, it's not clear to me whether or how we can enforce that (2)'s instances agree with "classic" If it makes sense to others here, I would personally really like to see a solution to (1) happen independently of (and sooner than) a solution to (2). However, I can't say I've thought about the matter deeply, and I certainly wouldn't want something introduced that makes things tougher down the line. |
Indeed, I'd be fine with fixing (1) in isolation. As for (2), there are a number of solutions currently available. There's @bos's own |
This issue is specifically asking for (1), not (2). |
Sure, I'm not proposing that we implement (2) in |
2 would address 1 wouldn't it? I think that adding the a show based version
goes against the performant nature of the text library.
I envision hundreds of future newbie's recounting experiences along the
lines of:
"I tried the string library and it was slow, I tried text (using Text.show)
and it was slow. Haskell is slow"
This can be avoided by only providing 2 without any loss in functionality.
…On Jul 13, 2017 3:52 PM, "Ryan Scott" ***@***.***> wrote:
Sure, I'm not proposing that we implement (2) in text. (I only mention it
since some folks here appear to want (2), or are at least waggling their
eyebrows furtively in that general direction.)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#183 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AANyN66Jpd1a5dCHNeU9DMYhHEVAKqGMks5sNoOQgaJpZM4NmxR5>
.
|
@codygman No, 2 does not address 1. Sometimes you actually want the existing |
I'd like this too! I've had @godygman I don't think hurt to the reputation about being slow will be an issue since due to the same overlap issue newbies need to do some work to actually use these functions, either by hiding |
Sorry, folks, I'm not going to take this. I know this is a widely used function, but saving 5 or 6 keystrokes isn't worth expanding an already-big API. |
Hey Bryan, it's really about a lot more than 5 or 6 keystrokes. It's about uniformity and standardization. In different places and projects I've seen it called |
I revisited this ticket a few times, and however I try to persuade myself in the argument of @bos, my opinion remains unwavered. I must respectfully express my disagreement. I am also going to support it by mathematics.
The strategic consideration that I do not see mentioned before is that In JavaScript, there would already be a widely used single function package on |
It is Monday, 3 of October 2022. I am writing this function again. @Bodigrim please revisit this situation. Ideally maybe we can also add If we cannot even add this small function, then how can we ever hope to replace |
Fundamentally I'd like I have a question to the proponents of |
I definitely had written code like TL;DR existence of EDIT: also |
Converting Wrt discoverability, we can certainly advertise |
Let me put it this way: the right thing to do is to use |
I think that a somewhat loud or at least hard to ignore message discouraging users from using |
@codygman ... |
I strongly disagree. You cannot impose a one-size-fits-all definition of right in this situation. They're two different type classes and they have two different purposes. As I mentioned above, if I'm using |
Could you please elaborate? |
In the vast majority of situations I don't care about char-to-char compatibility or performance. I care about avoiding an additional (heavy) dep way more. |
The dependency footprint for |
All of them. You shouldn't have to incur a single extra dependency just to get a composition of two functions you're already depending on. It would still be unacceptable if its only dependency was |
And you don't have to; use This is not an argument: clearly you are not asking for any composition to be included. |
I think the thrust of @mightybyte's frustration here is that I propose the following:
As long as it's very clear what the morally blessed-way of doing things is, I don't think it will defeat any incentives to do the right thing. I think we're just diverging along the lines of what we find valuable. It's very clear that it's valuable simply in the number of times people have written the function independently and continued to want/ask/need it. |
In practice for me this has almost always been the case to be honest.
I agree with this and do sometimes use Show to one-off serialize/deserialize something while debugging. Show instances are used in hspec, quickcheck, etc. My main annoyance is the conversion busywork created by Show being string in text-by-default codebases combined with a desire for Haskell base to move to text by default. It's precisely because of conventions and ecosystem that make that move hard. I can personally avoid tangled webs of With that said, I think @emilypi's suggestion fixes the problem of people writing their own |
Thanks for the support! Alternatively, if someone wants to raise the proposal to the CLC, the more general form of this is sshow :: (Show a, IsString b) => a -> b
sshow = fromString . show Which would have a more appropriate home in |
I was going to say that rather than naming it But now, the |
The problem with I should like to have |
I don't see much technical merit, but I'm not fundamentally opposed and it seems there is a social merit in resolving this. However, could someone lead a community-wide discussion of a proper name ( |
I've conducted a poll on the discourse, which can be seen here, and which I'll close soon: https://discourse.haskell.org/t/vote-on-naming-of-show-a-a-text-function-in-data-text/10106. The poll allows for multiple choices so the below percentages don't quite add up to 100. At time of typing, I did not discuss the location of this function, but I can conduct another poll if wanted. |
Thanks @L0neGamer!
Do you envisage any options other than |
For the just Text variants I can't imagine anywhere else would make sense (unless someone were to take more drastic measures and bring Text into base). Especially since the vote seems to be for qualified variants, it makes a lot of sense to have one in each of Data.Text and Data.Text.Lazy. |
I'm content to follow vox populi and add |
Is it not a bit strange to shadow the method of a class you expect people to import ? People who want to use
People who want to use
or to use
Is it really what people voted for ???? |
You are not supposed to |
See: head, last, tail, init, length, null, map, reverse, all the fold functions, concats, any, all, maximum, minimum, and the list goes on. Over two days over 60 people replied to the poll, and 75% of them were in favour of the qualified name approach. |
This is all discussed above. You can't really import Data.Text unqualified, an qualified, |
Fair enough, but lots of people (including me) don't or only partially and use
True, but as pointed you can't really import Data.Tex unqualified which mean you are not using
Over 1 month over 600 people (discourse, reddit ...) would have had more weight in my opinion. Two days especially during summer holidays means that a few people didn't have the chance to even see the poll before it was closed. |
My apologies, I left it open for a couple of days, and then let bodigrim know what the current results were. Things moved quickly after that, and I only closed the poll after the additions were merged. If I do this in future I'll try to leave it open for longer and be clear when reporting results that we're waiting for further feedback. |
@maxigit there was no release yet, so in principle if you bring up convincing arguments the decision can be re-evaluated. E. g., you are welcome to conduct a poll on another platform over a longer period and see if it shows drastically different results. Or you can measure user habits with regards to qualified / unqualified imports, if this is what advances your argument. |
@Bodigrim I have a look on Hackage Search and find out that indeed Text is overwelmingly imported qualified, so another poll would probably give similar result. However that doesn't mean that the majority should make the life of the minority miserable. Even though Indeed, most people import Another alternative, as outrageous as it looks, miight be to add both Ultimately, I respect you and trust your judgement. I put my case forward and let you make an informed decision. |
In multiple different projects that I have worked on I've encountered variations on the following function:
It would be great if the text package could add this to eliminate the redundancy and confusion.
The text was updated successfully, but these errors were encountered: