×
Login Register an account
Top Submissions Explore Upgoat Search Random Subverse Random Post Colorize! Site Rules
5

There are too many string types in Haskell

submitted by deleted to Rants 1.3 yearsJan 5, 2023 20:55:43 ago (+5/-0)     (Rants)

deleted


21 comments block


[ - ] ReturnOfTheGoats 2 points 1.3 yearsJan 5, 2023 22:37:51 ago (+2/-0)

Did you ever figure out what the hell a monad is?

[ - ] v0atmage 0 points 1.3 yearsJan 7, 2023 15:01:42 ago (+0/-0)

Good news, everyone! You don't need monads (as much) anymore if your programming language support algebraic effects.

[ - ] x0x7 [op] 1 point 1.3 yearsJan 5, 2023 21:19:39 ago (+1/-0)*

Just for example I will code the nodejs equivelent in litterally 30 seconds.

async function extractgetfile(url) {
var response = await fetch(url);
var body = await response.text();
return body.split("'").filter(i=\>i.indexOf('/get_file/')!=-1);
}

Done. But if you do it in Haskell you make 40% more. This site needs better code support.

[ - ] PotatoWhisperer 0 points 1.3 yearsJan 5, 2023 23:02:54 ago (+0/-0)

This site needs better code support.

Is it bad that I could read it anyway?

I cut my teeth on java, still like it. Of course they had us do several dozen other languages as projects as well. Never did Haskell though, and from the sounds of it I'm glad.

[ - ] x0x7 [op] 0 points 1.3 yearsJan 6, 2023 07:12:11 ago (+0/-0)

I had to fiddle with it a lot to even get that to show.

[ - ] Belfuro 0 points 1.3 yearsJan 6, 2023 15:14:22 ago (+0/-0)

Js is such a poor language beyond what it was originally designed for.

All the bullshit modern pathetic attempts to alter that state of affairs like typescript shit me.

And your example is the fucking worst.
"oh let's allow front end devs to make backend code by using Js as a back in but wrap it in shit loads of libraries to make it work so much so that node.js is its own child language.

[ - ] x0x7 [op] 0 points 1.3 yearsJan 7, 2023 20:10:04 ago (+0/-0)

How is the example bad. To be fair, I've implemented it in Go as well. It's cleaner in JS. The real problem is memory management in JS (kind of something you care about on a server). As a language, before OOP did Comp Sci as a major because I was told it would pay well shit-devs were told to migrate to it by their employer needed typescript, and before every hipster dev needed to code things in obscure frameworks so he can build his resume it was a fine language.

Guess what, as that same crowd ditches node they are going to ruin another language with framework hell. That state of affairs can be brought to any language.

But now I've moved on from Haskell, and on from Go, and I found a language so un-cool (and yet so well paying) that no hipster will ever dare ruin it. Perl. I found more reliable intelligence. It's actually the highest paying language. It actually does something useful besides serve people social media content, and it's unpopularity has made it unsaturated despite its real world usefulness.

Best yet, it doesn't have 50 billion string types.

[ - ] Belfuro 0 points 1.3 yearsJan 8, 2023 21:19:00 ago (+0/-0)

I never got into perk but I've heard nothing but good things.

Senior. Net full stack dev pays well enough.

Well it did until inflation hit like a mofo.

Ps. Framework hell. I like it. Fitting.
Frameworks are ruining the industry. IMHO.

[ - ] SecretHitler 0 points 1.3 yearsJan 6, 2023 02:21:30 ago (+0/-0)

nodejs is also trash

[ - ] x0x7 [op] 0 points 1.3 yearsJan 6, 2023 06:55:01 ago (+0/-0)

Yeah. That's why I'm trying to learn a different language. I saw the bullshit coming a long time ago and I did the wrong thing in regard to it. I figured if it's bullshit I'm not going to learn it because I can solve problems better without Typescript or React. So now I have outdated skills in a now bullshit language. I fucked up. I either needed to go along with the hivemind's bullshit or ditch ship. I did neither.

If I'm forced to learn a new language I might as well learn the highest paying one. I just wish it wasn't fucktarded.

[ - ] SecretHitler 0 points 1.3 yearsJan 6, 2023 07:49:00 ago (+0/-0)

That all makes sense. If it was me though I'd just get the job I want first and then learn the language they need. Once you learn your first one learning new ones isn't so bad.

Either that or find one I love to code in and then find a job to match. If I hate it how will I ever be the best at it?

