Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-18 20:51:57 <d34df00d> having prior semantics
2021-04-18 20:52:03 <d34df00d> Like, map has some prior semantics.
2021-04-18 20:52:07 <monochrom> COBOL is the gold standard of using proper names >:)
2021-04-18 20:52:09 <d34df00d> fst, short for first, has some prior semantics
2021-04-18 20:52:09 × jumper149 quits (~jumper149@80.240.31.34) (Quit: WeeChat 3.1)
2021-04-18 20:52:19 <davean> safinaskar: you can do early return in Haskell also - your choice of layout here is hiding whats so crazy about that code I think
2021-04-18 20:52:28 <d34df00d> Speaking of which, I bet you find K, J and the likes as easy as Haskell or C or what not.
2021-04-18 20:52:33 <davean> d34df00d: no, it has semantics you've *learned* for that name already
2021-04-18 20:52:47 <safinaskar> davean: "even if you write it imperitive you can gain with Haskell because its only local and you can ignore it remotely" - i don't see any benefits here
2021-04-18 20:52:48 <seven_three> Is there a way I can speed up testing my foldable instance with the checkers library. Currently it takes about 30 seconds while my othere test are about instantaneous. I call it like so `QC.quickBatch $ QC.foldable (undefined :: MyType (String, String, String, Int, Int))`
2021-04-18 20:53:17 <davean> safinaskar: you know from outside how it can behave without understanding how it does it at all
2021-04-18 20:53:26 × Gurkenglas quits (~Gurkengla@unaffiliated/gurkenglas) (Ping timeout: 246 seconds)
2021-04-18 20:53:38 <d34df00d> davean: having some math-related education prior to haskell, I already knew the concept of mappings.
2021-04-18 20:54:02 <d34df00d> So while indeed I learned those semantics, they transfer way better to other domains.
2021-04-18 20:54:06 <safinaskar> monochrom: "and [ f i j | i <- [0..n], j <- [0..i] ]" - still i don't like that i have to call "and" instead of just perform early return from inside of imperative loop
2021-04-18 20:54:37 <d34df00d> And, as I said, it's just about using it often enough. I don't use lenses often, so to me they are one of the most obscure parts of the ecosystem.
2021-04-18 20:54:45 <davean> safinaskar: "and" does early return, and ios what you you do in that imperative loop
2021-04-18 20:55:16 <davean> d34df00d: I rarely use lens myself - it doesn't suit my purposes much - but its no harder to use than any other library I don't use
2021-04-18 20:55:18 heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-04-18 20:55:22 <d34df00d> safinaskar: if you're so inclined to code the early return explicitly, just write the corresponding recursive function explicitly.
2021-04-18 20:55:46 <davean> safinaskar: Why do you want to code the early return explicitely instead of just have it work BTW?
2021-04-18 20:56:01 <monochrom> That would be a semantic contention, thinking in control flow vs thinking in answers. And I won't convince you either way.
2021-04-18 20:56:39 <d34df00d> davean: dunno, my experience differs. I find it easier to approach most other libraries.
2021-04-18 20:57:08 <davean> d34df00d: when I first dealt with lens it was a single file with only a single comment saying something was probably broken
2021-04-18 20:57:26 <monochrom> You can fork lens and replace symbolic names by alphanum names.
2021-04-18 20:57:32 <monochrom> And btw both are names.
2021-04-18 20:57:45 <monochrom> The correct dichotomy is symbol vs alphanum.
2021-04-18 20:57:57 <davean> monochrom: I tried to make that comment above
2021-04-18 20:57:59 <monochrom> Even "meaningful vs meaningless" is not the correct dichotomy.
2021-04-18 20:58:06 <davean> the *only* different is fixity
2021-04-18 20:58:06 × mozzarella quits (~sam@unaffiliated/sam113101) (Ping timeout: 260 seconds)
2021-04-18 20:58:18 <d34df00d> It's not a dichotomy even, it's a spectrum.
2021-04-18 20:58:26 <davean> d34df00d: its not a spectrum
2021-04-18 20:58:30 <monochrom> For example "+" is a meaningful symbol, "foobarbaz" is a meaningless alphanum.
2021-04-18 20:58:31 <davean> they're litterly the same up to fixity
2021-04-18 20:58:45 <d34df00d> map is meaningful for somebody who has math background but about as meaningless as <$> for somebody who does not.
2021-04-18 20:58:46 <safinaskar> "is this style from somewhere? I can't imagine how you'd get here from reading how to program Haskell" - let me explain. i learn haskell using "learn you haskell for a great good". very good book. but i was always frustrated from indentation-based syntax (i came from c++), so i started to use curly braces. In function "lex" i check some condition,
2021-04-18 20:58:46 <safinaskar> if it holds, i return Nothing, if it doesn't hold, i check another condition, etc. I decided to check conditions using "case" as opposed to "if ... then ... else", because "case" allows me to use curly braces. conclusion: i started from "learn you haskell for a great good" style, then started to use curly braces (because of c++), then get rid of
2021-04-18 20:58:47 <safinaskar> "if...then...else". that is
2021-04-18 20:58:51 <d34df00d> davean: that's about meanings.
2021-04-18 20:58:56 <davean> d34df00d: if you read the Haskell report (you have, right?) theres only ONE difference
2021-04-18 20:58:56 Zunaka joins (~IceChat9@176.24.159.82)
2021-04-18 20:59:13 × Guest27054 quits (~textual@mskresolve-a.mskcc.org) (Ping timeout: 240 seconds)
2021-04-18 20:59:27 <d34df00d> I'm not talking about alphanum names vs symbolic names.
2021-04-18 21:00:12 <davean> d34df00d: but theres more meaning in the lens symbol names than almost any alphanum names since each symbol has a meaning and the order is significant so theres only one reasonable thing for any symbol sequence
2021-04-18 21:00:23 pthariensflame joins (~pthariens@2600:6c52:727f:4200:ecc8:7d66:24f2:c0bf)
2021-04-18 21:00:26 <davean> WTF do I have to defend lens? I hate it
2021-04-18 21:00:36 <d34df00d> davean: …which you don't really remember unless you use lens often enough.
2021-04-18 21:00:37 × pthariensflame quits (~pthariens@2600:6c52:727f:4200:ecc8:7d66:24f2:c0bf) (Client Quit)
2021-04-18 21:00:44 <davean> d34df00d: I don't have to remember them?
2021-04-18 21:00:54 <d34df00d> Also, my IDE sucks at completing symbolic names.
2021-04-18 21:00:56 mozzarella joins (~sam@unaffiliated/sam113101)
2021-04-18 21:01:00 <safinaskar> i checked checkbox "Wrap text at 78 characters" at paste.debian.net . here is not-wrapped version: http://paste.debian.net/1194214/
2021-04-18 21:01:31 ddellacosta joins (~ddellacos@86.106.143.157)
2021-04-18 21:01:35 <monochrom> There is no conflict between using {;} and using layout.
2021-04-18 21:01:39 <davean> safinaskar: but you have things like "do do"
2021-04-18 21:02:04 <davean> safinaskar: theres more going on here
2021-04-18 21:02:05 <monochrom> Just use {;} and still lay out code the same way other haskellers lay out code.
2021-04-18 21:02:11 × Zunaka_ quits (~IceChat9@176.24.159.82) (Ping timeout: 260 seconds)
2021-04-18 21:02:13 <davean> I don't think you understand the syntax if thats how you got here
2021-04-18 21:02:53 <monochrom> But if you use {;} and decided to lay out code to be abnormal, that's a conflict you created, not an intrinsic conflict.
2021-04-18 21:02:56 <d34df00d> Ok, I now have really stupid but serious question.
2021-04-18 21:02:57 <davean> Even for that, theres a lot of useless syntax in here that does nothing
2021-04-18 21:03:10 <davean> Litterly nothing
2021-04-18 21:03:26 <davean> I mean most of the places that brackets don't do anyhthing either mind you
2021-04-18 21:03:28 <monochrom> But see also https://twitter.com/HisCursedness/status/788690145822306304 >:)
2021-04-18 21:03:54 <monochrom> I imagine someone would same "that makes me angry", too.
2021-04-18 21:04:05 <monochrom> I mean, gosh, people can get angry at anything.
2021-04-18 21:04:31 <monochrom> s/same/say/
2021-04-18 21:05:05 <monochrom> Perhaps what you really need is anger management. Nothing to do with syntax or semantics or programming at all.
2021-04-18 21:05:05 <davean> safinaskar: Also, your use of ST here could be done with a loop function
2021-04-18 21:05:39 <davean> safinaskar: you might want to try a fold
2021-04-18 21:05:50 <davean> you can do your bracket style still
2021-04-18 21:06:05 <d34df00d> monochrom: ah, I remembered that picture too!
2021-04-18 21:06:06 <davean> safinaskar: right folds give you the same early exist
2021-04-18 21:06:10 × ddellacosta quits (~ddellacos@86.106.143.157) (Ping timeout: 252 seconds)
2021-04-18 21:06:28 <d34df00d> Anyway, here's my question. I'm using tasty-bench, and the output of `cabal bench` looks like this:
2021-04-18 21:06:42 <d34df00d> https://bpaste.net/LKPQ
2021-04-18 21:06:43 <monochrom> "and" is already a right-fold and does early exit, btw.
2021-04-18 21:06:47 <safinaskar> "you know from outside how it can behave without understanding how it does it at all" - i agree, but this argument is not enough for me
2021-04-18 21:06:52 <d34df00d> Damn, screw that.
2021-04-18 21:06:54 <davean> monochrom: mentioned that a few times
2021-04-18 21:07:00 <monochrom> :)
2021-04-18 21:07:16 <d34df00d> Compare the above to https://a.pomf.cat/swspsp.png .
2021-04-18 21:07:26 <davean> safinaskar: well its important if you want to change execution externally for example
2021-04-18 21:07:31 <monochrom> But I know people who insist on seeing explicit control flow in code, refuse hiding that behind a HOF.
2021-04-18 21:07:36 <d34df00d> I was about to ask where are my damn numbers but apparently tasty-bench does something funny with colors.
2021-04-18 21:07:43 <monochrom> At which point I just declare "control freak" and move on.
2021-04-18 21:07:43 Sorny joins (~Sornaensi@79.142.232.102.static.router4.bolignet.dk)
2021-04-18 21:07:57 <davean> safinaskar: I could at LEAST half the lines of code here by making it cleaner
2021-04-18 21:08:16 <davean> monochrom: thats why I mentioned a right fold, then its explicite
2021-04-18 21:08:49 <davean> I can make this MORE like C and make it shorter and cleaner too
2021-04-18 21:08:49 <monochrom> But that's also hiding it behind a function name "foldr", no?
2021-04-18 21:09:10 olligobber joins (olligobber@gateway/vpn/privateinternetaccess/olligobber)
2021-04-18 21:09:25 <monochrom> Also it takes a bit of education to learn that foldr, in Haskell (and not in other languages), by way of laziness can do early exit.
2021-04-18 21:09:28 <davean> monochrom: no? The end line of the passed function decides to continue or return generally - or the signature, depending on how you code it
2021-04-18 21:09:47 <monochrom> Oh, writing your own recursion?
2021-04-18 21:09:51 Sornaensis joins (~Sornaensi@077213200034.dynamic.telenor.dk)
2021-04-18 21:10:10 × malumore quits (~malumore@151.62.123.9) (Remote host closed the connection)
2021-04-18 21:10:41 <davean> Also, these nested ands

All times are in UTC.