Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-21 20:00:04 <Feuermagier> we don't have lambda, but we have 🦙
2020-11-21 20:00:16 <merijn> The fact that GHC compiles this package https://hackage.haskell.org/package/acme-lookofdisapproval-0.1/docs/Acme-LookOfDisapproval.html is technically a violation of the Haskell Report
2020-11-21 20:00:33 → kritzefitz joins (~kritzefit@212.86.56.80)
2020-11-21 20:01:23 <merijn> Constructor names must start with a capital letter and non-constructor names must start with a lowercase letter or _
2020-11-21 20:01:30 <merijn> Notice the flaw?
2020-11-21 20:01:47 <gentauro> anybody here using `xmobar`?
2020-11-21 20:02:03 <gentauro> I would like to hide it for one of my `workspaces`
2020-11-21 20:02:04 <gentauro> :)
2020-11-21 20:02:32 <gentauro> (by default, but maybe show it with some Xmonad shortcut)
2020-11-21 20:02:34 <merijn> GHC (technically wrongly) lets non-constructor names start with "non-uppercase letters or _", rather than lowercase letter of _ :p
2020-11-21 20:02:38 <merijn> > isUpper 'ಠ'
2020-11-21 20:02:40 <lambdabot> False
2020-11-21 20:02:42 <merijn> > isLower 'ಠ'
2020-11-21 20:02:44 <lambdabot> False
2020-11-21 20:03:03 <gentauro> merijn: you can't use lowercase greek letters for constructors
2020-11-21 20:03:04 <merijn> > isLetter 'ಠ'
2020-11-21 20:03:07 <lambdabot> True
2020-11-21 20:03:09 <gentauro> but you can use the uppercase
2020-11-21 20:03:43 → conal joins (~conal@64.71.133.70)
2020-11-21 20:03:43 <merijn> gentauro: 1) you can use lowercase greek letters for constructors, just not the first one, 2) I didn't say that? :)
2020-11-21 20:04:09 <zyklotomic> gentauro: if you want immediate relief, i think the default is modifier-b
2020-11-21 20:05:04 <geekosaur> gentauro, I think https://github.com/geekosaur/xmonad.hs/blob/pyanfar/xmonad.hs#L142 is as close as you get
2020-11-21 20:05:06 <zyklotomic> i'm not sure about how to make it a rule though
2020-11-21 20:05:15 <zyklotomic> oh ^ maybe geekosaur has it
2020-11-21 20:05:32 <zyklotomic> merijn: that is one great hidden gem lol
2020-11-21 20:05:50 <geekosaur> (note also the avoidStruts on the following line, for all the other workspaces)
2020-11-21 20:07:00 <zyklotomic> is there a way around this following pattern? "segment str . viterbi hd $ str"
2020-11-21 20:07:17 <zyklotomic> where str has to be used as an argument for both `segment' and `viterbi'
2020-11-21 20:08:07 <dminuoso> liftA2 (.) segmetn (viterbi hd) $ str
2020-11-21 20:08:12 <dminuoso> Not sure that's any better though.
2020-11-21 20:08:36 <dminuoso> Or: (.) <$> segment <*> vierbi hd $ str
2020-11-21 20:08:52 <dminuoso> no wait, that's not the same
2020-11-21 20:08:52 <merijn> or...crazy idea
2020-11-21 20:08:53 <zyklotomic> yeah I have liftA2 ominously imported before I asked
2020-11-21 20:08:59 <gentauro> geekosaur: thanks, I will give it a try :)
2020-11-21 20:09:00 <merijn> Write a lambda/put it into a let/where binding
2020-11-21 20:09:13 × daGrevis quits (~daGrevis@unaffiliated/dagrevis) (Ping timeout: 260 seconds)
2020-11-21 20:09:33 <zyklotomic> but is `liftA2 (.)' kinda a bit too crazy?
2020-11-21 20:09:34 <dminuoso> or.. it is the same. I really dislike using the monadic interface of Reader
2020-11-21 20:09:37 <merijn> I know, I know...it's outrageous...but it's so crazy it just might work!
2020-11-21 20:09:43 <gentauro> geekosaur: funny enough, it's to run a vm with `win 10` xD
2020-11-21 20:09:47 <dminuoso> zyklotomic: It is.
2020-11-21 20:09:48 <zyklotomic> i think i abuse `liftA2 (.)' too much
2020-11-21 20:10:01 <merijn> zyklotomic: Probably
2020-11-21 20:10:25 <dminuoso> One of the issues with overusing Applicative in the middle of code, is that it's sometimes not immediate obvious which instance is being used.
2020-11-21 20:10:33 <merijn> Here's a great tip from coming back to a huge codebase with 6 month to 1 year intervals: Putting stuff in let/where and giving stuff names is a pretty great idea
2020-11-21 20:11:01 <merijn> liftA2 (.) is a great way to hate yourself
2020-11-21 20:11:34 <zyklotomic> yeah ok, I sane-ed up a lil and deleted it
2020-11-21 20:11:42 <zyklotomic> thanks y'all
2020-11-21 20:11:45 <dminuoso> zyklotomic: Personally Id just write parens.
2020-11-21 20:11:57 <dminuoso> segment str (vierbi hd str)
2020-11-21 20:12:02 <dminuoso> perhaps with a let/where binding
2020-11-21 20:12:10 <dminuoso> There's no need to try and get cute her
2020-11-21 20:12:12 → magma joins (~magma@host-87-20-128-180.retail.telecomitalia.it)
2020-11-21 20:12:16 <dminuoso> It certainly doesnt *improve* readability
2020-11-21 20:12:29 <zyklotomic> yeah, I was just wondering if there was a way to avoid that double invoctaion of str somehow
2020-11-21 20:12:40 <dminuoso> zyklotomic: since its named, it will be shared anyhow.
2020-11-21 20:12:43 → daGrevis joins (~daGrevis@unaffiliated/dagrevis)
2020-11-21 20:12:46 <dminuoso> (likely)
2020-11-21 20:13:02 <zyklotomic> yeah, but aesthectically.... think about the a e s t h
2020-11-21 20:13:03 × Jesin quits (~Jesin@pool-72-66-101-18.washdc.fios.verizon.net) (Quit: Leaving)
2020-11-21 20:13:12 <dminuoso> aesth?
2020-11-21 20:13:25 <zyklotomic> i'm jokin tho /s
2020-11-21 20:13:29 <tomsmeding> @pf \str -> segment str (viterbi hd str)
2020-11-21 20:13:30 <lambdabot> Maybe you meant: pl bf
2020-11-21 20:13:33 <tomsmeding> @pl \str -> segment str (viterbi hd str)
2020-11-21 20:13:33 <lambdabot> ap segment (viterbi hd)
2020-11-21 20:14:01 <dminuoso> 21:10:33 merijn | Here's a great tip from coming back to a huge codebase with 6 month to 1 year intervals: Putting stuff in let/where and giving stuff names is a pretty great idea
2020-11-21 20:14:05 <dminuoso> This.
2020-11-21 20:14:17 <tomsmeding> also if you use ap, think thrice and make a sacrifice
2020-11-21 20:14:17 <zyklotomic> yah, i'm going to stick with that
2020-11-21 20:14:28 <dminuoso> There's no single better general purpose technique to improve readability than to move things into let/where bindings.
2020-11-21 20:14:37 <dminuoso> If the code becomes too complex, use more bindings.
2020-11-21 20:15:16 <dsal> A lot of my programming was in RPL ("reverse polish lisp", a forth-like language on my HP48). I almost never used variables. heh
2020-11-21 20:15:28 <zyklotomic> i tihnk i'm at the stage of learning in haskell where I want to know whether there are "better" ways to do what I'm doing
2020-11-21 20:15:37 <zyklotomic> whether going out of my way to worry about that is a worthwhile pursuit idk
2020-11-21 20:15:41 <dsal> Never leave that stage.
2020-11-21 20:15:48 <tomsmeding> zyklotomic: http://pointfree.io/
2020-11-21 20:15:56 <tomsmeding> infinite supply of unreadability
2020-11-21 20:16:14 <dsal> But sometimes something like liftA2 is obviously beneficial. Something obscuring things doesn't help much.
2020-11-21 20:16:35 × magma quits (~magma@host-87-20-128-180.retail.telecomitalia.it) (Client Quit)
2020-11-21 20:16:51 <dsal> making things pointfree is helpful when you have `\f x -> g 3 x` or something.
2020-11-21 20:17:19 ski . o O ( s/pointfree/pointless/ )
2020-11-21 20:17:35 <tomsmeding> hence the naming of @pl
2020-11-21 20:17:43 <zyklotomic> tomsmeding: ohhh
2020-11-21 20:17:55 <dsal> In that case, you look and see the x on both sides, and you remove it. Then you see `\f -> g 3` and then you're like, why did I even have a lambda there?
2020-11-21 20:17:56 <dminuoso> tomsmeding: Oh.. haha really?
2020-11-21 20:17:59 <dminuoso> I always wondered about that one
2020-11-21 20:18:16 <ski> @help pl
2020-11-21 20:18:16 <lambdabot> pointless <expr>. Play with pointfree code.
2020-11-21 20:18:33 <dminuoso> zyklotomic: I found GHC to be a great source for ideas how to make readable code
2020-11-21 20:18:50 <dsal> Actually, I'm being a bit dumb. But in general, you can try a couple things and whichever makes the most sense to you wins.
2020-11-21 20:18:55 <dminuoso> It is surprisingly readable
2020-11-21 20:19:00 <dsal> Also, that metric will change over time.
2020-11-21 20:19:13 <zyklotomic> yeah, because like idk how to describe the feeling, but the cliche adage
2020-11-21 20:19:20 <zyklotomic> "the more you know, the more you don't know"
2020-11-21 20:19:33 <dminuoso> Perhaps this is a process people need to go through
2020-11-21 20:19:50 × knupfer quits (~Thunderbi@200116b82ce1e1001cbbbad91fc51f3d.dip.versatel-1u1.de) (Ping timeout: 264 seconds)
2020-11-21 20:19:53 <dminuoso> You dont know why certain styles are unmaintainable unless you use them. Or it teaches why they could be useful
2020-11-21 20:20:02 × henninb quits (~henninb@63.226.173.161) (Quit: leaving)

All times are in UTC.