Skip to content

Instantly share code, notes, and snippets.

@tonymorris

tonymorris/ban.txt

Created Jun 28, 2018
Embed
What would you like to do?
[20:09:49] <alexad> today I learned that apparently computer scientists think 0 is a natural number
[20:12:51] <alexad> is there a decent scala-check way to generate arbitrary case objects from a given trait from those that exist?
[20:13:00] <alexad> without providing a list to select from?
[20:14:22] *** Quits: veegee (~veegee@CPE9050cac64033-CM9050cac64030.cpe.net.cable.rogers.com) (Quit: veegee)
[20:14:58] <dibblego> I very doubt it. This question has been seen in many forms for many years. The correct answer has always been, if your data type is a finite set of nullary constructors, to write the value that enumerates them. There have been subsequent attempts to write "abstractions" on top of this, but they have all failed e.g. Enumeration.
[20:15:17] <alexad> :(
[20:15:27] <dibblego> /* e.g. */ object Bool { val allBools = List(false, true) }
[20:15:31] <alexad> dibblego, so fuck it yolo Gen.oneOf(A,B,C)
[20:15:35] <dibblego> I don't think this is a significant penalty
[20:15:38] <dibblego> No.
[20:15:43] <dibblego> Gen.oneOf(allBools)
[20:15:46] <alexad> ah
[20:15:51] <dibblego> don't write out the list over and over :)
[20:16:03] <dibblego> write it once, get it over and done with, then use it in all the different contexts e.g. Gen.oneOf
[20:16:16] <dibblego> accept that one-time cost, but only once :)
[20:16:37] <dibblego> do not use such things as Enumeration (I have seen other failed attempts, but you prolly won't bump into those)
[20:17:34] <alexad> yeah, I am not a fan of enumeration
[20:17:44] <dibblego> goodo
[20:17:58] <alexad> the cleanest thing I have found in scala land is still plain ol' sealed trait with case Object
[20:18:08] <dibblego> it took a lot of the usual scala bullshit discussion to get that point across, and I am not sure if there is the next flavour of bullshit to replace it
[20:18:25] <dibblego> right, same for me — just wasn't sure if that has been improved (I doubt it, but not sure)
[20:18:56] <dibblego> but, then just accept that one-time penalty of explicitly enumerating them, since otherwise, you risk repeatedly enumerating them
[20:19:35] <dibblego> for example, if you enumerate them, you can then do such things as Gen.oneOf, you can generate an Order instance, etc etc — it's useful in many different contexts
[20:22:30] <dibblego> getting scala programmers to say, "oh yeah maybe that is not a good idea", generally takes 10 years of discussion, with distractions, abuse and all the usual political garbage :)
[20:26:07] <alexad> I wish I knew why the fuck scalacheck's Gen.sequence yields a GOD DAMN java.util.ArrayList
[20:26:08] <alexad> what the fuck
[20:26:11] <alexad> who's fucking idea
[20:26:12] <alexad> jhdsflas
[20:26:26] <dibblego> try getting a scala programmer to say, "woops I have made a mistake", then you are on the path to knowing why :)
[20:26:40] <alexad> I make mistakes constantly.
[20:26:57] <dibblego> right, so now find peers who do similar.
[20:27:10] <dibblego> now try integrating that outlook on problem-solving with scala, the bigger picture
[20:27:48] <alexad> want an example of a mistake I'm doing now?
[20:27:49] <alexad> NonEmptyList.fromListUnsafe(bankCapabilitiesSeqed.asScala.toList)
[20:27:50] <alexad> :DDDD
[20:28:11] <alexad> Because fucking scalacheck will give me a got damn emptyset if I make the type set(which is what I originally intended)
[20:28:13] <dibblego> well, I cannot be sure of the types there, but yeah :)
[20:28:16] <alexad> and the test is testing OTHER THINGS
[20:28:29] <dibblego> what exactly is the problem, in types?
[20:28:29] <alexad> bankCapabilitiesSeqed is an ArrayList
[20:28:44] <dibblego> Gen.sequence is not generalised?
[20:28:48] <alexad> .fromListUnsafe and needing to .asScala.toList the output of Gen.sequence in SCALA CHECK
[20:29:09] <alexad> "hey guys I wrote a library called scala check. It outputs java types tho lol"
[20:29:11] <alexad> -_-
[20:30:11] <dibblego> scalacheck was written a *long* time ago, and although it made a few already-known errors at the time, it was way way way ahead of the general scala discussion in that respect, so I was compromising massively — scalacheck was way ahead
[20:30:30] <dibblego> where exactly is this function you speak of?
[20:30:43] <dibblego> https://github.com/rickynils/scalacheck/blob/master/src/main/scala/org/scalacheck/Gen.scala#L465 ?
[20:31:11] <dibblego> pass in a List[Gen[X]]
[20:31:28] <dibblego> and yeah, Traversable and Buildable are all fucking broken big time, and scala will never improve here
[20:31:40] <dibblego> just deal with the devil, calculate your costs
[20:33:04] *** Quits: butterthebuddha (~butterthe@ec2-13-228-73-171.ap-southeast-1.compute.amazonaws.com) (Max SendQ exceeded)
[20:33:23] *** Joins: butterthebuddha (~butterthe@ec2-13-228-73-171.ap-southeast-1.compute.amazonaws.com)
[20:35:00] <alexad> dibblego, wait, "I was compromising"
[20:35:06] <alexad> tony did you fucking write scalacheck TOO?
[20:35:16] <alexad> I am going to look at the contrib graph and if you're in the for fucks sakes
[20:35:41] <dibblego> I was an initial contributor, but I didn't do very much
[20:35:53] <alexad> yeah, 563 ++ 259---
[20:35:57] <dibblego> I thought it was going the wrong way, and wasn't prepared to fight that one :)
[20:35:59] <alexad> I was about to freak out
[20:36:33] <alexad> "Hi, yeah my name is Tony, I wrote scalaz, argonaut, scalacheck, and basically the entire standard library replacement ecosystem for scala no big deal hit me up bb"
[20:36:54] <dibblego> Ricky was one of the few scala programmers at the time with which you could have reasonable, public, technical discussions — aside from the political and abusive garbage that is entrenched in scala
[20:36:55] <alexad> tack in a "But no big deal or anything" in there ofc
[20:37:16] <dibblego> lol, don't let the savages hear you say that :)
[20:37:32] <alexad> it's okay I can pretend I'm one of them if they get pissy
[20:37:46] <alexad> I mean I'm an anarcha-socialist after all
[20:37:48] <dibblego> so can I, and they don't notice if I remove my name, funny that :)
[20:37:57] <dibblego> "I am you, dick head"
[20:38:30] <alexad> lel
[20:38:51] <alexad> I dunno
[20:39:08] <dibblego> what don't you know?
[20:39:13] <alexad> you may not agree with me politically but you're not exactly pushing a fascist agenda, so in my book you're "okay to talk to"
[20:39:28] <alexad> I don't get why some people freak out
[20:39:33] *** Quits: jameser (~textual@117.11.100.57) (Ping timeout: 240 seconds)
[20:39:35] <dibblego> my political view is, "why the fuck are we talking about political views?'
[20:39:41] <dibblego> I do.
[20:39:51] <alexad> everything is a political act in society to some degree or another.
[20:40:02] <dibblego> I understand this.
[20:40:22] <dibblego> for example, "your shitty views will incur a penalty if you bring them into my software project" is a political view
[20:40:24] <alexad> that said, you don't strike me as a "lynch the darkies" type person ;)
[20:40:32] <alexad> dibblego, indeed it is
[20:40:32] <dibblego> I don't know what that means
[20:40:57] <dibblego> or, you code of conduct, the real one, the one in practice, is one that I am prepared to abide by. Good luck with that.
[20:41:03] <alexad> I'm trying to say I don't think you're a fascist or a racist or a sexist so I mean, you're not "the enemy" in my book.
[20:41:25] <dibblego> I spend very little time thinking about those things.
[20:41:37] <alexad> but for some reason a bunch of people who aren't even as far left as I am regard you as "the enemy"
[20:41:40] <alexad> this is why I am perplexed.
[20:41:53] <dibblego> you should ask them, it's quite funny :)
[20:42:30] <dibblego> in the "incompetent and hypocritical and unaware of it" sense — it is comedic gold
[20:43:22] <dibblego> what is the political name you give to people, who are more interested in gaining power and influence over others, than writing working code?
[20:43:55] <dibblego> I am totally outside the loop of this kind of discussion. I care little for it. I am studying aviation right now, after having a general anaesthetic this morning.
[20:44:08] <alexad> authoritarian.
[20:44:27] <dibblego> ok yeah, then that is a significant component in resolving your dilemma
[20:45:30] <dibblego> I am also in the business of disempowering abusers, and rejecting imposition of how to respond to abusers (especially when that imposition is utterly incompetent i.e. codes of conduct)
[20:45:53] <dibblego> I put one in jail recently, for example
[20:46:32] <dibblego> but more so, disempowering the methods they use — this makes me a target. By being a target, they get really pissed. They get more pissed when I don't give a fuck that I am a target, and so on it spirals.
[20:46:49] <dibblego> anyway blah blah, it's really not a puzzle — just a long story
[20:47:13] <dibblego> it's pretty obvious to those who were there for the whole story, but understandable that it is perplexing if you were not
[20:54:51] <alexad> I suppose I don't look closely enough to make sense of it all
[20:55:14] <dibblego> I recommend this approach.
[20:55:24] <alexad> Also I've never been one to really understand the whole code of conduct thing
[20:55:42] <alexad> Like.... does one need a concrete document that outlines what is acceptable and what is not acceptable social behaviour?
[20:55:49] <dibblego> it's a political power play, masquerading as social progress
[20:55:54] <dibblego> it actually inhibits real progress
[20:56:05] <dibblego> well, obviously not, but that's a deflection from the real questions
[20:56:08] <alexad> I'm pretty sure if I just start saying "Hey tony wanna fuck" all the time I'm liable to get banned and I know damn well what I fucking did.
[20:56:30] <dibblego> you wouldn't actually, except that you an incorrect type of human to be saying that, ∴ yes you would
[20:56:40] <dibblego> correct kinds of humans are free to say these things, under the code of conduct
[20:56:54] <dibblego> (except they are not, because I will impose an economic penalty on it)
[20:57:19] *** Joins: ma27 (~ma27@2a00:cb0:8002:1055:2ad2:44ff:febf:834c)
[20:57:34] <alexad> incorrect as in, it seems not to be in my nature to say such a thing?
[20:58:00] <dibblego> you, the person, are not in the correct group that has self-regulated permission to say these things
[20:58:19] <dibblego> it is not that you might say such a thing, but who says it
[20:58:42] <alexad> and which group has the self-regulating permission to say such things, I wonder?
[20:58:47] <dibblego> that is how these codes of conducts work, especially the scala one, and the one that was attempted on scalaz
[20:59:11] <dibblego> the authors of the code of conduct, and then those over which they have influence
[20:59:22] <alexad> interesting
[20:59:29] <dibblego> I can demonstrate it if you like, but I haven't done it in a while
[20:59:44] <dibblego> you generally have to take advantage of the social ineptitude of the strategy
[20:59:55] <alexad> nah, I generally get the gist I think
[20:59:57] <dibblego> ok
[21:00:20] <alexad> by being the author you also implicitly assume the role of the entity entitled to enforce the rule
[21:00:35] <dibblego> you can say a thing, then know that if you are the correct kind of human to say it, then that is ok
[21:00:41] <alexad> and in that capacity it becomes quite easy to ignore your own crimes, so to speak
[21:00:59] <dibblego> then you can *blatantly* do that, and it will be identified that you are responding to individuals based on whether or not they are the correct kind of human
[21:01:25] <dibblego> yes, well, let me say this, I remember the idiots who used to come up with shit like this — they were always in the way of making actual progress
[21:01:51] <dibblego> the person I recently put in jail committed committed those crimes in 1995/1996
[21:02:12] <dibblego> the reason it takes so long is because of idiots who "make codes of conduct" or whatever the flavour of idiocy is that day
[21:03:41] <dibblego> Sinead O'Connor is a fucking hero.
[05:14:05] <SethTisue> questions/discussion on this on #scala-ops, please, not in the main channel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment