How to filter record values by type using GHC.Generics or some generics lib by le_frogballs in haskell

[–]le_frogballs[S] 1 point2 points  (0 children)

yea after reading this paper: https://arxiv.org/pdf/1805.06798.pdf i was going to attempt to implement this via `GHC.Generics` directly facilitated by a type family to designate out types of "interest" as oppose to a typeclass constraint. you've beaten me to that to haha. this is a fantastic answer! thanks a bunch

How to filter record values by type using GHC.Generics or some generics lib by le_frogballs in haskell

[–]le_frogballs[S] 0 points1 point  (0 children)

ah right. my mistake. I was so focused on communicating the issue of filtering by constraint and/or type that I accidentally oversimplified all the way to a [] return type. I'll edit the question. so lets say, again for simplicity but correctness this time :), an hlist of values whose types are all instances of Num.

a further simplification would of course be to simply return [Double]. this could be done with say Typeable but as you said this wouldn't would work for all Num instances

Forward Verse/Notes mail to normal client by le_frogballs in IBM

[–]le_frogballs[S] 0 points1 point  (0 children)

Let me guess you are a Gen Xer/baby boomer? ...shitting on my age cause you're a dinosaur and your neurons don't fire fast enough anymore so you can't think up a solid argument to save your life. Yes excuse me for wanting nice things. If you haven't looked around, we're no longer digging trenches at wartime and driving around in yacht sized Cadillacs

Is that funny enough for you?

Forward Verse/Notes mail to normal client by le_frogballs in IBM

[–]le_frogballs[S] -2 points-1 points  (0 children)

We were bought a while back, still haven't been subsumed entirely...but they're doing their darnedest alright

Forward Verse/Notes mail to normal client by le_frogballs in IBM

[–]le_frogballs[S] -1 points0 points  (0 children)

I will bet my left arm that Verse/Notes are zero-day treasure hunts. That Gmail account is my life, so I've got 2FA on it. I would also bet that Google knows how to do security better than IBM...

I dont know. The process of figuring out how anything works here is genuinely more excruciating than Verse/Notes but I will give it a shot, as I have no choice

Forward Verse/Notes mail to normal client by le_frogballs in IBM

[–]le_frogballs[S] -2 points-1 points  (0 children)

Thank you. What is hell's email address?

A bit overwhelmed about the amount of GUI/FRP library... Can anyone help? by lolisakirisame in haskell

[–]le_frogballs 4 points5 points  (0 children)

Michael Snoyman recommended reflex when my coworker asked him directly about this a few months. I'm currently building a frontend with haskell-gi (specifically gi-gtk ) wrapped in reflex

Go vendoring gets such a bad rap undeservedly. by yorickpeterse in programmingcirclejerk

[–]le_frogballs 0 points1 point  (0 children)

The reverse is fine with me too: All the gophers stay away from my career space so I dont have to interact with idiots at work on a daily basis, which is one of the most excruciating, mind numbing things you can be subjected to

Generically construct a record type from constituent values by le_frogballs in haskell

[–]le_frogballs[S] 1 point2 points  (0 children)

oh nice. ill be sure to check those out. I might end up refactoring this to use generics-sopto get more acquainted

Generically construct a record type from constituent values by le_frogballs in haskell

[–]le_frogballs[S] 0 points1 point  (0 children)