But that's just me, going for the money is valid too.

[ - ] x0x7 [op] 0 points 1.3 yearsJan 6, 2023 10:26:41 ago (+0/-0)

I agree that learning languages isn't hard. I know more than I can count (or I'm at least rusty in more than I can count because some of them I haven't touched in years). Haskell though. It's not built like the others.

I'm probably going to move to go, but my sense of persistence doesn't let me give up on Haskell just yet even thought it's probably for the best if I do. "Whatever, I couldn't learn it." Isn't really how I approach things.

[ - ] Belfuro 0 points 1.3 yearsJan 6, 2023 00:14:46 ago (+0/-0)

Strings in c c++ are fucking awful.

Every dive into shit reminds me to be grateful for c#

[ - ] x0x7 [op] 1 point 1.3 yearsJan 6, 2023 07:03:47 ago (+1/-0)

Oh, I don't mind c strings at all. I've never found memory management hard at all in c. Especially once you start doing more performance oriented code in c that part ironically becomes easier. C is only good for performance now, which means if you are writing something that justifiably could be written in c you are avoiding mallocs in the main operation of your code like the plague. If you aren't mallocing constantly then you aren't freeing constantly.

The correct way to write C (and I wish they taught this in school) is do everything you can to allocate up front and pass your memory to children. Then when a function has returned you can reuse the memory you gave it on other functions if it was just working memory. Then you just get good at pointer arithmetic and the strings are among my favorite.

[ - ] Belfuro 0 points 1.3 yearsJan 6, 2023 13:34:02 ago (+0/-0)*

Youre mad as a hatter.

I get it.
Youre probably the guy with the mindset of an artist or architect.

For me, coding is just a tool. It's the end product I'm passionate about. The puzzle solving.

C# just enables me to do that.

Now I'm not a cpp dev. Just been forced to help out occasionally and did not enjoy the experience.

rubs c# lovingly.

Which is funny. Go back to 2000s and I thought that asp.net was the biggest pos, so much so that I preferred php.

Now I really do prefer the direction Ms went in. Razor. Signal ir. Even. Net core grew on me.

Net 7 seems to have had a nice performance boost.

[ - ] x0x7 [op] 0 points 1.3 yearsJan 7, 2023 20:26:22 ago (+0/-0)

I mean, I do hate OOP. Java left a bad taste in my mouth. In a way I didn't realize it at the time because it's what I knew. But once I touched pretty much everything without OOP or with a culture of not over using it (JS, before typescript), I realized creating and keeping track of convoluted org charts is a waste of time when you just want to solve a problem. To do that you have a common and simple form of data that everyone is familiar with manipulating, and you manipulate it. Simple. In C that's raw buffers of memory. In JS that's dictionaries. Everything in C is just memory. Everything in JS is just a dictionary. Now you don't need to know what obscure methodology is used to convert one kind of thing to another, or what obscure set of functions will give you access to modify something. Closures are better anyway. Encapsulation is actually a bad practice. You want to expose as much surface area as possible to offer as much value as possible. OOP is all about wrapping things behind walls.

[ - ] Belfuro 0 points 1.3 yearsJan 8, 2023 13:52:50 ago (+0/-0)

Oop has become a religion.
Taught to kids causing entrenchment.

I once borrowed a small library to perform a task I needed.

The most pure Oop I've ever seen.

1100 lines of code in 6 files.

All of it Oop wrappers for the ten lines of curl code that actually did all the work.

Blew my mind.

[ - ] v0atmage 0 points 1.3 yearsJan 5, 2023 22:47:43 ago (+0/-0)

Aren't Type Classes the solution to most of your string compatibility problems?

[ - ] Belfuro 0 points 1.3 yearsJan 6, 2023 15:15:08 ago (+0/-0)

Yeah typically use cpstring but that brings its own headaches

[ - ] bonghits4jeebus 0 points 1.3 yearsJan 5, 2023 22:17:52 ago (+0/-0)

I don't know what people's obsession with linked lists is. Literally most of the time your code would be faster with a growable vector.

And functional LISP people are just high

[ - ] x0x7 [op] 0 points 1.3 yearsJan 6, 2023 07:10:00 ago (+0/-0)

I agree. It's memory inefficient, generates way to many calls to malloc for tiny pieces of memory during the operational phase of your program (vs initialization), and is less efficient to operate on.

What Haskell really needs to do is entirely ditch the built in string for either a c-string or a utf16-string, so people can stop working around it.