Logs: liberachat/#haskell
| 2021-06-10 09:38:16 | <xerox> | I have installed it via brew, brew info llvm shows you how to arrange the PATH (and optionally LDFLAGS and CPPFLAGS) to make it override the system clang |
| 2021-06-10 09:38:17 | <merijn> | maerwald: homebrew on the other hand *does* install into the main search paths because it wants to replace the system parts |
| 2021-06-10 09:38:21 | <xerox> | works well |
| 2021-06-10 09:38:55 | <maerwald> | well, I already installed via macports and I want it to work now |
| 2021-06-10 09:39:03 | → | mastarija joins (~mastarija@31.217.22.43) |
| 2021-06-10 09:39:09 | <xerox> | ok (: |
| 2021-06-10 09:42:42 | → | xkuru joins (~xkuru@user/xkuru) |
| 2021-06-10 09:45:43 | × | hmmmas quits (~chenqisu1@183.217.200.246) (Quit: Leaving.) |
| 2021-06-10 09:47:21 | <kritzefitz> | dminuoso, I think the most accurate you can get is with `clock_gettime(CLOCK_TAI)`, which should be unaffected by leap seconds or other such bureaucratic nonsense. But if you want to extract a day from that, you would need to make sure to use the correct `right/...` timezone to convert to your local time. |
| 2021-06-10 09:47:50 | <kritzefitz> | But I know of no existing bindings in haskell that allow to CLOCK_TAI. |
| 2021-06-10 09:48:08 | × | yd502_ quits (~yd502@180.168.212.6) (Ping timeout: 272 seconds) |
| 2021-06-10 09:49:03 | → | yd502 joins (~yd502@180.168.212.6) |
| 2021-06-10 09:49:45 | <kritzefitz> | But that still assumes that no one uses `clock_settime()` or similar to jump your system time backwards. |
| 2021-06-10 09:53:12 | × | chddr quits (~Thunderbi@31.148.23.125) (Ping timeout: 272 seconds) |
| 2021-06-10 09:58:26 | × | agumonke` quits (~user@88.160.31.174) (Read error: Connection reset by peer) |
| 2021-06-10 10:01:24 | <mastarija> | is there a way to "condense" multiple patternmatches into one, something in the line of `case value of A,B,C-> do_one_thing; D,E,F-> do_other_thing;`? |
| 2021-06-10 10:01:34 | → | agumonke` joins (~user@88.160.31.174) |
| 2021-06-10 10:02:05 | <mastarija> | I guess I could use `elem` if my dat has an ord instance, but I'm not thrilled about that |
| 2021-06-10 10:02:59 | <xerox> | mastarija: maybe with an helper function and a guard? |
| 2021-06-10 10:03:22 | <mastarija> | I mean, guard would require `elem`, right? |
| 2021-06-10 10:03:30 | <mastarija> | But I was hoping to avoid that :D |
| 2021-06-10 10:03:32 | → | alphacath joins (~alpha@host-79-36-63-89.retail.telecomitalia.it) |
| 2021-06-10 10:03:47 | <dminuoso> | mastarija: Mmm, this can be described lens/optics, but I dont know whether that fits the rest of your usage pattern. |
| 2021-06-10 10:03:58 | <mastarija> | dminuoso, not really |
| 2021-06-10 10:04:06 | <mastarija> | I was hoping for something simple |
| 2021-06-10 10:04:30 | <dminuoso> | mastarija: Then use PatternSynonyms |
| 2021-06-10 10:04:31 | <mastarija> | I'm kind of missing the "fall through" behaviour of switch from other languages |
| 2021-06-10 10:04:46 | <dminuoso> | Yeah. You can mimic them with PatternSynonyms |
| 2021-06-10 10:04:47 | <xerox> | I was thinking something like data Thing = A | B | C | D; good A = True; good B = True; good _ = False; f thing | True <- good thing = <case for A and B together> |
| 2021-06-10 10:05:29 | × | chomwitt quits (~Pitsikoko@athedsl-20549.home.otenet.gr) (Ping timeout: 245 seconds) |
| 2021-06-10 10:05:37 | → | pavonia joins (~user@user/siracusa) |
| 2021-06-10 10:05:49 | × | azeem quits (~azeem@dynamic-adsl-94-34-34-125.clienti.tiscali.it) (Ping timeout: 244 seconds) |
| 2021-06-10 10:05:49 | <mastarija> | xerox, I was looking for something more "adhoc", this would require defining a helper function every time I want this behavior |
| 2021-06-10 10:05:50 | <dminuoso> | mastarija: Also, do these constructors have fields? Or is this just a sum of nullary constructors? |
| 2021-06-10 10:05:58 | <mastarija> | just a sum |
| 2021-06-10 10:06:07 | × | agumonke` quits (~user@88.160.31.174) (Remote host closed the connection) |
| 2021-06-10 10:06:25 | <xerox> | could probably be subsumed into a pattern synonym like pattern AorB <- ... so you can always define your functions on Thing matching on AorB, C, D .. |
| 2021-06-10 10:06:39 | <dminuoso> | Then you can use case () of _ | x `elem` [A,B,C] -> ...; x `elem` [D,E] -> ....;` |
| 2021-06-10 10:06:45 | <mastarija> | But yeah, now that I think about it, this could be nice language extension :) |
| 2021-06-10 10:06:47 | <dminuoso> | (or perhaps directly in function cards) |
| 2021-06-10 10:06:58 | → | azeem joins (~azeem@176.200.249.22) |
| 2021-06-10 10:07:07 | <dminuoso> | mastarija: It's either this or PatternSynonyms. |
| 2021-06-10 10:07:16 | <xerox> | check out the example here if you're unfamiliar with those, maybe that'll work well for you? https://downloads.haskell.org/~ghc/8.10.5/docs/html/users_guide/glasgow_exts.html#pattern-synonyms |
| 2021-06-10 10:07:16 | <mastarija> | I'm gonna check the PatternSynonyms |
| 2021-06-10 10:07:38 | <mastarija> | I took a peek some time ago, but didn't have much use for them |
| 2021-06-10 10:07:51 | <mastarija> | This could be a good opportunity to check them out :D |
| 2021-06-10 10:08:17 | <dminuoso> | mastarija: https://gist.github.com/dminuoso/20dcc292c7e9536e6fd3ab73b7d83889 |
| 2021-06-10 10:08:24 | <dminuoso> | This is what it would look like with elem |
| 2021-06-10 10:08:51 | <mastarija> | dminuoso, yes, I know that but I kind of wanted to avoid elem |
| 2021-06-10 10:09:00 | <mastarija> | you've probably missed that :D |
| 2021-06-10 10:09:18 | <dminuoso> | What's wrong with elem? |
| 2021-06-10 10:10:38 | <mastarija> | noise? |
| 2021-06-10 10:10:42 | <nsilv> | it's basically Or patterns... so it is very old but there's this: https://hackage.haskell.org/package/OrPatterns |
| 2021-06-10 10:12:36 | <mastarija> | dminuoso, ah yes, another thing with elem is that it requires `Eq` |
| 2021-06-10 10:13:11 | <mastarija> | that's also what I was trying to avoid |
| 2021-06-10 10:13:22 | × | dhil quits (~dhil@195.213.192.47) (Ping timeout: 244 seconds) |
| 2021-06-10 10:14:03 | <nsilv> | sadly or patterns seem pretty much dead? https://github.com/ghc-proposals/ghc-proposals/pull/43 |
| 2021-06-10 10:14:52 | → | martin02 joins (silas@hund.fs.lmu.de) |
| 2021-06-10 10:14:54 | <mastarija> | nsilv, and I'm not really going to download a lib for such a minor thing :D |
| 2021-06-10 10:15:03 | <mastarija> | I was hoping there was something in the language already |
| 2021-06-10 10:15:09 | <mastarija> | But it's not a big deal |
| 2021-06-10 10:16:17 | <nsilv> | yeah there were thoughts of doing it (I think it's in both OCaml and F#, maybe SML too?) the ticket just stalled. Which is sad, it's a small but very useful feature |
| 2021-06-10 10:17:38 | → | nschoe joins (~quassel@2a04:cec0:1140:d70e:246d:fa9d:5f2c:423e) |
| 2021-06-10 10:18:08 | <DigitalKiwi> | why make something so minor part of the language if you can just download a lib? |
| 2021-06-10 10:19:43 | × | fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Remote host closed the connection) |
| 2021-06-10 10:20:38 | <yushyin> | or-patters have a long history of not beeing implemented in haskell/ghc :D |
| 2021-06-10 10:23:11 | × | xkuru quits (~xkuru@user/xkuru) (Read error: Connection reset by peer) |
| 2021-06-10 10:23:45 | → | zeenk joins (~zeenk@2a02:2f04:a310:b600:b098:bf18:df4d:4c41) |
| 2021-06-10 10:24:59 | → | fizbin joins (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) |
| 2021-06-10 10:26:03 | → | chomwitt joins (~Pitsikoko@2a02:587:dc02:b00:98b0:cd42:bd6f:8295) |
| 2021-06-10 10:26:21 | → | dhil joins (~dhil@80.208.56.181) |
| 2021-06-10 10:29:05 | <dminuoso> | Me personally, Ive just become accustomed to repeating case-of branches. It's an annoyance, but in the grand scheme of things there's many other more pressing things that I want in Haskell. |
| 2021-06-10 10:29:23 | <dminuoso> | Like circular imports |
| 2021-06-10 10:29:36 | <dminuoso> | (By Haskell I mean GHC Haskell, of course) |
| 2021-06-10 10:29:56 | × | fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Ping timeout: 272 seconds) |
| 2021-06-10 10:30:05 | <dibblego> | optics are better anyway |
| 2021-06-10 10:30:29 | <dminuoso> | dibblego: If they fit the usage pattern, anyway. |
| 2021-06-10 10:30:40 | <dibblego> | the what? |
| 2021-06-10 10:31:13 | × | nsilv quits (~nsilv@212.103.198.210) (Quit: WeeChat 3.0.1) |
| 2021-06-10 10:31:27 | <dminuoso> | optics are not a universal replacement for case-of |
| 2021-06-10 10:31:38 | <dibblego> | yes they are |
| 2021-06-10 10:32:01 | → | pbrisbin joins (~patrick@pool-72-92-38-164.phlapa.fios.verizon.net) |
| 2021-06-10 10:34:29 | ← | Voeid parts (luke@voeid.cf) (Leaving...) |
| 2021-06-10 10:36:19 | × | azeem quits (~azeem@176.200.249.22) (Ping timeout: 245 seconds) |
| 2021-06-10 10:36:39 | <dminuoso> | If by that you mean "one can mechanically replace a usage of case-of with optics", then that's not saying much. |
| 2021-06-10 10:37:02 | <dminuoso> | My point is, they are not universally better at discriminating values than case-of. |
| 2021-06-10 10:37:09 | <dibblego> | yes they are |
| 2021-06-10 10:37:21 | <dminuoso> | Okay. |
| 2021-06-10 10:37:58 | <dibblego> | fallacy of false middle — show me the counter-example! |
| 2021-06-10 10:38:06 | → | yd502_ joins (~yd502@180.168.212.6) |
| 2021-06-10 10:38:18 | → | Guest9836 joins (~Guest98@156.217.248.178) |
| 2021-06-10 10:38:53 | <mastarija> | dminuoso, I wonder how much effort it would be to add that feature to Haskell, and if this might be a good starter project to get familiar with GHC internals |
| 2021-06-10 10:39:38 | <mastarija> | i was thinking of starting to dig through GHC, so this might be a good starter |
| 2021-06-10 10:39:43 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 244 seconds) |
| 2021-06-10 10:40:23 | × | adanwan quits (~adanwan@gateway/tor-sasl/adanwan) (Remote host closed the connection) |
| 2021-06-10 10:40:30 | × | teaSlurper quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2021-06-10 10:40:33 | → | eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:2121:a570:d35e:ba7a) |
| 2021-06-10 10:40:36 | → | adanwan joins (~adanwan@gateway/tor-sasl/adanwan) |
| 2021-06-10 10:41:13 | → | teaSlurper joins (~chris@81.96.113.213) |
| 2021-06-10 10:41:14 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
All times are in UTC.