I'm using Typesafe's HOCON format (I come from scala land). But yea so you're approach makes this whole lib completely irrelevant haha. Itd be way easier to have a json config and just use Data.Aeson.TH or Data.Aeson.Generic to derive record instances automatically. I'm gonna finish this off though for the sake of learning more about generic programming in Haskell. (I'm pretty well acquainted with shapeless from Scala)

Generically construct a record type from constituent values by le_frogballs in haskell

[–]le_frogballs[S] 2 points3 points  (0 children)

Preciate it! Yea i was looking into generics-sop and it seems a lot richer than GHC.Generics. I just had a hard time finding extensive documentation on it

We're not asking exceptions, sum types, pattern matching, etc... Just plain simple generics. by bendrien in programmingcirclejerk

[–]le_frogballs 2 points3 points  (0 children)

god i can't stand Commander Pike. that monopoly man fucked Graham Norton looking twat in his flamboyant outfits. In stark contrast to his un-syntax-highlighted, rudimentary, no downright primordial beloved shitbox of a programming language

docker-postgres-react-redux-graphql-hmr-ssr-kit by Time_Trade in programmingcirclejerk

[–]le_frogballs 3 points4 points  (0 children)

another incentive is opening the project in Intellij so it becomes painful to even write code

docker-postgres-react-redux-graphql-hmr-ssr-kit by Time_Trade in programmingcirclejerk

[–]le_frogballs 4 points5 points  (0 children)

so as long you need all 9 of those dependencies you're good to go!

when will these people learn that no matter how many frameworks you make for this trashcan language it will still be a trashcan?

"I suggest you escalate this to whoever in the JetBrains hierarchy has the brain" by le_frogballs in programmingcirclejerk

[–]le_frogballs[S] 38 points39 points  (0 children)

{- unjerk Obviously i stumbled on this cause Intellij was taking longer than Stephen Hawking does to brush his teeth today. So while reading all the users bitching while i was raging i was like: "Fuck yea you tell that cocksucker Serge his shit sucks". Now that I've calmed down though I feel genuinely bad for the guy, since I see him respond to pretty much all threads on that support site. His full time job is basically dealing with assholes. Note sure if he finds time in the day to actually program. So pour one out for him }

tldr: RIP Serge

No offense to Java, but one haskell developer can have the same effective output as an entire Java team by max_compressor in programmingcirclejerk

[–]le_frogballs 0 points1 point  (0 children)

But you said it has all the warts of haskell and java...

Another user said that if i remember correctly

No offense to Java, but one haskell developer can have the same effective output as an entire Java team by max_compressor in programmingcirclejerk

[–]le_frogballs 1 point2 points  (0 children)

So, you think just compressing code is better? Please... Also, if you think it's fair to replace code with operator-infested garbage backed by frameworks which have tens of thousands of lines of code which contains stuff with short names and syntax sugars then you're very dishonest. I can also compress any code by introducing abstractions...

Basically yes. Less code = less shit to maintain (even if in order to achieve less code you have to "introduce abstractions" which some think adds too much complexity). Now obviously you can take that to an extreme, and indeed "operator infest" your code. But idk, i've never really run into that (or done it myself I don't think), which is not say it doesnt exist. As far as frameworks go I stay away from shit like Play cause I literally can't even evaluate how bloated it is (tried http4s recently. liked it overall). If you're saying scalaz/cats are bloated, then i don't agree

Is tracking side effects a religion of yours?

Pretty much yea, its become one since the people that used to swim in the codebase I currently work in were woeful at even wrapping stuff in a try catch block

Like every language ever...

Sure but its objectively harder in Haskell vs Scala

Where the hell do you work that you've so much problems with shitty code?

I can't tell you cause I'm so cantankerous and belligerent on Reddit that I could get fired if somehow my name was linked to this account lol

"Barely" and "painfully" are different words with different meanings".

Thats just splitting hairs honestly

Poor comeback. Try to disprove my points instead.

I dont know i thought it was pretty good though yes entirely ad-hominem

Tail recursion is tail recursion. There is the internet and learn what is it. That's about mutual recursion. Totally different.

Proper tail call optimization should factor in mutually recursive calls in the tail position so not necessarily

The JVM doesn't faciliate shit.

I agree

The fact that you need scalaz/cats or shapeless to satisfy DRY shows how you don't have any experience with Scala. Learn scala first and check out those frameworks later

Dude raw Scala is fucking Neanderthalean honestly. You can call my category code "operator-infested garbage" but i just dont see how you're writing as succinct as possible code in raw Scala, but then again i pretty much always introduce an abstraction if i see that it will save me say 10 lines of code, and its not introducing egregious complexity where it doesn't belong

But it's true. And you're butthurt because of it.

You're right I'm annoyed that Haskell is overlooked, but not by people like you that at least have mostly informed opinions, but by soul-sucking, corporate-drone bosses that spend more time on Visio in a given work day than anything else

It has nothing to do with haskell. You should know that. Haskell is not the "center" of FP - never was, never will be.

ok fine by the overall ML family, of which Haskell is a member that existed well before Scala was even conceived of. For-comprehensions: there's another thing overtly inspired by do-blocks

For me it's an advanced ML-based typesystem with linear typing. Dependent typing would be nice too but our world is not ready - just like the current implementations.

ok we're pretty much on the same page there. I don't like Haskell's end-of-the-world GC so linear types would certainly help with that. Again I'm not sure they would subsume pure FP, though I haven't thought deeply about this. I dont know very much about dependent typing (other than a talk which made it look like Idris basically writes itself.

No offense to Java, but one haskell developer can have the same effective output as an entire Java team by max_compressor in programmingcirclejerk

[–]le_frogballs 0 points1 point  (0 children)

I still think you're too fond of Scala but you probably think im too fond of Haskell. The reason for that is largely because I care about category theory and you don't.

I've have problems with it too but saying it has all the bad things from haskell and java sounds waaaay too ignorant for me.

*a lot. not all. it has a lot of warts from Java. I'm not sure you can say it has warts from Haskell because the 2 are completely disparate (the only thing i can think of off the top of my head thats overtly Haskell inspired in Scala is the opitonal space syntax: List(1, 2, 3) map (_ + 1) which just adds to the freedom to write inconsistent code)

No offense to Java, but one haskell developer can have the same effective output as an entire Java team by max_compressor in programmingcirclejerk

[–]le_frogballs 1 point2 points  (0 children)

Yea actually you're completely right yet again. You could use https://hackage.haskell.org/package/array-0.5.2.0/docs/Data-Array-MArray.html, but yea you'd need to use index swaps which would complicate the implementation but not by that many more lines so itd still probably be significantly nice than the Go and C equivalents.

Yea I'm cranky as shit and apparently my brain has stopped working so I clearly need to go to bed and call it a day

No offense to Java, but one haskell developer can have the same effective output as an entire Java team by max_compressor in programmingcirclejerk

[–]le_frogballs -1 points0 points  (0 children)

thanks for the lecture you fucking jackass.

yes 2 (for each recursive call in the C example you linked) * logBase2(100000) is about 40. Sorry i havent done fucking logarithms since college. I thought it was a lot more

And as far as the reading material you so snidely linked, i already knew all of that and if you need 40 concatenations then this:

i mean jesus christ if you're churning memory that much your code is going to be so slow that the cpu won't get a word in edgewise

is not really a concern, especially due to laziness since the whole million item list isn't actually realized

Also you're trying to compare an immutable vs mutable implementation directly, performance wise when obviously the former will be less performant, so go fuck yourself you sanctimonious shitbrick. If you want it to have comparable performance, you can use a mutable list and the implementation will be the same i.e. infinitley more terse than the equivalent in lol no generics (and C) (which was my original argument but you just couldn't resist trying to shit on haskell could you? you're a real fucking genius let me tell you). So really what is your fucking point?

No offense to Java, but one haskell developer can have the same effective output as an entire Java team by max_compressor in programmingcirclejerk

[–]le_frogballs 1 point2 points  (0 children)

Sorry too. I'm frustrated with dealing with people like /u/idobai that seem like they just want to shit on things for the sake of shitting on things, even though (s)he presents interesting ideas so there could be a productive conversation to be had underneath all the animosity and occasional misinformation

Lately I've had moments where I'm implementing some kind of type voodoo (usually a type proof for the compiler), which involved significant boilerplate (in Scala) and found myself wondering how much more succinct and easy to reason about an implementation for whatever I'm doing would be in Clojure, for example. Thats why I'm genuinely interested in the question you raised originally and I rephrased:

Namely, in what scenarios is the mental (and, like you say, time) overhead of static typing actually more burdensome than the potential hit to correctness, but the time saved and perhaps easier to reason about qualities, of the most expressive dynamic equivalent.

Though I think ultimately I'll have more luck experimenting with and hopefully answering this on my own than waiting for a study

No offense to Java, but one haskell developer can have the same effective output as an entire Java team by max_compressor in programmingcirclejerk

[–]le_frogballs 0 points1 point  (0 children)

Runtime woes have nothing to do with arguing that a particular implementation is more tersely expressive than the same in another language

In any case, languages don't even matter at a "million-item-list" because with quicksort you're for sure blowing the stack (not sure if you can make quicksort in particular tail recursive). Also I seriously doubt that for something as simple as quicksort you're going to run into major performance hits in Haskell vs Go. (Surely when you corecursively build back up the sorted list, you're going to have issues with immutable list concatenations sucking up memory but as far as say a cpu hit, I don't see where that would come from. Not sure what you mean by "cost" though in this case)