2022-12-12 00:01:43 +0100 | tomsmeding | is surprised ghc-gc-hook got used by >1 person |
2022-12-12 00:03:46 +0100 | mvk | (~mvk@2607:fea8:5ce3:8500::efb) |
2022-12-12 00:04:30 +0100 | j4cc3b | (~jeffreybe@pool-74-105-2-138.nwrknj.fios.verizon.net) (Ping timeout: 256 seconds) |
2022-12-12 00:08:23 +0100 | <dsal> | I don't think we're *using* it, but we do have a few weird things show up that strongly imply the GC is slowing things down without any useful data to confirm that. |
2022-12-12 00:08:45 +0100 | califax_ | (~califax@user/califx) |
2022-12-12 00:09:11 +0100 | califax | (~califax@user/califx) (Ping timeout: 255 seconds) |
2022-12-12 00:10:00 +0100 | califax_ | califax |
2022-12-12 00:22:04 +0100 | bontaq | (~user@ool-45779fe5.dyn.optonline.net) (Ping timeout: 256 seconds) |
2022-12-12 00:27:12 +0100 | <[Leary]> | mira: https://github.com/haskell/core-libraries-committee/issues/100 |
2022-12-12 00:27:55 +0100 | michalz | (~michalz@185.246.204.93) (Ping timeout: 260 seconds) |
2022-12-12 00:28:39 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 00:28:59 +0100 | ddellacosta | (~ddellacos@143.244.47.89) (Ping timeout: 264 seconds) |
2022-12-12 00:30:04 +0100 | <davean> | Its really annoying how to do interesting things one has to magic up GHC internal symbols for like GC and thread queues |
2022-12-12 00:37:23 +0100 | johnw | (~johnw@2600:1700:cf00:db0:d426:be2d:331:cdc5) |
2022-12-12 00:40:09 +0100 | tremon | (~tremon@83-84-18-241.cable.dynamic.v4.ziggo.nl) (Quit: getting boxed in) |
2022-12-12 00:44:37 +0100 | harveypwca | (~harveypwc@2601:246:c180:a570:3828:d8:e523:3f67) |
2022-12-12 00:50:20 +0100 | sympt | (~sympt@user/sympt) (Ping timeout: 260 seconds) |
2022-12-12 00:57:53 +0100 | <dsal> | c_wraith: Hey, are you around to make me less dumb about this para thing again? I'm still getting my results backwards (and presumably requiring a finite list). I'm effectively trying to do a "map with previous value". So I think I might just not understand ListF. |
2022-12-12 00:58:04 +0100 | <c_wraith> | I am around! |
2022-12-12 00:58:16 +0100 | <c_wraith> | Mind showing me your code? That seems like an expedient start |
2022-12-12 00:58:20 +0100 | <dsal> | I'm treating the incoming as `Cons currentItem (processedStuff, tail)` |
2022-12-12 00:58:37 +0100 | <dsal> | Yeah, this is the whole thing in-situ https://www.irccloud.com/pastebin/9bL24qdo/follow.hs |
2022-12-12 00:58:52 +0100 | <dsal> | There's some junk there, but you can hopefully see what I'm trying. |
2022-12-12 00:59:15 +0100 | <dsal> | I'm trying it in GHCI and it kind of works except for putting the modified value at the end. |
2022-12-12 00:59:26 +0100 | <c_wraith> | I think you've got processedStuff and tail backwards... |
2022-12-12 00:59:47 +0100 | <c_wraith> | yeah, the tail is the first element of the pair, the processed stuff is the second stuff |
2022-12-12 00:59:51 +0100 | <c_wraith> | second element |
2022-12-12 01:02:52 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
2022-12-12 01:03:52 +0100 | <dsal> | Yeah, that's kind of obvious now… I'm going to keep hitting this until something meaningful happens. |
2022-12-12 01:08:40 +0100 | <c_wraith> | dsal: so, is your goal to pattern-match against the processed value in order to decide what to do at the currrent value? Because that's always going to cause recursion |
2022-12-12 01:09:03 +0100 | <dsal> | Oh. I need to do something different for the first one. |
2022-12-12 01:09:35 +0100 | <dsal> | And I need the thing that happened to each one to be known for the next one. |
2022-12-12 01:09:38 +0100 | beteigeuze | (~Thunderbi@bl14-81-220.dsl.telepac.pt) |
2022-12-12 01:09:47 +0100 | chomwitt | (~chomwitt@2a02:587:7a05:dc00:1ac0:4dff:fedb:a3f1) (Ping timeout: 248 seconds) |
2022-12-12 01:10:13 +0100 | <c_wraith> | do you need to pass information the other direction? |
2022-12-12 01:10:50 +0100 | <dsal> | No. If this is the first one, I do thing `a` and then for the rest I do thing `b` with knowledge of whatever the previous thing was. |
2022-12-12 01:10:55 +0100 | <dsal> | Which is kind of scanl. |
2022-12-12 01:11:11 +0100 | ddellacosta | (~ddellacos@143.244.47.89) |
2022-12-12 01:11:12 +0100 | <c_wraith> | ok, just checking. I didn't actually do the problem, so I'm not sure what your goal is |
2022-12-12 01:12:34 +0100 | <dsal> | The actual thing I did was this (passing the previous answer with manual recursion): https://www.irccloud.com/pastebin/kEKQJccG/follow.hs |
2022-12-12 01:12:50 +0100 | <dsal> | I'm just trying to figure out how to make that better by using recursion-schemes and more code. |
2022-12-12 01:15:50 +0100 | fizbin | (~fizbin@user/fizbin) |
2022-12-12 01:30:54 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
2022-12-12 01:31:24 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) |
2022-12-12 01:31:27 +0100 | <dsal> | Well, this seems to do the right thing, but it does it from the right. I guess that's half-good. https://www.irccloud.com/pastebin/j6tRqunb/backwards.hs |
2022-12-12 01:32:11 +0100 | qy | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
2022-12-12 01:32:31 +0100 | <dsal> | Which I guess makes sense because I'm looking at the head of the list of completed stuff to see what decision I made. |
2022-12-12 01:33:01 +0100 | Topsi | (~Topsi@dialin-80-228-141-073.ewe-ip-backbone.de) (Read error: Connection reset by peer) |
2022-12-12 01:34:47 +0100 | ix | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Ping timeout: 265 seconds) |
2022-12-12 01:35:57 +0100 | <c_wraith> | yeah, that forces it to go all the way to the end first |
2022-12-12 01:36:40 +0100 | <dsal> | That's a bit counterintuitive. I'd think looking at the first thing would only require the first thing. |
2022-12-12 01:36:51 +0100 | <c_wraith> | your code that isn't using recursion schemes doesn't do that - it only looks at the current element |
2022-12-12 01:37:06 +0100 | <dsal> | Yeah, because I'm passing the previous along. |
2022-12-12 01:37:40 +0100 | <c_wraith> | so why do that here? |
2022-12-12 01:37:51 +0100 | <dsal> | This *feels* like it wants to do the right thing, it just does it backwards from what I expect. |
2022-12-12 01:37:55 +0100 | <c_wraith> | It's the same trick as 3-arg foldr |
2022-12-12 01:38:17 +0100 | <dsal> | What do you mean 3-arg foldr? |
2022-12-12 01:38:22 +0100 | adium | (adium@user/adium) |
2022-12-12 01:38:49 +0100 | <c_wraith> | I actually mean 4-arg. I can count that high, I swear. |
2022-12-12 01:40:44 +0100 | <hpc> | @let data Count = Zero | One | Infinity |
2022-12-12 01:40:45 +0100 | <lambdabot> | Defined. |
2022-12-12 01:40:46 +0100 | <hpc> | :P |
2022-12-12 01:40:58 +0100 | <c_wraith> | but anyway, the idea is that your recursion scheme returns a function, and that function is what does the final processing |
2022-12-12 01:42:17 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 246 seconds) |
2022-12-12 01:42:32 +0100 | acidjnk | (~acidjnk@p200300d6e7137a35c0a7281abf493a9c.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
2022-12-12 01:43:35 +0100 | <dsal> | Hmm... It's already getting a bit unwieldy, but can it even do the thing? |
2022-12-12 01:43:43 +0100 | <c_wraith> | It can certainly do it. |
2022-12-12 01:43:44 +0100 | <dsal> | Or is the idea to push the state through in a sort of schwartizan transform? |
2022-12-12 01:44:10 +0100 | <dsal> | Which I could do with just regular map. heh |
2022-12-12 01:44:15 +0100 | <c_wraith> | It should be quite a lot less code than you have so far. It should be about the same as your original, in terms of amount of code. |
2022-12-12 01:44:37 +0100 | <dsal> | Yeah, that's what I'd hope for. heh. |
2022-12-12 01:44:44 +0100 | <dsal> | My actual goal is to get some intuition for this. |
2022-12-12 01:45:10 +0100 | <dsal> | I'm assuming the `Nil` case is just not interesting at all. |
2022-12-12 01:46:13 +0100 | qy | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Quit: WeeChat 3.7.1) |
2022-12-12 01:46:53 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
2022-12-12 01:46:57 +0100 | fizbin | (~fizbin@user/fizbin) (Ping timeout: 268 seconds) |
2022-12-12 01:47:32 +0100 | ix | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
2022-12-12 01:49:11 +0100 | ix | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Client Quit) |
2022-12-12 01:50:32 +0100 | ix | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
2022-12-12 01:54:12 +0100 | mestre | (~mestre@191.177.185.178) (Ping timeout: 248 seconds) |
2022-12-12 01:55:03 +0100 | <c_wraith> | dsal: very untested, probably has lots of errors: \x -> para (\case of Nil -> const [] ; ListF k@(Knot p s) (sns, r) -> \hp -> if touching hp p then p : sns else let np = ... in ... : r np) id x |
2022-12-12 01:55:42 +0100 | <c_wraith> | err. indeed. the id and the x at the end are definitely in the wrong spots |
2022-12-12 01:57:10 +0100 | <c_wraith> | It should be more like \xs -> ... xs hp (no id at all, I misremembered why it's there with foldr) |
2022-12-12 01:57:34 +0100 | <c_wraith> | in fact, hp should be a parameter too. |
2022-12-12 01:57:55 +0100 | <c_wraith> | Anyway, the idea is to generate a function with the para, then provide the extra parameter to it. The extra parameter is hp in your case |
2022-12-12 01:58:24 +0100 | gurkenglas | (~gurkengla@p548ac72e.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
2022-12-12 01:58:41 +0100 | <dsal> | Hmm... Thanks. I'll mangle that around. |
2022-12-12 01:59:21 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 02:01:07 +0100 | Guest7583 | (Guest75@2a01:7e01::f03c:92ff:fe5d:7b18) |
2022-12-12 02:04:09 +0100 | <dsal> | Well, I guess I'm starting to not see the point. If I need to pass that parameter through, then it's not clear to me what para's doing for me. The whole goal here was to get that parameter "for free". |
2022-12-12 02:04:31 +0100 | <dsal> | Otherwise, might as well just do the same thing with foldr |
2022-12-12 02:08:15 +0100 | <c_wraith> | well, the advantage you get with para is that you get to bail out early |
2022-12-12 02:08:30 +0100 | <c_wraith> | ... while returning the unchanged tail of the list |
2022-12-12 02:08:34 +0100 | L29Ah | (~L29Ah@wikipedia/L29Ah) () |
2022-12-12 02:08:40 +0100 | <c_wraith> | Doing that with foldr requires an extra parameter |
2022-12-12 02:08:50 +0100 | <c_wraith> | ... one *more* extra parameter |
2022-12-12 02:09:33 +0100 | <c_wraith> | that is... para gives you access to knots |
2022-12-12 02:09:37 +0100 | <c_wraith> | foldr doesn't |
2022-12-12 02:09:50 +0100 | L29Ah | (~L29Ah@wikipedia/L29Ah) |
2022-12-12 02:10:00 +0100 | <c_wraith> | both of them would need an extra parameter for passing down the hp value |
2022-12-12 02:10:25 +0100 | Axma25968 | Axman6 |
2022-12-12 02:10:28 +0100 | albet70 | (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection) |
2022-12-12 02:13:44 +0100 | <dsal> | Oh, that's right. I wasn't thinking about how bailing out of foldr throws away the tail. |
2022-12-12 02:14:31 +0100 | POGtastic | (~mike@2601:1c0:6000:fe1:50c1:1bcb:3a70:9713) |
2022-12-12 02:15:25 +0100 | <c_wraith> | in either case, the extra parameter is awkward to deal with |
2022-12-12 02:15:44 +0100 | troydm | (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 260 seconds) |
2022-12-12 02:16:36 +0100 | albet70 | (~xxx@2400:8902::f03c:92ff:fe60:98d8) |
2022-12-12 02:25:26 +0100 | CiaoSen | (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 255 seconds) |
2022-12-12 02:28:53 +0100 | xff0x_ | (~xff0x@ai071162.d.east.v6connect.net) (Ping timeout: 268 seconds) |
2022-12-12 02:33:32 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
2022-12-12 02:36:19 +0100 | ix | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Quit: WeeChat 3.7.1) |
2022-12-12 02:37:35 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 246 seconds) |
2022-12-12 02:37:42 +0100 | ix | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
2022-12-12 02:38:01 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
2022-12-12 02:38:07 +0100 | inkbottle[m] | zebrag[m] |
2022-12-12 02:38:45 +0100 | ddellacosta | (~ddellacos@143.244.47.89) (Ping timeout: 268 seconds) |
2022-12-12 02:40:29 +0100 | ddellacosta | (~ddellacos@89.45.224.169) |
2022-12-12 02:41:05 +0100 | <dsal> | c_wraith: neat The idea worked. |
2022-12-12 02:41:38 +0100 | <c_wraith> | well there you go. Not an amazing change in and of itself, but that's how you'd use cata for that |
2022-12-12 02:41:48 +0100 | razetime | (~quassel@49.207.203.213) |
2022-12-12 02:44:56 +0100 | <dsal> | Did require me passing out on the floor for some reason, though. |
2022-12-12 02:45:12 +0100 | <c_wraith> | sounds normal for your first time |
2022-12-12 02:46:17 +0100 | <dsal> | Heh. It's about +7 loc |
2022-12-12 02:46:31 +0100 | <dsal> | Part of that is just line wrapping though since I'm just using git diff. |
2022-12-12 02:48:15 +0100 | stiell | (~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection) |
2022-12-12 02:48:40 +0100 | <dsal> | Yeah, part of the complexity was doing the first and rest in the same code since they really don't have anything to do with each other. |
2022-12-12 02:48:43 +0100 | stiell | (~stiell@gateway/tor-sasl/stiell) |
2022-12-12 02:49:13 +0100 | <c_wraith> | yeah.. I ignored that and went with the exact same functionality as your starting function |
2022-12-12 02:49:50 +0100 | <dsal> | Right. Thanks a lot for the help. I'm not sure how well I understand it in general, but I understand it better than I did before. |
2022-12-12 02:50:11 +0100 | <c_wraith> | yeah, it's a case where you need several reps |
2022-12-12 02:50:34 +0100 | <dsal> | I ended up here: https://www.irccloud.com/pastebin/P4iBthnt/para.hs |
2022-12-12 02:51:25 +0100 | <dsal> | I can't find a format I like, but at the very least, I'm going to keep it because it doesn't feel *entirely* contrived even if it's a bit less obvious. |
2022-12-12 02:51:44 +0100 | <c_wraith> | ah, yeah. that looks right. Maybe you could benefit from some better names than my 'r', if you want to refer to it the next time you're trying to figure this out |
2022-12-12 02:52:07 +0100 | <dsal> | Oh right. I almost had names that made sense to me. |
2022-12-12 02:53:49 +0100 | <dsal> | `remaining` and `done` at least might be useful crumbs. |
2022-12-12 02:54:04 +0100 | <dsal> | Though `done` seems kind of confusing. |
2022-12-12 02:54:47 +0100 | <dsal> | I can see why they went with `t` and `a`. I can put the pieces together, but naming is hard. |
2022-12-12 02:56:34 +0100 | <c_wraith> | at least you have a concrete case, where you know what every variable contains. |
2022-12-12 02:56:40 +0100 | <dsal> | Is there a name for this fold-to-a-function trick? It seems like the opposite of currying. |
2022-12-12 02:58:15 +0100 | harveypwca | (~harveypwc@2601:246:c180:a570:3828:d8:e523:3f67) (Quit: Leaving) |
2022-12-12 03:00:19 +0100 | <dsal> | Oh, that was kind of weird. I was trying to remember a recursion avoidance thing I did last year and it was also called `para`, but it was uniplate. |
2022-12-12 03:00:20 +0100 | ddellacosta | (~ddellacos@89.45.224.169) (Ping timeout: 268 seconds) |
2022-12-12 03:06:48 +0100 | ddellacosta | (~ddellacos@143.244.47.100) |
2022-12-12 03:06:50 +0100 | jao | (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) (Ping timeout: 260 seconds) |
2022-12-12 03:10:47 +0100 | beteigeuze | (~Thunderbi@bl14-81-220.dsl.telepac.pt) (Ping timeout: 252 seconds) |
2022-12-12 03:12:19 +0100 | ddellacosta | (~ddellacos@143.244.47.100) (Ping timeout: 260 seconds) |
2022-12-12 03:12:34 +0100 | <jackdk> | uniplate is cool, and the plated operations in lens are even cooler |
2022-12-12 03:13:19 +0100 | xff0x_ | (~xff0x@125x103x176x34.ap125.ftth.ucom.ne.jp) |
2022-12-12 03:16:28 +0100 | ddellacosta | (~ddellacos@89.45.224.156) |
2022-12-12 03:16:38 +0100 | POGtastic | (~mike@2601:1c0:6000:fe1:50c1:1bcb:3a70:9713) (Quit: WeeChat 3.6) |
2022-12-12 03:18:02 +0100 | ix | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Quit: WeeChat 3.7.1) |
2022-12-12 03:19:23 +0100 | ix | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
2022-12-12 03:20:20 +0100 | ix | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Client Quit) |
2022-12-12 03:21:24 +0100 | phma | (~phma@host-67-44-208-203.hnremote.net) (Read error: Connection reset by peer) |
2022-12-12 03:21:38 +0100 | ix | (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
2022-12-12 03:22:50 +0100 | ddellacosta | (~ddellacos@89.45.224.156) (Ping timeout: 256 seconds) |
2022-12-12 03:23:49 +0100 | phma | (phma@2001:5b0:2144:3348:b796:42a8:66d:6853) |
2022-12-12 03:24:48 +0100 | ddellacosta | (~ddellacos@89.45.224.208) |
2022-12-12 03:24:54 +0100 | money_ | (~money@user/polo) |
2022-12-12 03:25:35 +0100 | money | Guest3515 |
2022-12-12 03:25:35 +0100 | money_ | money |
2022-12-12 03:27:47 +0100 | <dsal> | Yeah, it's nice when I've got a recursive data structure more complex than list |
2022-12-12 03:28:20 +0100 | Unicorn_Princess | (~Unicorn_P@user/Unicorn-Princess/x-3540542) (Remote host closed the connection) |
2022-12-12 03:29:54 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 03:36:46 +0100 | money_ | (~money@user/polo) |
2022-12-12 03:37:34 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 256 seconds) |
2022-12-12 03:39:05 +0100 | money | (~money@user/polo) (Ping timeout: 256 seconds) |
2022-12-12 03:39:25 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
2022-12-12 03:40:01 +0100 | money_ | money |
2022-12-12 03:47:02 +0100 | money | (~money@user/polo) (Quit: late) |
2022-12-12 03:47:51 +0100 | money | (~money@user/polo) |
2022-12-12 03:48:26 +0100 | ddellacosta | (~ddellacos@89.45.224.208) (Ping timeout: 268 seconds) |
2022-12-12 03:50:32 +0100 | bontaq | (~user@ool-45779fe5.dyn.optonline.net) |
2022-12-12 03:54:58 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:44ff:72e2:5072:e2ac) (Remote host closed the connection) |
2022-12-12 03:58:45 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:44ff:72e2:5072:e2ac) |
2022-12-12 04:00:27 +0100 | ddellacosta | (~ddellacos@89.45.224.156) |
2022-12-12 04:04:28 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 268 seconds) |
2022-12-12 04:18:11 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 264 seconds) |
2022-12-12 04:20:05 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
2022-12-12 04:22:03 +0100 | money | (~money@user/polo) (Quit: late) |
2022-12-12 04:22:30 +0100 | money | (~money@user/polo) |
2022-12-12 04:24:25 +0100 | thegeekinside | (~thegeekin@189.217.82.244) (Read error: Connection reset by peer) |
2022-12-12 04:25:33 +0100 | Guest23 | (~Guest23@27.57.46.219) |
2022-12-12 04:27:38 +0100 | RedSwan | (~jared@174-23-134-43.slkc.qwest.net) |
2022-12-12 04:33:00 +0100 | [itchyjunk] | (~itchyjunk@user/itchyjunk/x-7353470) (Read error: Connection reset by peer) |
2022-12-12 04:40:52 +0100 | td_ | (~td@83.135.9.54) (Ping timeout: 265 seconds) |
2022-12-12 04:42:18 +0100 | td_ | (~td@83.135.9.32) |
2022-12-12 04:42:34 +0100 | ballast | (~ballast@cpe-104-32-238-223.socal.res.rr.com) |
2022-12-12 04:45:35 +0100 | mzan | (~quassel@mail.asterisell.com) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
2022-12-12 04:46:36 +0100 | mzan | (~quassel@mail.asterisell.com) |
2022-12-12 04:47:00 +0100 | shapr | (~user@68.54.166.125) (Ping timeout: 248 seconds) |
2022-12-12 04:47:23 +0100 | Guest23 | (~Guest23@27.57.46.219) (Ping timeout: 246 seconds) |
2022-12-12 04:49:16 +0100 | <ballast> | Is there a meaningful difference in performance between carrying around a (Map k v) versus a function (k -> Maybe v). In most use cases the function would be a partially applied Map.lookup anyway. |
2022-12-12 04:50:26 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) (Ping timeout: 255 seconds) |
2022-12-12 04:50:56 +0100 | <ballast> | by "carrying around" I mean having as a part of application state - could clarify my particular use case more if needed |
2022-12-12 04:51:36 +0100 | king_gs | (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) |
2022-12-12 04:51:57 +0100 | <ballast> | (and to clarify my question, I want to have the function (k -> Maybe v) as a part of my state instead of the map) |
2022-12-12 04:52:35 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) |
2022-12-12 04:54:19 +0100 | <c_wraith> | efficiency in some use cases is the biggest difference |
2022-12-12 04:54:38 +0100 | ddellacosta | (~ddellacos@89.45.224.156) (Ping timeout: 256 seconds) |
2022-12-12 04:54:43 +0100 | <sm> | I think you'd have to measure to be certain.. but it seems to me that a function could be more likely to be reevaluated, duplicating work ? |
2022-12-12 04:55:19 +0100 | <c_wraith> | If you're updating, maps can be a *lot* more efficient |
2022-12-12 04:55:21 +0100 | <sm> | also much more if a pain for inspecting inner state, debugging etc |
2022-12-12 04:58:57 +0100 | ballast | (~ballast@cpe-104-32-238-223.socal.res.rr.com) (Quit: Client closed) |
2022-12-12 05:00:00 +0100 | Taneb | (~Taneb@runciman.hacksoc.org) (Quit: I seem to have stopped.) |
2022-12-12 05:00:18 +0100 | money | (~money@user/polo) (Quit: late) |
2022-12-12 05:00:20 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 05:00:50 +0100 | money | (~money@user/polo) |
2022-12-12 05:01:13 +0100 | Taneb | (~Taneb@runciman.hacksoc.org) |
2022-12-12 05:05:27 +0100 | sagax | (~sagax_nb@user/sagax) |
2022-12-12 05:14:52 +0100 | lisbeths | (uid135845@id-135845.lymington.irccloud.com) (Quit: Connection closed for inactivity) |
2022-12-12 05:18:26 +0100 | machinedgod | (~machinedg@d198-53-218-113.abhsia.telus.net) (Ping timeout: 256 seconds) |
2022-12-12 05:19:08 +0100 | j4cc3b | (~jeffreybe@pool-74-105-2-138.nwrknj.fios.verizon.net) |
2022-12-12 05:20:30 +0100 | king_gs | (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) (Ping timeout: 265 seconds) |
2022-12-12 05:20:48 +0100 | lisbeths | (uid135845@id-135845.lymington.irccloud.com) |
2022-12-12 05:21:32 +0100 | finsternis | (~X@23.226.237.192) (Read error: Connection reset by peer) |
2022-12-12 05:26:32 +0100 | ballast | (~ballast@cpe-104-32-238-223.socal.res.rr.com) |
2022-12-12 05:28:24 +0100 | fizbin | (~fizbin@user/fizbin) |
2022-12-12 05:28:40 +0100 | <ballast> | The function won't be updated. Would it be code smelly to carry around both a map for statically-known values and also a function for ones you want to compute dynamically? |
2022-12-12 05:29:24 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 260 seconds) |
2022-12-12 05:30:01 +0100 | <c_wraith> | that sounds like a case where a function is perfectly fine |
2022-12-12 05:32:14 +0100 | <ballast> | hmmm, OK. I guess it's also simpler to think about. I guess I was getting kind of cutesy when I recognized that a function would subsume the map. It does feel sort of clunky to write (\x -> M.lookup bigMap x) instead of just passing bigMap to the state. |
2022-12-12 05:32:47 +0100 | <ballast> | Thanks for the input |
2022-12-12 05:32:57 +0100 | <c_wraith> | well, if you're adding in some cases that aren't in the map, it's not overly clever anymore. :) |
2022-12-12 05:34:52 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
2022-12-12 05:36:11 +0100 | notzmv | (~zmv@user/notzmv) (Ping timeout: 264 seconds) |
2022-12-12 05:37:56 +0100 | <ballast> | true. in my case i have an infinite grid where some cells have values. So naturally I defined a Map (Int, Int) Value. However, I later decided that I wanted to label each cell with its index, which I realized could be accomplished with a function (Int, Int) -> Value. |
2022-12-12 05:38:17 +0100 | russruss | (~russruss@my.russellmcc.com) (Quit: The Lounge - https://thelounge.chat) |
2022-12-12 05:38:19 +0100 | <ballast> | Where I think I'm getting cutesy is trying to refactor my application state to remove the old map and only put in the function. |
2022-12-12 05:38:58 +0100 | <ballast> | At first I thought I would just throw everything into a map but I think laziness won't help me there lol. Unless there's a container suitable for this that I don't know about. |
2022-12-12 05:39:30 +0100 | russruss | (~russruss@my.russellmcc.com) |
2022-12-12 05:40:11 +0100 | notzmv | (~zmv@user/notzmv) |
2022-12-12 05:55:00 +0100 | <dsal> | > para (\a b -> sum a + sum b) [1, 1, 1, 1] |
2022-12-12 05:55:02 +0100 | <lambdabot> | 10 |
2022-12-12 05:55:05 +0100 | <dsal> | Neat. |
2022-12-12 05:59:06 +0100 | money | (~money@user/polo) (Quit: late) |
2022-12-12 05:59:07 +0100 | <int-e> | > sum . zipWith (*) [1..] $ [1,1,1,1] |
2022-12-12 05:59:08 +0100 | <lambdabot> | 10 |
2022-12-12 05:59:30 +0100 | <int-e> | (I took a moment to figure out what that code did.) |
2022-12-12 05:59:39 +0100 | Erutuon_ | (~Erutuon@user/erutuon) (Ping timeout: 265 seconds) |
2022-12-12 06:01:02 +0100 | troydm | (~troydm@host-176-37-124-197.b025.la.net.ua) |
2022-12-12 06:03:28 +0100 | aeroplane | (~user@user/aeroplane) |
2022-12-12 06:04:07 +0100 | money | (~money@user/polo) |
2022-12-12 06:08:20 +0100 | tvandinther | (~tvandinth@101.98.118.246) |
2022-12-12 06:08:35 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) (Remote host closed the connection) |
2022-12-12 06:08:56 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) |
2022-12-12 06:10:01 +0100 | <tvandinther> | How can I bind `a -> b` when I have a monad in a monad? E.g. `IO (Maybe a)` |
2022-12-12 06:10:59 +0100 | <tvandinther> | doing something like `>>= ( >>= f)` works, whats the usual approach? |
2022-12-12 06:11:27 +0100 | <jackdk> | If it's just a pure function `a -> b` I would consider `fmap . fmap` |
2022-12-12 06:11:34 +0100 | <jackdk> | :t fmap . fmap |
2022-12-12 06:11:34 +0100 | <lambdabot> | (Functor f1, Functor f2) => (a -> b) -> f1 (f2 a) -> f1 (f2 b) |
2022-12-12 06:11:38 +0100 | Guest7583 | (Guest75@2a01:7e01::f03c:92ff:fe5d:7b18) (Ping timeout: 260 seconds) |
2022-12-12 06:12:07 +0100 | <jackdk> | With those specific types `IO (Maybe a)`, I would consider working in the `MaybeT IO` monad |
2022-12-12 06:16:10 +0100 | <tvandinther> | How much understanding of transformers should I have to use that, because I currently have none |
2022-12-12 06:17:05 +0100 | tomokojun | (~tomokojun@75.164.52.103) |
2022-12-12 06:21:34 +0100 | <ballast> | how urgently does this need to be done? it seems like now's a good time to learn. and using MaybeT IO is probably gonna be a pretty tractable case too |
2022-12-12 06:21:44 +0100 | <jackdk> | tvandinther: challenge: given `newtype M a = M (IO (Maybe a))`, write its `Functor`, `Applicative`, and `Monad`instances |
2022-12-12 06:22:03 +0100 | <jackdk> | this has a point, trust me, and pastebin your results in this channel |
2022-12-12 06:23:12 +0100 | rekahsoft | (~rekahsoft@bras-base-wdston4533w-grc-05-184-144-15-227.dsl.bell.ca) |
2022-12-12 06:25:34 +0100 | <tvandinther> | Not urgently so happy to learn this. |
2022-12-12 06:25:39 +0100 | <tvandinther> | I can give that a shot |
2022-12-12 06:26:46 +0100 | forell | (~forell@user/forell) (Quit: ZNC - https://znc.in) |
2022-12-12 06:27:00 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 256 seconds) |
2022-12-12 06:27:04 +0100 | forell | (~forell@user/forell) |
2022-12-12 06:28:47 +0100 | ballast | (~ballast@cpe-104-32-238-223.socal.res.rr.com) (Quit: Client closed) |
2022-12-12 06:31:15 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 06:34:56 +0100 | rekahsoft | (~rekahsoft@bras-base-wdston4533w-grc-05-184-144-15-227.dsl.bell.ca) (Ping timeout: 256 seconds) |
2022-12-12 06:37:23 +0100 | iqubic | (~avi@2601:602:9502:c70:3fce:1b2:5b0b:b57c) (Remote host closed the connection) |
2022-12-12 06:37:59 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds) |
2022-12-12 06:39:23 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
2022-12-12 06:40:20 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) |
2022-12-12 06:40:36 +0100 | bontaq | (~user@ool-45779fe5.dyn.optonline.net) (Ping timeout: 248 seconds) |
2022-12-12 06:44:04 +0100 | money | (~money@user/polo) (Quit: late) |
2022-12-12 06:47:35 +0100 | j4cc3b | (~jeffreybe@pool-74-105-2-138.nwrknj.fios.verizon.net) (Ping timeout: 264 seconds) |
2022-12-12 06:53:44 +0100 | <tvandinther> | I'm struggling with the implementation of bind |
2022-12-12 06:54:42 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 252 seconds) |
2022-12-12 06:56:29 +0100 | <jackdk> | What do you have so far? Put it into a pastebin and pop the link in here |
2022-12-12 06:59:35 +0100 | <tvandinther> | https://paste.tomsmeding.com/NxM2S9Ns |
2022-12-12 07:01:01 +0100 | <jackdk> | OK, so `a'` has type `Maybe a`, right? What if you put a `case`-expression under it: `case a of ...` |
2022-12-12 07:01:14 +0100 | iqubic | (~avi@2601:602:9502:c70:6c06:b297:7404:329f) |
2022-12-12 07:01:54 +0100 | <tvandinther> | yeah I figure I'd do `Nothing -> pure Nothing` and then for Just I have a raw `a` |
2022-12-12 07:02:06 +0100 | Lycurgus | (~juan@user/Lycurgus) |
2022-12-12 07:02:15 +0100 | <jackdk> | yep, and what do you have that can accept an `a`? |
2022-12-12 07:02:32 +0100 | mvk | (~mvk@2607:fea8:5ce3:8500::efb) (Quit: Going elsewhere) |
2022-12-12 07:02:47 +0100 | <tvandinther> | I apply that to f to get `M b` |
2022-12-12 07:03:25 +0100 | <jackdk> | And can you then make that fit? |
2022-12-12 07:05:38 +0100 | <tvandinther> | Do I have to move the M constructor into the do block? Otherwise I'm doing `M $ M b` right? |
2022-12-12 07:05:46 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 268 seconds) |
2022-12-12 07:06:39 +0100 | <jackdk> | You can remove the outermost `M $` (and push it down where you have your `pure Nothing` etc, but another option is to write an unwrapping function `runM :: M a -> IO (Maybe a)` or put it into the newtype declaration as a field: `newtype M a = M { runM :: IO (Maybe a) }` |
2022-12-12 07:07:13 +0100 | <iqubic> | So, I'm working with Data.Array.Unboxed here. I have `grid = SOME_ARRAY_DEFINITION`. `bounds grid == (V2 0 0, V2 7 4)`. That's all well and good. However, `grid ! V2 7 4` fails with "*** Exception: (Array.!): undefined array element" |
2022-12-12 07:07:21 +0100 | <iqubic> | V2 is from Data.Linear |
2022-12-12 07:07:49 +0100 | <tvandinther> | I gotta run off now but I'll pick this back up later. Thanks jackdk |
2022-12-12 07:07:54 +0100 | <jackdk> | ok, good luck |
2022-12-12 07:08:08 +0100 | tvandinther | (~tvandinth@101.98.118.246) (Quit: Client closed) |
2022-12-12 07:08:12 +0100 | <iqubic> | So, why the heck am I getting an undefined array element thing here? |
2022-12-12 07:09:16 +0100 | <iqubic> | Oh, I see the issue here. |
2022-12-12 07:09:34 +0100 | <iqubic> | I'm parsing the grid from a string and I have a copy paste error |
2022-12-12 07:09:55 +0100 | <iqubic> | The number of elements I passed to the array construct was one less than expected. |
2022-12-12 07:14:23 +0100 | chomwitt | (~chomwitt@2a02:587:7a05:dc00:1ac0:4dff:fedb:a3f1) |
2022-12-12 07:14:26 +0100 | ChaiTRex | (~ChaiTRex@user/chaitrex) (Remote host closed the connection) |
2022-12-12 07:14:58 +0100 | ChaiTRex | (~ChaiTRex@user/chaitrex) |
2022-12-12 07:16:08 +0100 | notzmv | (~zmv@user/notzmv) (Ping timeout: 255 seconds) |
2022-12-12 07:19:30 +0100 | takuan | (~takuan@178-116-218-225.access.telenet.be) |
2022-12-12 07:21:27 +0100 | money | (~money@user/polo) |
2022-12-12 07:31:52 +0100 | bgs | (~bgs@212-85-160-171.dynamic.telemach.net) |
2022-12-12 07:34:07 +0100 | king_gs | (~Thunderbi@187.201.150.200) |
2022-12-12 07:35:03 +0100 | money | (~money@user/polo) (Quit: late) |
2022-12-12 07:37:05 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
2022-12-12 07:38:56 +0100 | money | (~money@user/polo) |
2022-12-12 07:39:18 +0100 | mncheckm | (~mncheck@193.224.205.254) |
2022-12-12 07:41:42 +0100 | Lycurgus | (~juan@user/Lycurgus) (Quit: Exeunt https://tinyurl.com/4m8d4kd5) |
2022-12-12 07:49:55 +0100 | <iqubic> | How can I tell if/when I should inline functions I've written? |
2022-12-12 07:50:02 +0100 | califax | (~califax@user/califx) (Remote host closed the connection) |
2022-12-12 07:50:38 +0100 | califax | (~califax@user/califx) |
2022-12-12 07:53:40 +0100 | king_gs | (~Thunderbi@187.201.150.200) (Read error: Connection reset by peer) |
2022-12-12 07:53:51 +0100 | king_gs1 | (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) |
2022-12-12 07:56:09 +0100 | king_gs1 | king_gs |
2022-12-12 08:01:49 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 08:05:53 +0100 | emmanuelux | (~emmanuelu@user/emmanuelux) (Quit: au revoir) |
2022-12-12 08:07:37 +0100 | kenran | (~user@user/kenran) |
2022-12-12 08:09:55 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
2022-12-12 08:10:19 +0100 | kenran | (~user@user/kenran) (Remote host closed the connection) |
2022-12-12 08:19:24 +0100 | money | (~money@user/polo) (Quit: late) |
2022-12-12 08:24:43 +0100 | [_________] | (~oos95GWG@user/oos95GWG) (Quit: [_________]) |
2022-12-12 08:26:34 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 256 seconds) |
2022-12-12 08:28:27 +0100 | waleee | (~waleee@h-176-10-137-138.NA.cust.bahnhof.se) |
2022-12-12 08:29:53 +0100 | [_________] | (~oos95GWG@user/oos95GWG) |
2022-12-12 08:31:59 +0100 | king_gs | (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) (Ping timeout: 264 seconds) |
2022-12-12 08:32:55 +0100 | fizbin | (~fizbin@user/fizbin) (Ping timeout: 260 seconds) |
2022-12-12 08:35:54 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 252 seconds) |
2022-12-12 08:36:59 +0100 | bgs | (~bgs@212-85-160-171.dynamic.telemach.net) (Remote host closed the connection) |
2022-12-12 08:41:45 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) |
2022-12-12 08:49:02 +0100 | jakalx | (~jakalx@base.jakalx.net) () |
2022-12-12 08:54:09 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) (Ping timeout: 260 seconds) |
2022-12-12 09:02:37 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 09:05:35 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds) |
2022-12-12 09:06:53 +0100 | [_________] | (~oos95GWG@user/oos95GWG) (Quit: [_________]) |
2022-12-12 09:07:18 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 255 seconds) |
2022-12-12 09:08:05 +0100 | tvandinther | (~tvandinth@101.98.118.246) |
2022-12-12 09:08:09 +0100 | waleee | (~waleee@h-176-10-137-138.NA.cust.bahnhof.se) (Ping timeout: 265 seconds) |
2022-12-12 09:08:54 +0100 | [_________] | (~oos95GWG@user/oos95GWG) |
2022-12-12 09:09:12 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
2022-12-12 09:10:36 +0100 | <tvandinther> | Hi I'm back. jackdk I had a look at a page explaining monad transformers and they had an example with `MaybeT IO` which made sense thanks to the exercise I did. What's the reasoning behind the "run" naming for deconstructing monad types? |
2022-12-12 09:11:51 +0100 | jpds2 | (~jpds@gateway/tor-sasl/jpds) (Remote host closed the connection) |
2022-12-12 09:11:59 +0100 | <jackdk> | I wasn't there when it was written but `runMaybeT :: MaybeT m a -> m (Maybe a)` gives you `runMaybeT $ do ...` which I think looks pretty nice |
2022-12-12 09:12:10 +0100 | <jackdk> | and inside the `...` you have `MaybeT m` as your monad |
2022-12-12 09:12:52 +0100 | jpds2 | (~jpds@gateway/tor-sasl/jpds) |
2022-12-12 09:13:50 +0100 | <tvandinther> | Seems like a sensible name especially if its used with IO inside of it. |
2022-12-12 09:14:45 +0100 | <jackdk> | yeah, though any monad will work - it's often useful when you have a bunch of `m (Maybe _)`-returning stuff and threading it by hand sucks |
2022-12-12 09:14:48 +0100 | trev | (~trev@user/trev) |
2022-12-12 09:14:58 +0100 | gmg | (~user@user/gehmehgeh) |
2022-12-12 09:15:00 +0100 | <dminuoso> | tvandinther: It also comes from the idea that most types that do have a monad instance are used *for* their monad instance, and those usually have some kind of "action sequence" semantics. It isn't until you unwrap (and possibly fill required arguments) that you actually "execute" this "action sequence" |
2022-12-12 09:15:24 +0100 | heartburn | (~gass@2a00:d880:3:1::b1e4:b241) (Ping timeout: 255 seconds) |
2022-12-12 09:15:35 +0100 | <dminuoso> | Or that's one way of interpreting it anyway |
2022-12-12 09:15:56 +0100 | shriekingnoise | (~shrieking@186.137.167.202) (Quit: Quit) |
2022-12-12 09:16:02 +0100 | <dminuoso> | tvandinther: Note that you can easily use MaybeT on other monads too, like Identity. |
2022-12-12 09:17:30 +0100 | heartburn | (~gass@2a00:d880:3:1::b1e4:b241) |
2022-12-12 09:17:52 +0100 | <dminuoso> | But its sometimes very vague and usually derived from the authors mental model |
2022-12-12 09:19:03 +0100 | <tvandinther> | Why is `let (M b) = f a'' in b` equivalent to `runM $ f a''` , is it because the first one is essentially using pattern matching to access the deconstructor? |
2022-12-12 09:19:15 +0100 | Sgeo | (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
2022-12-12 09:19:34 +0100 | <tvandinther> | And this deconstructor is usually hidden / unavailable to you unless you specify it in the newtype declaration? |
2022-12-12 09:20:25 +0100 | <dminuoso> | The constructor (no such thing as a deconstructor) can only hidden by not exporting it from a module. |
2022-12-12 09:21:21 +0100 | <dminuoso> | runM can be more convenient than pattern matching on the constructor, also it can help hide the internal implementation (say because you might want to extend or alter `M`, but perhaps keep runM at the same time) |
2022-12-12 09:22:33 +0100 | <dminuoso> | Note, that when you declare a newtype or a data, you cannot not have a constructor. It is mandatory. |
2022-12-12 09:22:54 +0100 | <tvandinther> | what is it called when you specify a function in a newtype to access its insides? |
2022-12-12 09:23:08 +0100 | <dminuoso> | It's a field accessor |
2022-12-12 09:23:18 +0100 | acidjnk | (~acidjnk@p200300d6e7137a35c0a7281abf493a9c.dip0.t-ipconnect.de) |
2022-12-12 09:23:18 +0100 | <[exa]> | tvandinther: exporting a function (even the accessor) instead of the data constructor (for patternmatching) is kinda preferred in the long term because it allows the library implementors to eventually change the internals without breaking everyone's patternmatches |
2022-12-12 09:23:37 +0100 | <dminuoso> | In a newtype it does take the role of a "deconstructor" if you want, but it is not common terminology. |
2022-12-12 09:24:14 +0100 | <dminuoso> | But for a data type, which can have multiple fields, it does not hold true anymore. So just call it a field |
2022-12-12 09:25:15 +0100 | <dminuoso> | (Or the proper technical term is `field label` actually) |
2022-12-12 09:25:24 +0100 | <dminuoso> | Or `selector function` |
2022-12-12 09:25:42 +0100 | <tvandinther> | if you don't declare the field accessor on the newtype, how is a pattern match able to get that value out? Is it because during compilation it removes the wrapper and just uses the value inside? |
2022-12-12 09:25:48 +0100 | avicenzi | (~avicenzi@2a00:ca8:a1f:b004::c32) |
2022-12-12 09:26:01 +0100 | <dminuoso> | tvandinther: For a newtype, there is no runtime representation |
2022-12-12 09:26:11 +0100 | <dminuoso> | So the act of pattern matching is a noop |
2022-12-12 09:26:28 +0100 | <dminuoso> | Even the use of a field label/selector function/accessor in a newtype is a noop |
2022-12-12 09:26:38 +0100 | waleee | (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 255 seconds) |
2022-12-12 09:26:44 +0100 | <dminuoso> | tvandinther: It might be helpful to understand that its rather the other way around |
2022-12-12 09:27:02 +0100 | <dminuoso> | The fundamental principle of operation in haskell is case-of. |
2022-12-12 09:27:25 +0100 | <tvandinther> | yeah makes sense. I knew about the runtime thing. Just trying to connect the dots. This makes sense for the most part. |
2022-12-12 09:27:27 +0100 | <dminuoso> | So the use of a field label actually desugars into a case-of pattern matching, which the compiler will know to handle |
2022-12-12 09:27:36 +0100 | king_gs | (~Thunderbi@187.201.150.200) |
2022-12-12 09:27:41 +0100 | <dminuoso> | For a newtype it will compile just into whats called a coercion |
2022-12-12 09:27:48 +0100 | <dminuoso> | In the GHC compiler anyway |
2022-12-12 09:27:58 +0100 | <dminuoso> | Which eventually is just a noop |
2022-12-12 09:28:09 +0100 | <dminuoso> | % newtype D = D Int |
2022-12-12 09:28:09 +0100 | <yahb2> | <no output> |
2022-12-12 09:28:28 +0100 | <dminuoso> | `let x = case f of D i -> i` is a noop |
2022-12-12 09:28:51 +0100 | <dminuoso> | (If we ignore what's going on with x) |
2022-12-12 09:29:03 +0100 | <dminuoso> | ` case f of D i -> i` is the better example. thats a noop |
2022-12-12 09:29:26 +0100 | <dminuoso> | tvandinther: one cool thing is, in GHC haskell *all* evaluation is eventually driven just by case-of. |
2022-12-12 09:29:38 +0100 | <dminuoso> | It's the fundamental framework |
2022-12-12 09:30:03 +0100 | <tvandinther> | Funny because thats what my code looks like too before I refactor |
2022-12-12 09:30:27 +0100 | <mauke> | it can't be all case-of |
2022-12-12 09:30:46 +0100 | <dminuoso> | mauke: Im talking about the driver of evalution. |
2022-12-12 09:30:48 +0100 | <mauke> | we have at least application |
2022-12-12 09:30:54 +0100 | <dminuoso> | Not all there is in the language |
2022-12-12 09:31:09 +0100 | <mauke> | LC evaluates things without case/of |
2022-12-12 09:31:16 +0100 | <dminuoso> | LC? |
2022-12-12 09:31:20 +0100 | <mauke> | lambda calculus |
2022-12-12 09:31:28 +0100 | <dminuoso> | Sure. And? |
2022-12-12 09:31:38 +0100 | <mauke> | and Haskell is based on it |
2022-12-12 09:31:55 +0100 | <mauke> | so when you have 'f x', you need to evaluate f to proceed |
2022-12-12 09:31:56 +0100 | <[exa]> | mauke: haskell is explicitly extended by deconstructible types |
2022-12-12 09:32:15 +0100 | <dminuoso> | Haskell is based on Core, which is losely based on System FC, and it fundamentally includes case-of |
2022-12-12 09:32:22 +0100 | <dminuoso> | https://downloads.haskell.org/ghc/9.0.1/docs/html/libraries/ghc-9.0.1/GHC-Core.html#t:Expr |
2022-12-12 09:32:34 +0100 | <mauke> | no, that's an implementation detail of how GHC does things |
2022-12-12 09:32:57 +0100 | <dminuoso> | Yes, so? |
2022-12-12 09:33:02 +0100 | <dminuoso> | I was talking about GHC Haskell. |
2022-12-12 09:33:08 +0100 | <[exa]> | I love the scale of that implementation detail. :D |
2022-12-12 09:33:34 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 09:33:34 +0100 | <dminuoso> | mauke: There's a useful point here really, and thats case-of is powerful enough to drive all of the demand driven evalution in GHC. |
2022-12-12 09:33:48 +0100 | <mauke> | but it's not the Haskell case-of |
2022-12-12 09:34:20 +0100 | fizbin | (~fizbin@user/fizbin) |
2022-12-12 09:34:50 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 255 seconds) |
2022-12-12 09:35:24 +0100 | <dminuoso> | mauke: The Haskell report is filled with that influence. Most desugaring rules or semantic equivalences are expressed in case-of translation. |
2022-12-12 09:35:40 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) |
2022-12-12 09:35:45 +0100 | <dminuoso> | In case of what we were talking about |
2022-12-12 09:35:46 +0100 | <mauke> | yes, that's Haskell case-of, not Core case-of |
2022-12-12 09:35:51 +0100 | <mauke> | which has different semantics |
2022-12-12 09:36:02 +0100 | <mauke> | and I see even GHC.Core.Expr contains App |
2022-12-12 09:36:26 +0100 | <[Leary]> | Pattern matching is cool, but the fact that you can discard case-of and data declarations and just write all your scott-encoded ADTs with newtype is even cooler. |
2022-12-12 09:37:14 +0100 | <dminuoso> | [Leary]: Hah, I want to see some code written in that style. |
2022-12-12 09:37:21 +0100 | <[exa]> | more thunks!!!11 |
2022-12-12 09:37:41 +0100 | <dminuoso> | mauke: There's a deep connection regardless. |
2022-12-12 09:37:59 +0100 | <mauke> | anyway, my point is that 'f x' forces the evaluation of f without any case-of |
2022-12-12 09:38:07 +0100 | <dminuoso> | Only if a case-of demands it. |
2022-12-12 09:38:13 +0100 | <dminuoso> | It's really case-of that drives evaluation. |
2022-12-12 09:38:37 +0100 | <mauke> | no, if you allow that argument that case-of doesn't drive evaluation either |
2022-12-12 09:38:40 +0100 | <mauke> | er |
2022-12-12 09:38:43 +0100 | <mauke> | s/that/then/ |
2022-12-12 09:39:09 +0100 | <mauke> | because case-of only evaluates its scrutinee if the whole expression is demanded externally |
2022-12-12 09:39:21 +0100 | <mauke> | (by another case-of or by application) |
2022-12-12 09:39:32 +0100 | <mniip> | ultimately what drives evaluation is the case main realWorld# of (# _, _ #) -> ... |
2022-12-12 09:40:45 +0100 | <mauke> | consider: seq a b = case a of _ -> b -- this is not a valid implementation of seq |
2022-12-12 09:41:11 +0100 | <mniip> | is that a haskell case-of or a core case-of? |
2022-12-12 09:41:19 +0100 | <mauke> | exactly :-) |
2022-12-12 09:41:47 +0100 | <mniip> | also I think that would be a core lint if a was a function type |
2022-12-12 09:48:54 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) |
2022-12-12 09:49:42 +0100 | wrengr | (~wrengr@201.59.83.34.bc.googleusercontent.com) (Remote host closed the connection) |
2022-12-12 09:51:30 +0100 | machinedgod | (~machinedg@d198-53-218-113.abhsia.telus.net) |
2022-12-12 09:54:02 +0100 | <tvandinther> | a question thats probably because I'm doing it all wrong, but I'm getting a type error with `MaybeT` because I need to go from `MaybeT m a -> m a` what is the way to do this? I want the Just case to bind to the next function which is `a -> m b` I suppose I need to handle the nothing case somehow? |
2022-12-12 09:54:43 +0100 | jakalx | (~jakalx@base.jakalx.net) |
2022-12-12 09:56:40 +0100 | king_gs | (~Thunderbi@187.201.150.200) (Read error: Connection reset by peer) |
2022-12-12 09:57:02 +0100 | king_gs | (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) |
2022-12-12 09:57:42 +0100 | <mauke> | yes |
2022-12-12 09:58:47 +0100 | califax | (~califax@user/califx) (Remote host closed the connection) |
2022-12-12 09:59:20 +0100 | <[Leary]> | dminuoso: I found my old toy project written in that style. It builds all its own "primitive" types and classes, and gets deriving for free. I believe I also had an LC interpreter built on top of it in the same style, but I'm not sure where it went. Anyway, the thing is a great mess so I'd have to clean up some fragments were I to actually show any of it around, but it's surprisingly not that different; you just get used to writing `foo val (\<C1-arg |
2022-12-12 09:59:20 +0100 | <[Leary]> | s> -> <C1-result>) ...` instead of `case val of { C1 <C1-args> -> <C1-result>; ... }` for `val :: Foo`. |
2022-12-12 09:59:21 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:7f4a:7261:e423:f5a7) |
2022-12-12 10:00:04 +0100 | crazazy[m] | (~crazazyut@2001:470:69fc:105::2:ba2a) (Quit: You have been kicked for being idle) |
2022-12-12 10:00:05 +0100 | UdayKiran[m] | (~neoatnebu@2001:470:69fc:105::2:bae0) (Quit: You have been kicked for being idle) |
2022-12-12 10:00:06 +0100 | olivermead[m] | (~olivermea@2001:470:69fc:105::2:4289) (Quit: You have been kicked for being idle) |
2022-12-12 10:00:13 +0100 | califax | (~califax@user/califx) |
2022-12-12 10:00:30 +0100 | <mauke> | oh, like either and bool |
2022-12-12 10:01:08 +0100 | <dminuoso> | [Leary]: Yeah, I did use that continuation style instead of comparing once because it performed better for some reasons. My biggest beef is that you dont get any code hints as to which branch is which. |
2022-12-12 10:01:39 +0100 | <dminuoso> | Especially on unary constructors |
2022-12-12 10:01:41 +0100 | <dminuoso> | or nullary |
2022-12-12 10:02:06 +0100 | <dminuoso> | `comparing x s t u` you cant clearly see which branch is which |
2022-12-12 10:02:22 +0100 | <dminuoso> | A partial solution to this would be agda's mixfix perhaps |
2022-12-12 10:03:02 +0100 | Guest23 | (~Guest23@27.57.46.219) |
2022-12-12 10:03:43 +0100 | fserucas | (~fserucas@2001:818:e376:a400:fb92:70c1:dd88:c7d7) |
2022-12-12 10:04:23 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:7f4a:7261:e423:f5a7) (Ping timeout: 264 seconds) |
2022-12-12 10:04:37 +0100 | tvandinther | (~tvandinth@101.98.118.246) (Quit: Client closed) |
2022-12-12 10:04:42 +0100 | <dminuoso> | And its also in part why in some situations I tend to prefer `case-of` even on Bool, because in some code regions it can really help clarify what the branches |
2022-12-12 10:04:48 +0100 | <dminuoso> | do |
2022-12-12 10:05:05 +0100 | coot | (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) |
2022-12-12 10:05:23 +0100 | jamestmartin | (~james@jtmar.me) (Quit: ZNC 1.8.2+deb2+b1 - https://znc.in) |
2022-12-12 10:05:29 +0100 | nut | (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) |
2022-12-12 10:05:33 +0100 | jamestmartin | (~james@jtmar.me) |
2022-12-12 10:05:34 +0100 | <dminuoso> | In the comparing case when I actually did introduce a bug because in one more convoluted use-case I got the order wrong, and decided the performance benefit was not worth the loss of clarity |
2022-12-12 10:06:20 +0100 | <dminuoso> | It's also mildly annoying that reordering the pattern matching requires doing it at all call-sites |
2022-12-12 10:06:32 +0100 | <dminuoso> | (assuming incompatible types) |
2022-12-12 10:06:43 +0100 | <dminuoso> | or well, even worse with compatible types, you have to find all the uses. |
2022-12-12 10:11:06 +0100 | use-value | (~Thunderbi@2a00:23c6:8a03:2f01:a541:ddec:fa11:d52f) (Read error: Connection reset by peer) |
2022-12-12 10:12:13 +0100 | michalz | (~michalz@185.246.204.87) |
2022-12-12 10:15:03 +0100 | Guest23 | (~Guest23@27.57.46.219) (Remote host closed the connection) |
2022-12-12 10:16:12 +0100 | use-value | (~Thunderbi@2a00:23c6:8a03:2f01:75c2:a71f:beaa:29bf) |
2022-12-12 10:16:32 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:a897:84c:1a93:9078) |
2022-12-12 10:19:40 +0100 | jakalx | (~jakalx@base.jakalx.net) (Error from remote client) |
2022-12-12 10:20:18 +0100 | <[Leary]> | Remembering or checking the "canonical constructor ordering" (as it were) is indeed part of the price of the style, but I don't recall having too much trouble with it myself. |
2022-12-12 10:24:51 +0100 | jakalx | (~jakalx@base.jakalx.net) |
2022-12-12 10:29:49 +0100 | xff0x_ | (~xff0x@125x103x176x34.ap125.ftth.ucom.ne.jp) (Ping timeout: 260 seconds) |
2022-12-12 10:33:18 +0100 | Guest3515 | money |
2022-12-12 10:33:51 +0100 | Guest23 | (~Guest23@27.57.46.219) |
2022-12-12 10:33:54 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
2022-12-12 10:34:45 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) |
2022-12-12 10:38:48 +0100 | <mauke> | newtype Left a b = Left{ left :: a -> b }; newtype Right a b = Right{ right :: a -> b }; newtype Either a b r = Either{ either :: Left a r -> Right b r -> r } |
2022-12-12 10:39:03 +0100 | <mauke> | either xyz (Left f) (Right g) |
2022-12-12 10:39:37 +0100 | Feuermagier | (~Feuermagi@user/feuermagier) |
2022-12-12 10:39:55 +0100 | <dminuoso> | Cunning |
2022-12-12 10:40:08 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) (Remote host closed the connection) |
2022-12-12 10:47:41 +0100 | RobertKrook48 | (~RobertKro@c-fe44205c.024-139-67626724.bbcust.telenor.se) |
2022-12-12 10:47:55 +0100 | gmg | (~user@user/gehmehgeh) (Quit: Leaving) |
2022-12-12 10:47:55 +0100 | tzh | (~tzh@c-24-21-73-154.hsd1.or.comcast.net) (Quit: zzz) |
2022-12-12 10:49:04 +0100 | <RobertKrook48> | Hello! I had a quick question about a hypothetical scenario: If I've used forkIO to spawn a couple of threads (program has access to only one HEC), and I press CTRL-C, is the signal sent to all threads or just the one currently scheduled? |
2022-12-12 10:49:20 +0100 | <dminuoso> | The signal is sent to the RTS. |
2022-12-12 10:49:32 +0100 | Robert42 | (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) |
2022-12-12 10:49:58 +0100 | <merijn> | "you don't want to know" |
2022-12-12 10:50:05 +0100 | <dminuoso> | Heh, I was waiting for you to answer. |
2022-12-12 10:50:24 +0100 | <merijn> | If this is at all relevant for your program, best rethink your program architecture now |
2022-12-12 10:50:33 +0100 | <Robert42> | 'hypothetical scenario' |
2022-12-12 10:51:02 +0100 | <merijn> | The real answer is: The signal gets non-deterministically delivered to any of the RTS threads (be it a HEC or one of the ones sued for FFI, etc.) |
2022-12-12 10:51:05 +0100 | <money> | Yeah |
2022-12-12 10:51:13 +0100 | <merijn> | That will then send an async exception to the main thread |
2022-12-12 10:51:37 +0100 | <Robert42> | Okay, thanks! |
2022-12-12 10:52:01 +0100 | <dminuoso> | Note that you can do some signal handling with https://hackage.haskell.org/package/unix-2.8.0.0/docs/System-Posix-Signals.html#v:installHandler |
2022-12-12 10:52:52 +0100 | <merijn> | [citation needed] |
2022-12-12 10:53:20 +0100 | <merijn> | Or maybe I should say "allegedly" |
2022-12-12 10:53:33 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:44ff:72e2:5072:e2ac) (Remote host closed the connection) |
2022-12-12 10:53:35 +0100 | king_gs | (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) (Ping timeout: 264 seconds) |
2022-12-12 10:53:43 +0100 | <dminuoso> | Can you elaborate perhaps? |
2022-12-12 10:54:06 +0100 | nschoe | (~q@141.101.51.197) |
2022-12-12 10:54:32 +0100 | <Robert42> | Me? |
2022-12-12 10:54:37 +0100 | <dminuoso> | No merijn |
2022-12-12 10:54:39 +0100 | <merijn> | dminuoso: I mean, that piggybacks on top of GHC's signal handling infrastructure which is most accurately described as "powered by wishful thinking" as opposed to any form of reasonable/deterministic semantics :) |
2022-12-12 10:55:00 +0100 | <dminuoso> | You ought to write some detailed description on this. |
2022-12-12 10:55:30 +0100 | <dminuoso> | installHandler has worked fine to do cleanup on SIGINT for graceful shutdowns for me |
2022-12-12 10:55:48 +0100 | <dminuoso> | To claim that this is just wishful thinking is quite a hyperbole. |
2022-12-12 10:56:09 +0100 | <merijn> | dminuoso: I mean, it depends on what actual expectations you have |
2022-12-12 10:56:54 +0100 | <merijn> | dminuoso: If you're just throwing an async exception at some thread, it's probably gonna always work |
2022-12-12 10:57:01 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) |
2022-12-12 10:57:30 +0100 | <merijn> | But then, you don't really have to do anything, since that's also the default configuration for SIGINT |
2022-12-12 10:57:35 +0100 | <dminuoso> | Let me turn it around: What cant I expect of it? |
2022-12-12 10:57:40 +0100 | king_gs | (~Thunderbi@187.201.150.200) |
2022-12-12 10:58:07 +0100 | <dminuoso> | Well in particular I might do things like close a socket, wait for workers to complete, and then just exit the process. |
2022-12-12 10:58:43 +0100 | <Robert42> | Any experience with catch/catches in Control.Exception for catching ctrl-c? |
2022-12-12 10:59:44 +0100 | <merijn> | Robert42: By default Ctrl-C just gets turned into an async exception to the main thread that works like any other async exception |
2022-12-12 11:00:11 +0100 | <dminuoso> | So far I have never understood what issues you do have with say installHandler |
2022-12-12 11:00:15 +0100 | <dminuoso> | What wont work? |
2022-12-12 11:01:13 +0100 | <Robert42> | I never said anything won't work, I am just curious how it works |
2022-12-12 11:01:32 +0100 | <dminuoso> | Robert42: Not talking to you :) |
2022-12-12 11:01:42 +0100 | <Robert42> | Ah okay :P |
2022-12-12 11:02:23 +0100 | <Robert42> | merijn I was mainly wondering which thread receives the signal, but it seems like it might not be wrong to assume that the main thread ends up with it |
2022-12-12 11:04:14 +0100 | <dminuoso> | Robert42: It doesnt receive a signal, it potentially gets an async exception thrown at it. |
2022-12-12 11:04:43 +0100 | <Robert42> | Sorry, I think I am using the word signal wrong |
2022-12-12 11:04:48 +0100 | <Robert42> | I get your point though |
2022-12-12 11:05:08 +0100 | <Robert42> | It is eventually notified that a signal was raised (wherever) |
2022-12-12 11:05:15 +0100 | <dminuoso> | Emphasis is that the signal is already handled by the RTS, and depending on whether or how stg_sig_install is called (via unix/installHandler) might throw an async exception at the main thread |
2022-12-12 11:05:24 +0100 | <Robert42> | Yes, great |
2022-12-12 11:05:26 +0100 | <Robert42> | That makes it clear |
2022-12-12 11:05:30 +0100 | <Robert42> | Thanks |
2022-12-12 11:05:47 +0100 | <dminuoso> | There's some strange edge cases (like installing a handler while a signal is in-flight) |
2022-12-12 11:05:52 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:a897:84c:1a93:9078) (Ping timeout: 252 seconds) |
2022-12-12 11:06:52 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:3891:dc8:a59a:66) |
2022-12-12 11:10:59 +0100 | MajorBiscuit | (~MajorBisc@145.94.137.174) |
2022-12-12 11:11:51 +0100 | werneta | (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 256 seconds) |
2022-12-12 11:12:50 +0100 | werneta | (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
2022-12-12 11:14:24 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) |
2022-12-12 11:17:31 +0100 | Lord_of_Life_ | (~Lord@user/lord-of-life/x-2819915) |
2022-12-12 11:17:31 +0100 | king_gs | (~Thunderbi@187.201.150.200) (Read error: Connection reset by peer) |
2022-12-12 11:17:39 +0100 | werneta | (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 260 seconds) |
2022-12-12 11:18:07 +0100 | werneta | (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
2022-12-12 11:18:44 +0100 | king_gs | (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) |
2022-12-12 11:18:50 +0100 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 256 seconds) |
2022-12-12 11:19:47 +0100 | nut | (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Ping timeout: 256 seconds) |
2022-12-12 11:20:18 +0100 | Lord_of_Life_ | Lord_of_Life |
2022-12-12 11:20:28 +0100 | ft | (~ft@p4fc2a257.dip0.t-ipconnect.de) (Quit: leaving) |
2022-12-12 11:26:43 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) (Remote host closed the connection) |
2022-12-12 11:27:12 +0100 | zer0bitz_ | (~zer0bitz@196.244.192.57) (Read error: Connection reset by peer) |
2022-12-12 11:27:13 +0100 | <merijn> | dminuoso: My problems aren't with installHandler, they're with the actual signal handling. The current incarnation of installHandler is about as sane as it reasonably can be |
2022-12-12 11:27:38 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) |
2022-12-12 11:28:28 +0100 | <merijn> | In completely unrelated AoC news, I have a clever naive version of day6 that expands the input Text into every unique combination N character chunks and somehow still stays below 44KB residency \o/ |
2022-12-12 11:28:51 +0100 | <dminuoso> | Mmm, Ill have to benchmark mine |
2022-12-12 11:29:02 +0100 | econo | (uid147250@user/econo) (Quit: Connection closed for inactivity) |
2022-12-12 11:29:04 +0100 | <dminuoso> | I just rotate a Seq at each character |
2022-12-12 11:29:08 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 248 seconds) |
2022-12-12 11:29:11 +0100 | <dminuoso> | As a circular buffer |
2022-12-12 11:30:22 +0100 | <merijn> | Abusing the fact that lists are lazy and Text slicing are just "views" on the original text, so a bunch of list of N chunks will just lazily produce the chunks as view on the original text |
2022-12-12 11:30:45 +0100 | <dminuoso> | Mmm that's nice |
2022-12-12 11:30:50 +0100 | <dminuoso> | I would probably use bytestring instead |
2022-12-12 11:31:03 +0100 | <merijn> | dminuoso: Quite pleased with the simplicity: https://github.com/merijn/AdventOfCode/blob/master/Day6.hs#L12-L16 |
2022-12-12 11:32:11 +0100 | king_gs | (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) (Ping timeout: 265 seconds) |
2022-12-12 11:33:04 +0100 | zer0bitz | (~zer0bitz@196.244.192.56) |
2022-12-12 11:36:45 +0100 | cfricke | (~cfricke@user/cfricke) |
2022-12-12 11:39:50 +0100 | RobertKrook48 | (~RobertKro@c-fe44205c.024-139-67626724.bbcust.telenor.se) (Ping timeout: 255 seconds) |
2022-12-12 11:40:22 +0100 | Robert42 | (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) (Ping timeout: 256 seconds) |
2022-12-12 11:40:53 +0100 | <dminuoso> | merijn: It's quite nice indeed. |
2022-12-12 11:41:03 +0100 | <dminuoso> | Keeps nice locality of reference as well |
2022-12-12 11:41:18 +0100 | <dminuoso> | I wanted to do the same, but lazyness never occured to me |
2022-12-12 11:41:25 +0100 | cfricke | (~cfricke@user/cfricke) (Client Quit) |
2022-12-12 11:41:41 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) |
2022-12-12 11:44:06 +0100 | <aeroplane> | May I know how do you handle SIGNIT in haskell, I will be grateful if you point me to a simple example. |
2022-12-12 11:44:41 +0100 | <dminuoso> | `Posix.installHandler Posix.sigINT (Posix.Catch $ io goodbye >> closeSocket) Nothing` |
2022-12-12 11:45:44 +0100 | RedSwan | (~jared@174-23-134-43.slkc.qwest.net) (Ping timeout: 268 seconds) |
2022-12-12 11:46:25 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
2022-12-12 11:50:36 +0100 | <merijn> | dminuoso: 93% productivity, 44,432 max residency, so really quite nice :> |
2022-12-12 11:50:59 +0100 | <merijn> | dminuoso: Not sure if there's a better way to check each chunk for doubles, though |
2022-12-12 11:51:15 +0100 | <merijn> | There's probably a cleverer way, but I couldn't be arsed, since I'm behind :p |
2022-12-12 11:51:25 +0100 | <dminuoso> | merijn: I would not go the lazyness route though |
2022-12-12 11:51:31 +0100 | <dminuoso> | its a lot of unnecessary indirecftion that hampers reading |
2022-12-12 11:52:50 +0100 | <merijn> | hmm |
2022-12-12 11:53:01 +0100 | <merijn> | on the one hand, most stuff using the term "metaverse" is dumb |
2022-12-12 11:53:34 +0100 | <merijn> | on the other hand, Tim Sweeney seems interested in PLT and an SPJ talk on PL for "the metaverse" might be actually interesting... |
2022-12-12 11:53:40 +0100 | <merijn> | Anyone watched it yet? |
2022-12-12 11:54:02 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) |
2022-12-12 11:58:39 +0100 | dextaa6 | (~DV@user/dextaa) |
2022-12-12 11:58:45 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) (Ping timeout: 255 seconds) |
2022-12-12 11:59:05 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) (Remote host closed the connection) |
2022-12-12 12:00:37 +0100 | jao | (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) |
2022-12-12 12:00:56 +0100 | CiaoSen | (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) |
2022-12-12 12:01:02 +0100 | beteigeuze | (~Thunderbi@bl14-81-220.dsl.telepac.pt) |
2022-12-12 12:01:09 +0100 | dextaa | (~DV@user/dextaa) (Ping timeout: 268 seconds) |
2022-12-12 12:01:09 +0100 | dextaa6 | dextaa |
2022-12-12 12:04:22 +0100 | jpds2 | (~jpds@gateway/tor-sasl/jpds) (Remote host closed the connection) |
2022-12-12 12:04:57 +0100 | ChaiTRex | (~ChaiTRex@user/chaitrex) (Remote host closed the connection) |
2022-12-12 12:04:58 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
2022-12-12 12:11:23 +0100 | jpds2 | (~jpds@gateway/tor-sasl/jpds) |
2022-12-12 12:11:23 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) |
2022-12-12 12:11:49 +0100 | jonathanx__ | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-12-12 12:13:12 +0100 | <jackdk> | I read the slides, seems like a really interesting take on things. Quite a logic/functional hybrid language, and you can see some of the themes in Sweeney's old POPL talk about Haskell not being quite right coming through in this one |
2022-12-12 12:13:22 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) |
2022-12-12 12:13:51 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-12-12 12:13:53 +0100 | Jade[m] | (~jade1024m@2001:470:69fc:105::2:d68a) |
2022-12-12 12:14:32 +0100 | ChaiTRex | (~ChaiTRex@user/chaitrex) |
2022-12-12 12:18:48 +0100 | Robert75 | (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) |
2022-12-12 12:19:01 +0100 | <Robert75> | Okay I have another fun one for you merijn |
2022-12-12 12:20:23 +0100 | <Robert75> | if I have executed `tid <- forkIO (m `catch` (\myownexceptiontype -> do-the-thing))`, and then run `throwTo tid myownexceptiontype >> killThread tid`, will the async exceptions me received in order? Will the `catch` always execute? |
2022-12-12 12:20:25 +0100 | Guest23 | (~Guest23@27.57.46.219) (Ping timeout: 260 seconds) |
2022-12-12 12:20:49 +0100 | Robert75 | (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) (Remote host closed the connection) |
2022-12-12 12:22:13 +0100 | Robert10 | (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) |
2022-12-12 12:22:14 +0100 | cfricke | (~cfricke@user/cfricke) |
2022-12-12 12:22:30 +0100 | <Robert10> | Sorry, I disconnected. I am not sure if my message was transmitted |
2022-12-12 12:22:39 +0100 | <Robert10> | I said "I had another fun one for you @merijn) |
2022-12-12 12:22:45 +0100 | <Robert10> | "if I have executed `tid <- forkIO (m `catch` (\myownexceptiontype -> do-the-thing))`, and then run `throwTo tid myownexceptiontype >> killThread tid`, will the async exceptions me received in order? Will the `catch` always execute?" |
2022-12-12 12:23:32 +0100 | <merijn> | Define "always" |
2022-12-12 12:23:49 +0100 | <Robert10> | Hm |
2022-12-12 12:23:53 +0100 | <merijn> | and what "do-the-thing" is :p |
2022-12-12 12:23:59 +0100 | <merijn> | In general: no |
2022-12-12 12:24:02 +0100 | <Robert10> | The handler I installed for my own exception type, imagine that "do-the-thing" closes a socket or something |
2022-12-12 12:24:10 +0100 | <merijn> | Actually, maybe? |
2022-12-12 12:24:13 +0100 | <Robert10> | WIll the socket always close if my own exception is thrown before killthread? |
2022-12-12 12:24:18 +0100 | <merijn> | I think catch runs with async masked? |
2022-12-12 12:24:25 +0100 | <Robert10> | before the exception thrown by killthread is handled* |
2022-12-12 12:24:53 +0100 | <merijn> | Robert10: Why even have 2 exceptions? |
2022-12-12 12:25:02 +0100 | <merijn> | killThread literally just throws an async exception |
2022-12-12 12:25:13 +0100 | <merijn> | Just use finally instead of catch and killThread only? |
2022-12-12 12:25:22 +0100 | <merijn> | :t Control.Exception.finally |
2022-12-12 12:25:23 +0100 | <lambdabot> | IO a -> IO b -> IO a |
2022-12-12 12:26:32 +0100 | <Robert10> | Hm, I guess `onException` is more in line with what I want |
2022-12-12 12:26:40 +0100 | <Robert10> | But yes, that is a great suggestion |
2022-12-12 12:26:50 +0100 | nschoe | (~q@141.101.51.197) (Ping timeout: 256 seconds) |
2022-12-12 12:29:26 +0100 | <dminuoso> | merijn: https://gist.github.com/dminuoso/cf4ffb90aa48c82cf8e4946e941c5940 |
2022-12-12 12:29:28 +0100 | <dminuoso> | Is what Im thinking |
2022-12-12 12:29:56 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) |
2022-12-12 12:30:18 +0100 | <dminuoso> | Might need some minimal tweaking, but in principle I think this is as performant as you can make it |
2022-12-12 12:31:30 +0100 | <dminuoso> | Probably best with -XStrict |
2022-12-12 12:32:35 +0100 | <dminuoso> | At least for relatively small inputs since this is just a linear scan |
2022-12-12 12:33:19 +0100 | <dminuoso> | But given that this is tight loop, catch line prefetching should kick in nicely |
2022-12-12 12:34:04 +0100 | <dminuoso> | merijn: One thing strikes me very odd, is your use of a set. |
2022-12-12 12:34:39 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) (Ping timeout: 260 seconds) |
2022-12-12 12:34:43 +0100 | <dminuoso> | actually with this in mind, my code will perform faster at any window sizse (since you need to linearly scan each windo anyway) |
2022-12-12 12:35:31 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) |
2022-12-12 12:40:34 +0100 | califax | (~califax@user/califx) (Quit: ZNC 1.8.2 - https://znc.in) |
2022-12-12 12:41:23 +0100 | califax | (~califax@user/califx) |
2022-12-12 12:41:36 +0100 | Katarushisu4 | (~Katarushi@cpc147790-finc20-2-0-cust502.4-2.cable.virginm.net) |
2022-12-12 12:42:42 +0100 | Katarushisu | (~Katarushi@cpc147790-finc20-2-0-cust502.4-2.cable.virginm.net) (Ping timeout: 256 seconds) |
2022-12-12 12:42:42 +0100 | Katarushisu4 | Katarushisu |
2022-12-12 12:49:53 +0100 | chomwitt | (~chomwitt@2a02:587:7a05:dc00:1ac0:4dff:fedb:a3f1) (Ping timeout: 256 seconds) |
2022-12-12 12:51:34 +0100 | troydm | (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 260 seconds) |
2022-12-12 12:57:54 +0100 | sterni | (~lukas@user/sterni) |
2022-12-12 13:03:00 +0100 | Guest23 | (~Guest23@27.57.46.219) |
2022-12-12 13:03:46 +0100 | <dminuoso> | Also, Im not entirely sure a low residency is necessarily a good indicator. It could indicator that you are bottlenecked and not progressing far enough |
2022-12-12 13:03:52 +0100 | <dminuoso> | *quickly enough |
2022-12-12 13:04:08 +0100 | Guest23 | (~Guest23@27.57.46.219) (Client Quit) |
2022-12-12 13:08:04 +0100 | burnsidesLlama | (~burnsides@119247164140.ctinets.com) (Remote host closed the connection) |
2022-12-12 13:08:37 +0100 | chomwitt | (~chomwitt@ppp-94-69-55-246.home.otenet.gr) |
2022-12-12 13:08:40 +0100 | burnsidesLlama | (~burnsides@138.199.22.99) |
2022-12-12 13:09:29 +0100 | califax | (~califax@user/califx) (Ping timeout: 255 seconds) |
2022-12-12 13:09:56 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 255 seconds) |
2022-12-12 13:10:40 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) |
2022-12-12 13:10:47 +0100 | califax | (~califax@user/califx) |
2022-12-12 13:16:15 +0100 | <dminuoso> | Same for productivity I guess |
2022-12-12 13:16:45 +0100 | <dminuoso> | (which could indicate you are doing a lot of unnessary work) |
2022-12-12 13:16:59 +0100 | CiaoSen | (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 246 seconds) |
2022-12-12 13:20:44 +0100 | Robert10 | (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) (Ping timeout: 260 seconds) |
2022-12-12 13:21:39 +0100 | mmhat | (~mmh@p200300f1c73901ceee086bfffe095315.dip0.t-ipconnect.de) (Ping timeout: 260 seconds) |
2022-12-12 13:22:01 +0100 | mmhat | (~mmh@p200300f1c7390125ee086bfffe095315.dip0.t-ipconnect.de) |
2022-12-12 13:31:33 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) |
2022-12-12 13:48:38 +0100 | <merijn> | dminuoso: What do you do? Write an individual scan? |
2022-12-12 13:49:00 +0100 | <merijn> | I was gonna do some early bail out on detecting duplicates, but it was so fast this way I didn't bother |
2022-12-12 13:49:44 +0100 | <merijn> | Like, it prints out results for both puzzles *immediately* when I hit enter in the shell, so didn't seem worth complicating the logic further |
2022-12-12 13:51:03 +0100 | Guest23 | (~Guest23@27.57.46.219) |
2022-12-12 13:51:07 +0100 | <dminuoso> | merijn: Well it is essentially a linear scan in memory, yes |
2022-12-12 13:52:21 +0100 | <merijn> | dminuoso: The logic for an *efficient* early bail out for duplicates just seemed annoying to write :p |
2022-12-12 13:55:37 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) |
2022-12-12 13:58:44 +0100 | <dminuoso> | merijn: Dunno, didnt seem annoying to me *shrugs* |
2022-12-12 13:59:12 +0100 | shapr | (~user@68.54.166.125) |
2022-12-12 13:59:53 +0100 | coot | (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Quit: coot) |
2022-12-12 14:00:10 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) (Ping timeout: 260 seconds) |
2022-12-12 14:00:38 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-12-12 14:00:55 +0100 | AlexZenon | (~alzenon@178.34.161.14) (Quit: ;-) |
2022-12-12 14:01:14 +0100 | Alex_test | (~al_test@178.34.161.14) (Quit: ;-) |
2022-12-12 14:01:37 +0100 | AlexNoo | (~AlexNoo@178.34.161.14) (Quit: Leaving) |
2022-12-12 14:01:42 +0100 | nschoe | (~q@141.101.51.197) |
2022-12-12 14:02:29 +0100 | shriekingnoise | (~shrieking@186.137.167.202) |
2022-12-12 14:06:11 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds) |
2022-12-12 14:10:11 +0100 | emergence | (emergence@2607:5300:60:5910:dcad:beff:feef:5bc) (Quit: Ping timeout (120 seconds)) |
2022-12-12 14:10:25 +0100 | emergence | (emergence@2607:5300:60:5910:dcad:beff:feef:5bc) |
2022-12-12 14:12:07 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
2022-12-12 14:12:25 +0100 | AlexNoo | (~AlexNoo@178.34.161.14) |
2022-12-12 14:17:11 +0100 | AlexZenon | (~alzenon@178.34.161.14) |
2022-12-12 14:17:20 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 256 seconds) |
2022-12-12 14:22:09 +0100 | Alex_test | (~al_test@178.34.161.14) |
2022-12-12 14:24:22 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
2022-12-12 14:25:49 +0100 | <merijn> | yegh |
2022-12-12 14:26:04 +0100 | <merijn> | I thought I could reuse last years nice convolution for day 8, but that doesn't quite work |
2022-12-12 14:26:47 +0100 | xff0x_ | (~xff0x@ai071162.d.east.v6connect.net) |
2022-12-12 14:30:56 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
2022-12-12 14:31:59 +0100 | jmdaemon | (~jmdaemon@user/jmdaemon) (Ping timeout: 265 seconds) |
2022-12-12 14:33:41 +0100 | burnsidesLlama | (~burnsides@138.199.22.99) (Remote host closed the connection) |
2022-12-12 14:34:38 +0100 | burnsidesLlama | (~burnsides@138.199.22.99) |
2022-12-12 14:35:49 +0100 | coot | (~coot@213.134.171.3) |
2022-12-12 14:38:54 +0100 | burnsidesLlama | (~burnsides@138.199.22.99) (Ping timeout: 260 seconds) |
2022-12-12 14:42:47 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) |
2022-12-12 14:44:34 +0100 | irrgit | (~irrgit@146.70.27.218) |
2022-12-12 14:45:41 +0100 | irrgit__ | (~irrgit@176.113.74.74) (Quit: Leaving) |
2022-12-12 14:46:14 +0100 | CiaoSen | (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) |
2022-12-12 15:00:20 +0100 | thegeekinside | (~thegeekin@189.217.82.244) |
2022-12-12 15:04:52 +0100 | lisbeths | (uid135845@id-135845.lymington.irccloud.com) (Quit: Connection closed for inactivity) |
2022-12-12 15:06:42 +0100 | thyriaen | (~thyriaen@2a01:aea0:dd4:4bae:6245:cbff:fe9f:48b1) |
2022-12-12 15:07:33 +0100 | Erutuon_ | (~Erutuon@user/erutuon) |
2022-12-12 15:10:39 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 15:10:47 +0100 | fizbin | (~fizbin@user/fizbin) (Ping timeout: 246 seconds) |
2022-12-12 15:11:44 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 256 seconds) |
2022-12-12 15:12:23 +0100 | Erutuon_ | (~Erutuon@user/erutuon) (Ping timeout: 260 seconds) |
2022-12-12 15:13:34 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
2022-12-12 15:14:46 +0100 | Erutuon_ | (~Erutuon@user/erutuon) |
2022-12-12 15:15:57 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Quit: Client closed) |
2022-12-12 15:17:26 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 15:18:08 +0100 | razetime | (~quassel@49.207.203.213) (Ping timeout: 252 seconds) |
2022-12-12 15:20:33 +0100 | niko | (niko@libera/staff/niko) (Ping timeout: 615 seconds) |
2022-12-12 15:21:20 +0100 | jpds2 | (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 255 seconds) |
2022-12-12 15:23:17 +0100 | jpds2 | (~jpds@gateway/tor-sasl/jpds) |
2022-12-12 15:23:55 +0100 | Guest23 | (~Guest23@27.57.46.219) (Ping timeout: 260 seconds) |
2022-12-12 15:24:02 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) (Ping timeout: 255 seconds) |
2022-12-12 15:26:23 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Ping timeout: 260 seconds) |
2022-12-12 15:31:34 +0100 | <merijn> | Wait...it *is* a convolution, I'm just thinking wrong |
2022-12-12 15:33:40 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
2022-12-12 15:34:00 +0100 | mncheckm | (~mncheck@193.224.205.254) (Remote host closed the connection) |
2022-12-12 15:37:14 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 256 seconds) |
2022-12-12 15:39:11 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 15:41:09 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
2022-12-12 15:42:05 +0100 | motherfsck | (~motherfsc@user/motherfsck) |
2022-12-12 15:43:13 +0100 | motherfsck | (~motherfsc@user/motherfsck) (Client Quit) |
2022-12-12 15:43:33 +0100 | motherfsck | (~motherfsc@user/motherfsck) |
2022-12-12 15:46:25 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 265 seconds) |
2022-12-12 15:48:54 +0100 | <dminuoso> | Can someone explain to me where `Typeable t` comes from? https://gist.github.com/dminuoso/f4025f0d06d685f3f2104a6c65b5a7ad |
2022-12-12 15:49:07 +0100 | <dminuoso> | It's not a superclass of my SwaggerOptions helper class, Im a bit baffled |
2022-12-12 15:52:36 +0100 | <[Leary]> | superclass of ToSchema? |
2022-12-12 15:53:01 +0100 | <dminuoso> | `class Typeable a => ToSchema a where` |
2022-12-12 15:53:13 +0100 | <dminuoso> | So how is this asking for `Typeable t`, rather than `Typeable (CustomSchema t a)`? |
2022-12-12 15:54:08 +0100 | <[Leary]> | That's implied by concreteness of CustomSchema ... if it already knows `Typeable a` from the context. |
2022-12-12 15:54:36 +0100 | jakalx | (~jakalx@base.jakalx.net) (Error from remote client) |
2022-12-12 15:54:56 +0100 | <mniip> | dminuoso, the automatically generated instance is (Typeable t, Typeable a) => Typeable (CustomSchema t a) |
2022-12-12 15:55:14 +0100 | <dminuoso> | mniip: Without any `deriving Typeable`? |
2022-12-12 15:55:23 +0100 | <mniip> | yup |
2022-12-12 15:55:27 +0100 | <dminuoso> | Oh wow. Okay. |
2022-12-12 15:55:31 +0100 | <mniip> | that's how Typeable work as of... ghc 8? |
2022-12-12 15:55:43 +0100 | dminuoso | readies his sed |
2022-12-12 15:55:55 +0100 | <mniip> | 7.10 even |
2022-12-12 15:56:23 +0100 | <dminuoso> | Even type error slicing would have been difficult with a hidden generated typeclass instance |
2022-12-12 15:56:29 +0100 | <dminuoso> | But oh well, thanks for the pointer |
2022-12-12 15:57:08 +0100 | razetime | (~quassel@49.207.203.213) |
2022-12-12 16:00:09 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) |
2022-12-12 16:01:14 +0100 | mncheck | (~mncheck@193.224.205.254) |
2022-12-12 16:02:16 +0100 | mncheck | (~mncheck@193.224.205.254) (Remote host closed the connection) |
2022-12-12 16:02:19 +0100 | kritzefitz | (~kritzefit@debian/kritzefitz) (Ping timeout: 260 seconds) |
2022-12-12 16:02:53 +0100 | mncheckm | (~mncheck@193.224.205.254) |
2022-12-12 16:03:51 +0100 | cfricke | (~cfricke@user/cfricke) (Quit: WeeChat 3.7.1) |
2022-12-12 16:04:09 +0100 | jakalx | (~jakalx@base.jakalx.net) |
2022-12-12 16:05:00 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
2022-12-12 16:06:37 +0100 | Feuermagier | (~Feuermagi@user/feuermagier) (Quit: Leaving) |
2022-12-12 16:07:10 +0100 | doyougnu | (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) |
2022-12-12 16:07:50 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 256 seconds) |
2022-12-12 16:10:01 +0100 | Lycurgus | (~juan@user/Lycurgus) |
2022-12-12 16:10:35 +0100 | jakalx | (~jakalx@base.jakalx.net) () |
2022-12-12 16:11:13 +0100 | Ranhir | (~Ranhir@157.97.53.139) (Read error: Connection reset by peer) |
2022-12-12 16:12:28 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Quit: Client closed) |
2022-12-12 16:14:25 +0100 | jakalx | (~jakalx@base.jakalx.net) |
2022-12-12 16:15:02 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 16:17:20 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) |
2022-12-12 16:26:48 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Quit: Client closed) |
2022-12-12 16:27:55 +0100 | bgs | (~bgs@212-85-160-171.dynamic.telemach.net) |
2022-12-12 16:28:37 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 16:28:59 +0100 | dcoutts | (~duncan@host86-151-44-212.range86-151.btcentralplus.com) |
2022-12-12 16:30:17 +0100 | Daelyte | (~Icecoldfr@2607:fea8:680:1070:f98a:1300:69ec:7b77) |
2022-12-12 16:31:57 +0100 | Daelyte | (~Icecoldfr@2607:fea8:680:1070:f98a:1300:69ec:7b77) (Remote host closed the connection) |
2022-12-12 16:34:13 +0100 | Unicorn_Princess | (~Unicorn_P@user/Unicorn-Princess/x-3540542) |
2022-12-12 16:34:43 +0100 | dsrt^ | (~dsrt@76.145.185.103) (Remote host closed the connection) |
2022-12-12 16:37:54 +0100 | Barfolomew | (~Barfolome@2a0a-a546-5b20-1-7fee-17bd-2c6b-c767.ipv6dyn.netcologne.de) |
2022-12-12 16:39:46 +0100 | <Barfolomew> | Hi. I have trouble understanding writing fundep instances. How do I write instances for types with parameters? Like in this hopefully otherwise unambiguous wrong example: https://pastes.io/qd3vvtoptd |
2022-12-12 16:40:04 +0100 | sadmax | (~user@209.205.174.253) |
2022-12-12 16:40:26 +0100 | Ranhir | (~Ranhir@157.97.53.139) |
2022-12-12 16:40:46 +0100 | kritzefitz | (~kritzefit@debian/kritzefitz) |
2022-12-12 16:40:47 +0100 | Guest23 | (~Guest23@27.57.46.219) |
2022-12-12 16:41:36 +0100 | <merijn> | Barfolomew: I mean, that example doesn't really make sense, imo? |
2022-12-12 16:42:08 +0100 | Lycurgus | (~juan@user/Lycurgus) (Quit: Exeunt: https://tinyurl.com/4m8d4kd5) |
2022-12-12 16:42:17 +0100 | <merijn> | Barfolomew: That code would "just work" if you deleted the fundep and fixed you instance to be "instance Less Simple t where" |
2022-12-12 16:43:14 +0100 | <merijn> | as-is it can't work, since in the class definition 'less' has kind '* -> *', but "Simple t" in the instance declaration has kind * |
2022-12-12 16:44:10 +0100 | <Barfolomew> | merijn: Yes, it is a wrong example, I hoped it was unambiguous what it should be. I just didn’t know how to write that. ;) |
2022-12-12 16:45:15 +0100 | Digit | (~user@user/digit) (Ping timeout: 260 seconds) |
2022-12-12 16:46:17 +0100 | mikoto-chan | (~mikoto-ch@85-76-2-122-nat.elisa-mobile.fi) |
2022-12-12 16:46:35 +0100 | <Barfolomew> | merijn: I just tried it and removed the `| less -> t` and changed the instance to `instance Less Simple t where` and it tells me “Illegal instance declaration for ‘Less Simple t’”. |
2022-12-12 16:46:56 +0100 | cheater | (~Username@user/cheater) (Ping timeout: 256 seconds) |
2022-12-12 16:46:56 +0100 | cheater1__ | (~Username@user/cheater) |
2022-12-12 16:47:00 +0100 | cheater1__ | cheater |
2022-12-12 16:47:11 +0100 | <merijn> | Barfolomew: Does it say some stuff about FlexibleInstances? |
2022-12-12 16:47:41 +0100 | <merijn> | (in the error) |
2022-12-12 16:47:48 +0100 | <Barfolomew> | merijn: I guess my core problem is, that as far as I can tell, the allowed syntax for instances of fundeps is undocumented. (I tried the GHC docs and the Haskell Wiki.) |
2022-12-12 16:47:52 +0100 | <Barfolomew> | merijn: Yes, it does |
2022-12-12 16:48:06 +0100 | <merijn> | Barfolomew: Yeah, just enable FlexibleInstances and it'll work |
2022-12-12 16:48:32 +0100 | <merijn> | Barfolomew: The Haskell Report is...overly strict in what you are allowed to write in instance definitions |
2022-12-12 16:49:19 +0100 | <merijn> | FlexibleInstances basically stops adhering strictly to the Haskell2010 report limitations of instance definitions |
2022-12-12 16:50:05 +0100 | <merijn> | FlexibleInstances and FlexibleContexts are about the only extensions where, if an error says to enable them, enabling is actually nearly always the right solution ;) |
2022-12-12 16:50:34 +0100 | <Barfolomew> | merijn: I enabled FlexibleInstance and MultiParamTypeClasses (but not FuctionalDependencies), (and added the `Num t =>` to `f`, and now it compiles. |
2022-12-12 16:51:07 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Quit: Client closed) |
2022-12-12 16:51:33 +0100 | <Barfolomew> | merijn: Interestingly, don’t want to enable FlexibleInstances because I remember something about it creating ambiguities that later cause runtime undecidability and generally bad stuff. Is this correct or am I misremembering? |
2022-12-12 16:52:04 +0100 | <merijn> | Barfolomew: In practice MultiParamTypeClasses nearly always will end up with you wanting FlexibleInstances/FlexibleContexts (since you frequently want to specify some arguments explicitly, which Haskell2010 doesn't allow) |
2022-12-12 16:52:30 +0100 | nut | (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) |
2022-12-12 16:52:42 +0100 | <merijn> | Barfolomew: You are misremembering, FlexibleInstances/FlexibleContexts are completely benign |
2022-12-12 16:52:59 +0100 | <merijn> | Barfolomew: Possibly thinking of OverlappingInstances |
2022-12-12 16:54:26 +0100 | <merijn> | There are only a handful of extensions that can lead to runtime problems |
2022-12-12 16:54:47 +0100 | mikoto-chan | (~mikoto-ch@85-76-2-122-nat.elisa-mobile.fi) (Read error: Connection reset by peer) |
2022-12-12 16:57:19 +0100 | <Barfolomew> | merijn: In my real code, one of the types has more than one parameter. But any variation I tried for the instance type didn’t work: https://pastes.io/dpetdeuokq … |
2022-12-12 16:58:15 +0100 | Sgeo | (~Sgeo@user/sgeo) |
2022-12-12 16:58:17 +0100 | <merijn> | The only ones I'd be *really* paranoid about are: OverlappingInstances/IncoherentInstances and some of the more questionable ones are NPlusK, ImplicitParams, and in old GHC's ImpredicativeTypes (might be ok in the 9.x series? I haven't looked what's happened to it with the most recent paper on it) |
2022-12-12 16:58:17 +0100 | eggplantade | (~Eggplanta@104-55-37-220.lightspeed.sntcca.sbcglobal.net) |
2022-12-12 16:58:18 +0100 | <Barfolomew> | merijn: E.g. I had assumed, I could write `https://pastes.io/dpetdeuokq` |
2022-12-12 16:58:32 +0100 | <Barfolomew> | Oops, wrong paste |
2022-12-12 16:59:18 +0100 | <Barfolomew> | merijn: E.g. I had assumed, I could write `instance Less (Simple t r) t where`. Because obviously `instance Less (Simple _ r) t where` is not possible. |
2022-12-12 16:59:48 +0100 | <merijn> | Barfolomew: You'd have to change your class definition |
2022-12-12 16:59:55 +0100 | <Jade[m]> | is there something like `Glyph-Haskell` which essentially has a custom prelude or other modules that exports unicode alternatives for functions? |
2022-12-12 16:59:55 +0100 | <Jade[m]> | If not I think I'd want to make that just for fun |
2022-12-12 17:00:22 +0100 | <merijn> | Jade[m]: There is already unicode syntax for a bunch of stuff like forall and arrows |
2022-12-12 17:00:31 +0100 | <Barfolomew> | merijn: I didn’t know NPlusK was actually dangerous. I assumed it was just a convenient pattern that was a bit out of place / “unclean”. |
2022-12-12 17:00:32 +0100 | aeroplane | (~user@user/aeroplane) (Read error: Connection reset by peer) |
2022-12-12 17:00:32 +0100 | <merijn> | Jade[m]: Check the manual on the UnicodeSyntax extension |
2022-12-12 17:00:47 +0100 | <Jade[m]> | Will look into it, thanks |
2022-12-12 17:00:49 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
2022-12-12 17:00:49 +0100 | <merijn> | Barfolomew: It's not dangerous so much, as it leads to questionable code |
2022-12-12 17:01:18 +0100 | sadmax | (~user@209.205.174.253) (Read error: No route to host) |
2022-12-12 17:01:22 +0100 | xsarnik | (xsarnik@lounge.fi.muni.cz) (Quit: Ping timeout (120 seconds)) |
2022-12-12 17:01:23 +0100 | xstill_ | (xstill@fimu/xstill) (Quit: Ping timeout (120 seconds)) |
2022-12-12 17:01:53 +0100 | <merijn> | Barfolomew: The "right" FunDeps approach would be like: https://paste.tomsmeding.com/KzLhaKPn |
2022-12-12 17:02:05 +0100 | <Jade[m]> | Jade[m]: Yup looks about what I had in mind but I'd want to go a step further and APL-ify the prelude on the naming level |
2022-12-12 17:02:17 +0100 | <merijn> | Barfolomew: i.e. don't parameterise the less type in the class |
2022-12-12 17:02:45 +0100 | <merijn> | Jade[m]: Probably someone has already made something like that, but don't let that stop you ;) |
2022-12-12 17:02:59 +0100 | eggplantade | (~Eggplanta@104-55-37-220.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds) |
2022-12-12 17:03:06 +0100 | <EvanR> | thy code is unclean |
2022-12-12 17:03:12 +0100 | <merijn> | You can disable/hide the standard Prelude fairly easily |
2022-12-12 17:03:16 +0100 | <Barfolomew> | merijn: The class definition should allow writing instances for `data Simple1 t = …` and `data Simple2 t r = …` though. The only way to change the the class definition that I can think of, is one that would allow Simple2 but not Simple1 anymore, no? |
2022-12-12 17:04:14 +0100 | Guest23 | (~Guest23@27.57.46.219) (Ping timeout: 265 seconds) |
2022-12-12 17:05:33 +0100 | <merijn> | Barfolomew: It does, though? |
2022-12-12 17:06:02 +0100 | <Barfolomew> | merijn: I will sitll need a t parameter in the function `f` though, as the first function parameter’s type must be a type parameter for the second/third function parameter, no? |
2022-12-12 17:06:08 +0100 | <Barfolomew> | *still |
2022-12-12 17:06:53 +0100 | <Barfolomew> | Reworded: I will still need a `t` parameter in the function `f` though, as the first function parameter’s type must be a type parameter for the second/third function parameter’s type, no? |
2022-12-12 17:06:59 +0100 | <Jade[m]> | https://hackage.haskell.org/package/base-unicode-symbols |
2022-12-12 17:06:59 +0100 | <Jade[m]> | Seems to already do a lot but I want to continue this ad absurdum |
2022-12-12 17:07:09 +0100 | <merijn> | Barfolomew: https://paste.tomsmeding.com/XhtW4eBa |
2022-12-12 17:07:33 +0100 | <EvanR> | emoji haskell |
2022-12-12 17:07:44 +0100 | <merijn> | Note that'd be more sensible to move the Num constraint on t into the Less class |
2022-12-12 17:08:07 +0100 | <Jade[m]> | > <@jade1024:matrix.org> https://hackage.haskell.org/package/base-unicode-symbols |
2022-12-12 17:08:07 +0100 | <Jade[m]> | > Seems to already do a lot but I want to continue this ad absurdum |
2022-12-12 17:08:07 +0100 | <Jade[m]> | This essentially unicodifies all "mathy" symbols |
2022-12-12 17:08:09 +0100 | <lambdabot> | <hint>:1:1: error: parse error on input ‘<@’ |
2022-12-12 17:08:09 +0100 | <lambdabot> | error: |
2022-12-12 17:08:09 +0100 | <lambdabot> | Unexpected do block in function application: |
2022-12-12 17:08:09 +0100 | <lambdabot> | do a lot but I want to continue this ad absurdum |
2022-12-12 17:08:11 +0100 | <Jade[m]> | > <@jade1024:matrix.org> https://hackage.haskell.org/package/base-unicode-symbols |
2022-12-12 17:08:11 +0100 | <Jade[m]> | > Seems to already do a lot but I want to continue this ad absurdum |
2022-12-12 17:08:11 +0100 | <Jade[m]> | * This essentially unicodifies all "mathy" symbols, nothing beyond |
2022-12-12 17:08:12 +0100 | <merijn> | Barfolomew: No, with the fundeps approach you pass a type of kind * as the argument for less |
2022-12-12 17:08:12 +0100 | <lambdabot> | <hint>:1:1: error: parse error on input ‘<@’ |
2022-12-12 17:08:13 +0100 | <lambdabot> | error: |
2022-12-12 17:08:13 +0100 | <lambdabot> | Unexpected do block in function application: |
2022-12-12 17:08:15 +0100 | <lambdabot> | do a lot but I want to continue this ad absurdum |
2022-12-12 17:08:23 +0100 | <Barfolomew> | merijn: How does babby^Wcode work?? How girl^Wtype get pregnant^Waccepted? XD |
2022-12-12 17:08:45 +0100 | <Barfolomew> | merijn: Aah, OK, I think it finally clicked. |
2022-12-12 17:08:50 +0100 | <merijn> | Barfolomew: the fundeps says that the type of 't' is determined by type 'less' |
2022-12-12 17:09:00 +0100 | <merijn> | Barfolomew: So in "instance Less (Simple1 t) t where |
2022-12-12 17:09:01 +0100 | <merijn> | " |
2022-12-12 17:09:05 +0100 | sadmax | (~user@209.205.174.253) |
2022-12-12 17:09:10 +0100 | Digitteknohippie | (~user@user/digit) |
2022-12-12 17:09:14 +0100 | <Barfolomew> | merijn: Fundeps = “You don’t need to specify the type parameters anymore, since they are uniquely determined.” |
2022-12-12 17:09:44 +0100 | <merijn> | Barfolomew: Well, you need a relation between the type of the first and second argument of 'f' |
2022-12-12 17:09:54 +0100 | <merijn> | One way to do that is to have it as explicit parameter |
2022-12-12 17:10:16 +0100 | <Barfolomew> | Barfolomew: I really hate that I get older and can’t just “see” these things anymore. :-/ … Stupid candy addiction… |
2022-12-12 17:10:18 +0100 | <merijn> | The other way to do it is to say that 't' is uniquely determined by 'less' and therefore they are still linked |
2022-12-12 17:12:41 +0100 | bontaq | (~user@ool-45779fe5.dyn.optonline.net) |
2022-12-12 17:13:14 +0100 | fizbin | (~fizbin@user/fizbin) |
2022-12-12 17:13:23 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 17:14:21 +0100 | mmhat | (~mmh@p200300f1c7390125ee086bfffe095315.dip0.t-ipconnect.de) (Quit: WeeChat 3.7.1) |
2022-12-12 17:21:18 +0100 | L29Ah | (~L29Ah@wikipedia/L29Ah) (Disconnected: Replaced by new connection) |
2022-12-12 17:21:31 +0100 | L29Ah | (~L29Ah@wikipedia/L29Ah) |
2022-12-12 17:23:00 +0100 | <Jade[m]> | I wish you could use a prime (`'`) with infix operators |
2022-12-12 17:24:31 +0100 | lortabac | (~lortabac@2a01:e0a:541:b8f0:3891:dc8:a59a:66) (Quit: WeeChat 2.8) |
2022-12-12 17:24:53 +0100 | <probie> | Jade[m]: you can use the actual prime character from the math block in unicode |
2022-12-12 17:25:59 +0100 | <Jade[m]> | oh that's neat |
2022-12-12 17:26:01 +0100 | <Jade[m]> | thanks |
2022-12-12 17:26:06 +0100 | <probie> | e.g. (+′) is a valid identifier |
2022-12-12 17:27:01 +0100 | <Jade[m]> | thanks! |
2022-12-12 17:30:56 +0100 | j4cc3b | (~jeffreybe@pool-74-105-2-138.nwrknj.fios.verizon.net) |
2022-12-12 17:31:21 +0100 | <Jade[m]> | The big problem with a full unicode prelude is unary functions |
2022-12-12 17:31:42 +0100 | <Jade[m]> | because unicode unary functions are just bad if you have to paranthesize them everytime |
2022-12-12 17:32:09 +0100 | nut | (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Ping timeout: 260 seconds) |
2022-12-12 17:32:09 +0100 | <Barfolomew> | merijn: I now tried to extend the class `Less` with a second function `g :: Bool -> less -> less`, but it complains because it doesn’t have the `t` in its type and is therefore ambiguous. I would have gone `g :: Bool -> less t -> less t`, but of course, then we’re back at the previous problem… |
2022-12-12 17:32:49 +0100 | CiaoSen | (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Quit: CiaoSen) |
2022-12-12 17:33:41 +0100 | <Barfolomew> | merijn: (I want to learn this stuff in general, not just having to ask each time because I don’t understand the rules underneath it. :/) |
2022-12-12 17:36:32 +0100 | <merijn> | Barfolomew: Usually what people do is add a dummy argument that lets you infer t |
2022-12-12 17:36:38 +0100 | <merijn> | Or avoid MPTCs :p |
2022-12-12 17:36:56 +0100 | <c_wraith> | Or just write a second class |
2022-12-12 17:37:24 +0100 | cheater | (~Username@user/cheater) (Ping timeout: 260 seconds) |
2022-12-12 17:37:35 +0100 | cheater | (~Username@user/cheater) |
2022-12-12 17:39:49 +0100 | <merijn> | Or no class at all :p |
2022-12-12 17:40:04 +0100 | ph88 | (~ph88@2a02:8109:9e00:71d0:1467:6d51:6255:a37) |
2022-12-12 17:40:24 +0100 | <Barfolomew> | probie: Is the prime character a different code point from the apostrophe and the like? My keyboard layout has seven different apostrophe-like characters on eight key/combo positions that are mostly pretty much visually indistinguishable , just as many different dashes, and three kinds of spaces, to make it extra-delicious, and I may need to go |
2022-12-12 17:40:24 +0100 | <Barfolomew> | into Unicode rehab. ;) |
2022-12-12 17:41:37 +0100 | <Barfolomew> | merijn: Oh trust me, it’s winter, I’m at home, … I already have no class whatsoever. ;) |
2022-12-12 17:42:02 +0100 | <geekosaur> | ′ is U+2032 |
2022-12-12 17:42:10 +0100 | <EvanR> | Jade[m], even worse, all functions in haskell are unary, making me question this entire thing |
2022-12-12 17:42:28 +0100 | Kaiepi | (~Kaiepi@108.175.84.104) (Ping timeout: 248 seconds) |
2022-12-12 17:44:20 +0100 | Digitteknohippie | (~user@user/digit) (Quit: ERC (IRC client for Emacs 27.1)) |
2022-12-12 17:45:19 +0100 | Digit | (~user@user/digit) |
2022-12-12 17:45:25 +0100 | <Barfolomew> | merijn: I vaguely remember GHC’s ability for functions to have types in its parameter that are never used in the function itself. Something something proxy something something. Fundeps for function types would sure be useful here. |
2022-12-12 17:45:59 +0100 | nut | (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) |
2022-12-12 17:46:06 +0100 | <EvanR> | phantom? |
2022-12-12 17:46:12 +0100 | freeside | (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 248 seconds) |
2022-12-12 17:46:24 +0100 | califax | (~califax@user/califx) (Remote host closed the connection) |
2022-12-12 17:46:27 +0100 | <Jade[m]> | Oh yeah, yeah I know |
2022-12-12 17:46:52 +0100 | <Jade[m]> | But with "unary" I mean `a -> b` where `b` is not a function |
2022-12-12 17:47:15 +0100 | <EvanR> | redesign haskell so it only has binary operations, then we can live in the promised land of operators everywhere |
2022-12-12 17:47:31 +0100 | <Jade[m]> | haha, just make it into APL |
2022-12-12 17:47:35 +0100 | <probie> | Or just become Agda and have full mixfix functions |
2022-12-12 17:47:41 +0100 | <Barfolomew> | I swear, one day somebody will write a Doctor Who episode in Haskell. Using the Tardis monad to hunt the evil phantom types that lead to reallyreallyunsafeManifestCosmicAbomination. |
2022-12-12 17:48:04 +0100 | <EvanR> | unsafeUnutterablePerformIO |
2022-12-12 17:48:10 +0100 | <EvanR> | or something |
2022-12-12 17:48:25 +0100 | <Barfolomew> | EvanR: That’s what I was thinking of, yeah. :) |
2022-12-12 17:48:40 +0100 | <probie> | You're not living life on the edge until you've needed `unsafeCoerce unsafeCoerce` |
2022-12-12 17:48:51 +0100 | <EvanR> | o_O |
2022-12-12 17:49:14 +0100 | <EvanR> | that's unsafe^2 + 2unsafeCoerce + coerce^2 |
2022-12-12 17:49:34 +0100 | <c_wraith> | one time I wrote f = unsafeCoerce . g . unsafeCoerce |
2022-12-12 17:49:45 +0100 | califax | (~califax@user/califx) |
2022-12-12 17:49:58 +0100 | <c_wraith> | then I looked at it for a minute and went "I feel dumb" and changed it to f = unsafeCoerce g |
2022-12-12 17:50:20 +0100 | <probie> | unsafeCoerce :: a -> b, but if you turn on linear types, you might need it to be an a a %1-> b, so you need to unsafeCoerce your unsafeCoerce |
2022-12-12 17:50:32 +0100 | <probie> | s/an a/an/ |
2022-12-12 17:50:43 +0100 | <EvanR> | main = fix unsafeCoerce |
2022-12-12 17:50:51 +0100 | <c_wraith> | is it broken? |
2022-12-12 17:50:55 +0100 | <Jade[m]> | help |
2022-12-12 17:51:08 +0100 | <EvanR> | it is now |
2022-12-12 17:51:40 +0100 | <Jade[m]> | EvanR: `let fix' = unsafeCoerce fix in fix' unsafeCoerce` |
2022-12-12 17:53:32 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 246 seconds) |
2022-12-12 17:55:41 +0100 | AndreasK | (sid320732@id-320732.uxbridge.irccloud.com) |
2022-12-12 17:56:47 +0100 | <Barfolomew> | What Haskell really lacks, is a function to write into its executable’s own memory via /proc/$pid/mem for the purposes of self-modifying code. … 🤣 … But I must make it *more evil*! … How about transmitting bits on buses in a way that it sends out focused radio signals that cause matter itself to vibrate itself into new molecules, and |
2022-12-12 17:56:48 +0100 | <Barfolomew> | cause real T-1000 golems to emerge out of your computer and things, who will go on to do no less than to end the universe itself? … Now if only ChatGPT was actually an AI. Then I would ask it for the code for that. Written in Malbolge though! ;) |
2022-12-12 17:58:44 +0100 | sadmax | (~user@209.205.174.253) (Ping timeout: 255 seconds) |
2022-12-12 18:00:47 +0100 | <Jade[m]> | > Now if only ChatGPT was actually an AI |
2022-12-12 18:00:49 +0100 | <Jade[m]> | hm? |
2022-12-12 18:00:49 +0100 | <lambdabot> | <hint>:1:39: error: |
2022-12-12 18:00:49 +0100 | <lambdabot> | parse error (possibly incorrect indentation or mismatched brackets) |
2022-12-12 18:01:35 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-12-12 18:01:38 +0100 | <Barfolomew> | Jade[m]: Hm? |
2022-12-12 18:01:48 +0100 | Kaiepi | (~Kaiepi@108.175.84.104) |
2022-12-12 18:02:13 +0100 | <Jade[m]> | What do you mean by ChatGPT not being an actual AI? |
2022-12-12 18:04:00 +0100 | <EvanR> | actual AI |
2022-12-12 18:04:47 +0100 | <EvanR> | Barfolomew, that xkcd about the butterfly effect kind of trumps all |
2022-12-12 18:04:52 +0100 | econo | (uid147250@user/econo) |
2022-12-12 18:05:16 +0100 | <Jade[m]> | I still don't get it |
2022-12-12 18:05:29 +0100 | <geekosaur> | struck me as a well trained markov bot, not an ai as such |
2022-12-12 18:07:20 +0100 | <darkling> | To my mind, the writing quality overlaps with that of a confused undergrad copying things they don't understand in the hopes that enough of the right words will gain marks. |
2022-12-12 18:07:25 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
2022-12-12 18:07:28 +0100 | <darkling> | ... but then we don't really need more of those. |
2022-12-12 18:07:57 +0100 | <EvanR> | so you're saying by using one for understand would be a break even |
2022-12-12 18:08:01 +0100 | <EvanR> | undergrad |
2022-12-12 18:08:07 +0100 | <Jade[m]> | ah yes |
2022-12-12 18:08:22 +0100 | <EvanR> | I could have saved myself a lot of stress |
2022-12-12 18:08:23 +0100 | <Jade[m]> | that makes sense I suppose but it strikes me to go beyond recreation a little |
2022-12-12 18:08:24 +0100 | <darkling> | Undergrads can improve with feedback. :) |
2022-12-12 18:08:37 +0100 | <Jade[m]> | though it recreates a lot i agree |
2022-12-12 18:08:57 +0100 | <darkling> | It gets a lot badly wrong, but makes it look plausible. |
2022-12-12 18:09:13 +0100 | <Jade[m]> | hm yeah |
2022-12-12 18:09:23 +0100 | <Jade[m]> | I still think it's pretty cool |
2022-12-12 18:09:31 +0100 | <Jade[m]> | but then again it's by elon musk so ... |
2022-12-12 18:09:35 +0100 | <EvanR> | next step in AI is a thing to identify the previous generation to save the TA time |
2022-12-12 18:09:36 +0100 | <Jade[m]> | yeah ..... |
2022-12-12 18:09:43 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Ping timeout: 260 seconds) |
2022-12-12 18:09:54 +0100 | mjs2600 | (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) (Quit: ZNC 1.8.2 - https://znc.in) |
2022-12-12 18:10:20 +0100 | <EvanR> | repeat the process to cause artificial evolution |
2022-12-12 18:10:32 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 18:10:37 +0100 | <EvanR> | AI arms race |
2022-12-12 18:11:01 +0100 | <Jade[m]> | Which AI can destroy humanity faster??? |
2022-12-12 18:11:11 +0100 | <festive_kurbus> | sir this is a wendys |
2022-12-12 18:11:27 +0100 | mjs2600 | (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) |
2022-12-12 18:12:05 +0100 | <geekosaur> | so you'[re saying add some bacon? |
2022-12-12 18:13:05 +0100 | <darkling> | That usually improves things, IMO. |
2022-12-12 18:13:27 +0100 | <Jade[m]> | AI + bacon |
2022-12-12 18:13:37 +0100 | <darkling> | baicon |
2022-12-12 18:13:48 +0100 | <Jade[m]> | the crossover we didn't want but needed |
2022-12-12 18:15:58 +0100 | <Barfolomew> | Jade[m]: An AI, by definition, is an autonomous intelligence that can think on its own. ChatGPT is based on a glorified universal function, based on tensor multiplication, that is programmed by the author by altering the internal tensor based on a set of examples multiplied with it and checking how close the output is to the wanted result. It is |
2022-12-12 18:15:58 +0100 | <Barfolomew> | not a person. I cannot think or act or come up with things for for itself. It is just a way to develop an algorithm if one is too lazy or stupid to actually define what precisely one wants: Throw stuff at it and hope it becomes what we assume. And frankly, the “neurons” it simulates are as close to real neurons as a perfectly spherical *cow* on |
2022-12-12 18:15:59 +0100 | <Barfolomew> | a sinusoidal trajectory are to a horse race. (You need about a 1000 of those “neurons” to simulate an actual real (e.g. human brain) neuron.) … But of course, there are a lot of conmen thinking they can get lots of $money if they first claim they got an actual AI, and then later conveniently redefine “AI” to mean their “neural net from |
2022-12-12 18:15:59 +0100 | <Barfolomew> | wish.com”. …Basically, like “cyber”, “cloud” and “quantum computer”, the term “AI” has become a red flag that the one peddling it is a conman. :) |
2022-12-12 18:16:42 +0100 | <Jade[m]> | ok yeah I get that |
2022-12-12 18:16:52 +0100 | <Barfolomew> | 🤣 |
2022-12-12 18:17:09 +0100 | <Jade[m]> | so your argument is that the term AI itself has been bastardized to refer to nn's when they are _not_ intelligent |
2022-12-12 18:17:12 +0100 | <Barfolomew> | (Note: I still like neural networks and think they are quite useful. ) |
2022-12-12 18:17:16 +0100 | <Jade[m]> | got it and agree 👍️ |
2022-12-12 18:17:41 +0100 | eggplantade | (~Eggplanta@104-55-37-220.lightspeed.sntcca.sbcglobal.net) |
2022-12-12 18:17:41 +0100 | <Barfolomew> | Jade[m]: Yeah, the term has been destroyed. Just like “Energy” in esoteric circles. |
2022-12-12 18:17:49 +0100 | <Jade[m]> | hahaha |
2022-12-12 18:17:53 +0100 | <Barfolomew> | Or “Hacker”, for that matter. |
2022-12-12 18:18:17 +0100 | <Jade[m]> | I just think about how nn's are just a function being minimized |
2022-12-12 18:18:25 +0100 | <Barfolomew> | I’m all for creating an *actual* AI though. |
2022-12-12 18:18:27 +0100 | <Jade[m]> | that's how I "reason" about it |
2022-12-12 18:18:46 +0100 | <Jade[m]> | Barfolomew: that'd be a self modifying nn? |
2022-12-12 18:19:21 +0100 | <Barfolomew> | Interesting insight. Yeah, minimized is a nice way to see it. But to make an analogy to compression: *lossy* |
2022-12-12 18:19:22 +0100 | <Jade[m]> | not neccesarily nn i guess |
2022-12-12 18:19:23 +0100 | <Jade[m]> | but some sort of self modification? |
2022-12-12 18:19:34 +0100 | <Jade[m]> | haha yeah |
2022-12-12 18:19:45 +0100 | tzh | (~tzh@c-24-21-73-154.hsd1.wa.comcast.net) |
2022-12-12 18:20:14 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 18:20:17 +0100 | gmg | (~user@user/gehmehgeh) |
2022-12-12 18:20:18 +0100 | <geekosaur> | I think a neural network compares to intelligence about the way a sea sponge's neurons compare to a human brain |
2022-12-12 18:20:31 +0100 | <Barfolomew> | Maybe it’s better we don’t have an actual AI. I can imagine what its first actions would be if I had raised it. 😇 |
2022-12-12 18:20:46 +0100 | <Barfolomew> | geekosaur: Hey, don’t insult sea sponges like that! |
2022-12-12 18:21:14 +0100 | <geekosaur> | neh, the relationship is there. it's just a really long way off from actual intelligence |
2022-12-12 18:21:41 +0100 | <geekosaur> | \problem is, you get an actual artificial intelligence, it'll promptly write chatgpt to think for it 🙂 |
2022-12-12 18:21:47 +0100 | <EvanR> | energy in esoteric circles like physics |
2022-12-12 18:22:04 +0100 | troydm | (~troydm@host-176-37-124-197.b025.la.net.ua) |
2022-12-12 18:22:09 +0100 | <Barfolomew> | One fun property I would like to see implemented in ANNs, is the “broadcasting” ability of real neurons. (They react to electric fields. E.g. dendrites have been recorded to move towards electric fields, in order to find other neurons. There was a video of it on the net.) |
2022-12-12 18:22:31 +0100 | <Jade[m]> | Barfolomew: The way we can _already_ see societies biases being part of nn's I don't want a "real" AI |
2022-12-12 18:22:32 +0100 | <Jade[m]> | because if an AI was anything like humanity then it'd be terrible ... |
2022-12-12 18:22:42 +0100 | acidjnk | (~acidjnk@p200300d6e7137a35c0a7281abf493a9c.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
2022-12-12 18:23:16 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 256 seconds) |
2022-12-12 18:23:46 +0100 | <Barfolomew> | EvanR: I’m on the team Sabine Hossenfelder. So YMMV. … I see string theory as a pseudoscience and the big bang as an unscientific creation myth. … *puts on his snob glasses and puffs his polished walnut wood pipe* ;) |
2022-12-12 18:23:55 +0100 | Guest23 | (~Guest23@27.57.46.219) |
2022-12-12 18:24:17 +0100 | <EvanR> | that doesn't sound right at all |
2022-12-12 18:24:27 +0100 | <EvanR> | I'd be surprised sabine said that |
2022-12-12 18:25:35 +0100 | <Barfolomew> | Jade[m]: Well, the whole point of a neural net / brain is adding a bias to input, based on past experiences (modulated by biases of even earlier inputs). We are physically unable to be unbiased. |
2022-12-12 18:26:09 +0100 | <ggVGc> | what are you basing that on Barfolomew? |
2022-12-12 18:26:11 +0100 | <Barfolomew> | EvanR: She did. Both the creation myth thing and the string theory thing. Many times. |
2022-12-12 18:26:31 +0100 | <Barfolomew> | ggVGc What do you mean? The bias thign? |
2022-12-12 18:26:37 +0100 | <ggVGc> | I mean, I don't have much to go on but I'm doing my second year of physics atm, and string theory seems as good as any to me |
2022-12-12 18:26:48 +0100 | <ggVGc> | that string theory is pseudoscience |
2022-12-12 18:26:53 +0100 | <ggVGc> | what is pseudo about it? |
2022-12-12 18:27:18 +0100 | <Hecate> | ggVGc is an excellent vim command |
2022-12-12 18:27:25 +0100 | <EvanR> | Barfolomew, if so, I'm chalking that one up to outrage marketing for youtube hits |
2022-12-12 18:27:25 +0100 | <ggVGc> | at this level of physics it's all quite weird shit, and nothing is really verifiable yet |
2022-12-12 18:27:43 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Quit: Client closed) |
2022-12-12 18:28:00 +0100 | <ggVGc> | Hecate: well, as most people point out it's not the most optimal way to acheive the effect, but that's not the point :) |
2022-12-12 18:28:40 +0100 | <ggVGc> | aw man, Heroku has finally killed my site hosting the conversation from a decade ago about this nickk |
2022-12-12 18:28:42 +0100 | <Barfolomew> | ggVGc: Well, pseudoscience in the same sense as luminiferous aether. So not nonsense per se, but merely impossible to actually test or not matching any actual tests done. |
2022-12-12 18:29:16 +0100 | <ggVGc> | that's a strange definition of pseudo-science to me |
2022-12-12 18:29:19 +0100 | <EvanR> | string theory impossible to test is 2010s troll position |
2022-12-12 18:29:30 +0100 | <ggVGc> | it's very much based on mathematical models, and well accepted physics |
2022-12-12 18:29:35 +0100 | <Barfolomew> | ggVGc: wayback machine @ archive.org? |
2022-12-12 18:29:38 +0100 | <ggVGc> | rather than random made up stuff |
2022-12-12 18:30:09 +0100 | <_________> | loop haskell gravity ftw |
2022-12-12 18:30:13 +0100 | <ggVGc> | what I'm saying is, just because something is hard/currently impossible to experimentally test, doesn't make it not-science |
2022-12-12 18:30:16 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
2022-12-12 18:30:40 +0100 | <Barfolomew> | ggVGc: It’s the accepted scientific one, albeit, yes, not the one normal people use in normal daily conversation, where they mean things like the perpetuum mobile or electric universe.:) |
2022-12-12 18:31:02 +0100 | <ggVGc> | anyway, I'm still at quantum harmonic oscillators, so a while to go before I can really comment on string theory I guess |
2022-12-12 18:32:24 +0100 | <Barfolomew> | ggVGc: Well, mathematical models are not reality. A mathematical proof is still pseudoscience until the axioms it is based on are verified by statistically reliable observations of reality. And for string theory, the latter is one of the things that it never achieved in all those years. |
2022-12-12 18:33:03 +0100 | <EvanR> | OKAAAAAY |
2022-12-12 18:33:21 +0100 | <ggVGc> | yeahn but neither did any other idea that tackles the same level of modelling as string theory. But either way, I am not arguing about what is correct or not. I'm just saying it's not pseudoscience |
2022-12-12 18:33:35 +0100 | <EvanR> | talk about armchair quarterbacking |
2022-12-12 18:33:46 +0100 | <ggVGc> | science is still science even when the outcome is incorrect. It's the process that is science or not |
2022-12-12 18:33:51 +0100 | <ggVGc> | and string theory is very much science |
2022-12-12 18:34:31 +0100 | <dolio> | What does this have to do with Haskell? |
2022-12-12 18:34:34 +0100 | <ggVGc> | also, semi-related, I think Sabine might be the funniest person on Youtube for me in many years |
2022-12-12 18:34:34 +0100 | coot | (~coot@213.134.171.3) (Quit: coot) |
2022-12-12 18:34:53 +0100 | <ggVGc> | dolio: no idea, I just joined the conversation, coincidentally to avoid working on my physics lab report |
2022-12-12 18:35:00 +0100 | <EvanR> | why is there no inexplicable popular youtuber talking about haskell |
2022-12-12 18:35:07 +0100 | coot | (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) |
2022-12-12 18:35:07 +0100 | <EvanR> | bly* |
2022-12-12 18:35:12 +0100 | <ggVGc> | have been trying to involve haskell in my studies, but not really found a decent way yet |
2022-12-12 18:35:25 +0100 | <EvanR> | use the quantum mechanics monad |
2022-12-12 18:35:27 +0100 | <geekosaur> | distrotube covers xmonad somewhat regularly |
2022-12-12 18:35:30 +0100 | <ggVGc> | EvanR: there is, they just call it Rust for some reason |
2022-12-12 18:35:32 +0100 | mikoto-chan | (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 246 seconds) |
2022-12-12 18:35:45 +0100 | <Barfolomew> | EvanR: Yeah, it’s unfortunately quite easy to use for trolling (old, Jargon File definition), because it triggers certain people. But then, like with school bullies preying on easily triggered people, I learned early to not let them tease me. :) And string theory is really on the way out due to its problems, so … |
2022-12-12 18:38:17 +0100 | trev | (~trev@user/trev) (Remote host closed the connection) |
2022-12-12 18:38:38 +0100 | <Barfolomew> | ggVGc: Yes, testability is literally the difference between science and religion. Of course you can create any idea you like, however testable or untestable. But with the latter, one has to accept that it is not more science than any other religion or whatever, until it has actually been tested and verified. … Note that there is nothing wrong |
2022-12-12 18:38:39 +0100 | <Barfolomew> | with thinking up hypotheses. But one has to accept that they are just that, and not better than any other compting things anyone merely thought up. |
2022-12-12 18:40:03 +0100 | <ggVGc> | yeah, I definitely don't agree with that |
2022-12-12 18:40:32 +0100 | <Barfolomew> | EvanR: Hey, relax. You seem to imply things … :) … I see how this discussion derails though, because I can’t just tell everyone to watch half a dozen Hossenfelder videos where it’s actually explained in a convincing way. So I’ll stop now, as it is of no use. … Happy? :D |
2022-12-12 18:40:33 +0100 | razetime | (~quassel@49.207.203.213) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
2022-12-12 18:41:44 +0100 | <Barfolomew> | EvanR: I vote for you creating a Haskell YT channel. I’d definitely watch it. … A video about instances of functional dependencies with types with multiple parameters would be my suggestion for a first video. ;) |
2022-12-12 18:42:05 +0100 | <Barfolomew> | ggVGc: Tardis monad? |
2022-12-12 18:42:30 +0100 | <Barfolomew> | ggVGc: We should rename Haskell to Shiny.:D |
2022-12-12 18:42:32 +0100 | MajorBiscuit | (~MajorBisc@145.94.137.174) (Ping timeout: 256 seconds) |
2022-12-12 18:43:42 +0100 | califax | (~califax@user/califx) (Remote host closed the connection) |
2022-12-12 18:45:00 +0100 | <Barfolomew> | Different topic: It’s weird, how Float is defined in GHC.Float and Prelude, but not anywhere else. I had expected Prelude to just re-export something like Data.Float, and Data.Float using GHC.Float internally.… It seems to make alternate Preludes hard. Is this just for historic reasons? |
2022-12-12 18:45:55 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 18:46:52 +0100 | <geekosaur> | doesn't seem to have stopped a number of alternative Preludes from appearing |
2022-12-12 18:47:07 +0100 | <geekosaur> | (Relude seems to be the most popular but there are several others) |
2022-12-12 18:47:28 +0100 | <ggVGc> | I have thought a lot about if languages should have implicit preludes, builtin globals etc. at all. I think they shouldn't, actually |
2022-12-12 18:47:58 +0100 | <ggVGc> | rather there should be different standard preludes for different use-cases, like education for example |
2022-12-12 18:48:50 +0100 | <EvanR> | I rewrote some haskell last week that should have benefitted from globals |
2022-12-12 18:48:54 +0100 | <EvanR> | it didn't benefit |
2022-12-12 18:49:04 +0100 | <EvanR> | *rewrote it to use actual globals xD |
2022-12-12 18:49:06 +0100 | <monochrom> | Either historical reason or committee decision. |
2022-12-12 18:49:16 +0100 | <geekosaur> | only if there;s some reasonable way to combine such libs, otherwise you just end up with de facto three incompatible languages |
2022-12-12 18:49:58 +0100 | <monochrom> | But I would not add an extra Data.Float, even when I would agree about adding an extra Data.List. |
2022-12-12 18:50:03 +0100 | <geekosaur> | or s/three/numPreludes/ |
2022-12-12 18:50:52 +0100 | <monochrom> | There are a few less common list functions that I would not feel like including in Prelude, so Data.List actually has an excuse for existence. |
2022-12-12 18:51:02 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Quit: Client closed) |
2022-12-12 18:51:17 +0100 | gwern | (~gwern@user/gwern) (Read error: Connection reset by peer) |
2022-12-12 18:51:26 +0100 | <monochrom> | But everything to be said about Double and Float are already in the type classes, and the type classes are already in Prelude. Data.Float adds nothing. |
2022-12-12 18:53:45 +0100 | <monochrom> | More generally, I suggest not shoehorning any actual library organization into any perfectionist ideology. |
2022-12-12 18:54:06 +0100 | <ggVGc> | Barfolomew: just curious, om what are you basing the idea that testability is the difference between science and not-science? |
2022-12-12 18:54:26 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 246 seconds) |
2022-12-12 18:54:40 +0100 | <ggVGc> | monochrom: could do what lua does and just not have any libraries or ecosystem |
2022-12-12 18:54:43 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) |
2022-12-12 18:54:44 +0100 | <geekosaur> | can we take that discussion to offtopic, please? |
2022-12-12 18:54:46 +0100 | <ggVGc> | and get rid of the issue |
2022-12-12 18:54:52 +0100 | <ggVGc> | yeah, sorry |
2022-12-12 18:54:54 +0100 | califax | (~califax@user/califx) |
2022-12-12 18:55:42 +0100 | <Barfolomew> | ggVGc: Preludes can easily be a tree of dependencies (on simpler base preludes), or even a directed graph (as in: including multiple base prelude modules.) |
2022-12-12 18:56:06 +0100 | <monochrom> | You mean s/any/any single standard/ |
2022-12-12 18:56:18 +0100 | <EvanR> | I'm trying to marshal my A star algorithm from last year into a reusable form. And it is currently using Data.Maps of (Int,Int) as points. I could make it more general by using Ord p => p as the points. But is there a more efficient API that can use IntMaps and IntSets |
2022-12-12 18:56:29 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-12-12 18:56:41 +0100 | <monochrom> | Because without a standard, then you just end up with splintered multiplicity of libraries and ecosystems and communities. |
2022-12-12 18:57:14 +0100 | <monochrom> | Ecosystems will exist whether you like it or not. Your only choice is which positive integer of them. |
2022-12-12 18:57:49 +0100 | <Barfolomew> | I would like the ability to just use normal lists […] and tuples (…) and strings "…" and numbers, and just set which actual optimized type implements them behind the scenes. Without all that fromList / toList silliness. … Such stuff already partially exists, but it’s very incomplete. |
2022-12-12 18:58:04 +0100 | ggVGc | (~ggVGc@a.lowtech.earth) (Quit: WeeChat 3.5) |
2022-12-12 18:58:35 +0100 | <Barfolomew> | monochrom: my point was more that Prelude should not implement anything at all, but be a pure re-exporter. A collection of things. |
2022-12-12 18:58:40 +0100 | <monochrom> | Right? The Haskell Report doesn't specify a build tool. So, instead of "not having any build tool", the outcome is we have two. >:) Actually we almost had three. |
2022-12-12 18:59:30 +0100 | <monochrom> | Oh well then I'm sure Prelude's floating point stuff is just re-export of GHC.Float. |
2022-12-12 18:59:47 +0100 | gwern | (~gwern@user/gwern) |
2022-12-12 19:00:23 +0100 | <EvanR> | for stuff where list, tuples, strings all make sense, you can use lenses |
2022-12-12 19:00:54 +0100 | enoq | (~enoq@2a05:1141:1f5:5600:b9c9:721a:599:bfe7) |
2022-12-12 19:00:55 +0100 | <EvanR> | for when it doesn't make sense, please don't |
2022-12-12 19:01:16 +0100 | <EvanR> | cough clojure |
2022-12-12 19:01:42 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 19:01:55 +0100 | <sm> | o |
2022-12-12 19:02:17 +0100 | <geekosaur> | there's EnumMap but I think it's not quite what you're after |
2022-12-12 19:03:11 +0100 | <Barfolomew> | monochrom: Regarding “splintered ecosystems”: Interesting, how I see the complete opposite problem of that: I see no reason to force everything to goosestep in the same mold, and prefer freedom. But I think we can make this a win-win for both of our interests, like cascading stylesheets expand on base styles with other styles, and the result is |
2022-12-12 19:03:11 +0100 | <Barfolomew> | that every element can have a different style *and* there is a reliable basis. so it’s not like a log of wood that I want splittable and you want in one whole thing, but more like a tree that is both at the same time. |
2022-12-12 19:03:31 +0100 | <EvanR> | you mean, make the api be like, Enum p => ... p ... hah |
2022-12-12 19:03:50 +0100 | <EvanR> | for its Int isomorphism ability |
2022-12-12 19:03:52 +0100 | <Barfolomew> | EvanR: *shudders at lenses* : |
2022-12-12 19:04:20 +0100 | Barfolomew | (~Barfolome@2a0a-a546-5b20-1-7fee-17bd-2c6b-c767.ipv6dyn.netcologne.de) (Quit: Client closed) |
2022-12-12 19:04:35 +0100 | <geekosaur> | https://hackage.haskell.org/packages/search?terms=enummap |
2022-12-12 19:04:36 +0100 | coot | (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Quit: coot) |
2022-12-12 19:05:11 +0100 | <EvanR> | that's actually neat |
2022-12-12 19:05:52 +0100 | Tuplanolla | (~Tuplanoll@91-159-68-152.elisa-laajakaista.fi) |
2022-12-12 19:06:26 +0100 | <EvanR> | what in the world is this syntax |
2022-12-12 19:06:29 +0100 | <EvanR> | import qualified Data.EnumMap k as EnumMap |
2022-12-12 19:06:42 +0100 | pavonia | (~user@user/siracusa) (Quit: Bye!) |
2022-12-12 19:07:17 +0100 | <EvanR> | module parameter? |
2022-12-12 19:08:45 +0100 | <geekosaur> | no such thing |
2022-12-12 19:08:48 +0100 | gmg | (~user@user/gehmehgeh) (Quit: Leaving) |
2022-12-12 19:08:59 +0100 | jargon | (~jargon@174-22-192-24.phnx.qwest.net) (Ping timeout: 256 seconds) |
2022-12-12 19:09:06 +0100 | <geekosaur> | shows in the source as well so it's not just something being misrendered |
2022-12-12 19:10:19 +0100 | <geekosaur> | I thought there was one that simply wrapped IntMap rather than reimplementing, but I don't see it unless it's the TH one |
2022-12-12 19:15:11 +0100 | burnsidesLlama | (~burnsides@138.199.22.99) |
2022-12-12 19:15:41 +0100 | <EvanR> | ok, I think I will just take p -> Int as part of the API |
2022-12-12 19:16:48 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
2022-12-12 19:21:49 +0100 | beteigeuze | (~Thunderbi@bl14-81-220.dsl.telepac.pt) (Remote host closed the connection) |
2022-12-12 19:22:14 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 19:24:57 +0100 | acidjnk | (~acidjnk@p200300d6e7137a279cde44451dfff9db.dip0.t-ipconnect.de) |
2022-12-12 19:25:49 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) |
2022-12-12 19:26:02 +0100 | <EvanR> | to extract an actual path in A*, wikipedia guidance says to start at the end and work your way backwards through remembered predecessors. Great, we love building lists backwards in haskell and not having to reverse them! |
2022-12-12 19:26:16 +0100 | paulpaul1076 | (~textual@95-29-5-111.broadband.corbina.ru) |
2022-12-12 19:26:36 +0100 | <EvanR> | except that precludes streaming the answer lol |
2022-12-12 19:27:10 +0100 | <EvanR> | forwards and backwards in haskell is a fickle mistress |
2022-12-12 19:27:13 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 252 seconds) |
2022-12-12 19:27:49 +0100 | <geekosaur> | that's a Seq |
2022-12-12 19:28:14 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Quit: Client closed) |
2022-12-12 19:28:29 +0100 | nschoe | (~q@141.101.51.197) (Quit: Switching off) |
2022-12-12 19:28:31 +0100 | <EvanR> | what is |
2022-12-12 19:30:08 +0100 | doyougnu | (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) (Ping timeout: 256 seconds) |
2022-12-12 19:32:30 +0100 | <geekosaur> | forwards and backwards |
2022-12-12 19:33:10 +0100 | <EvanR> | is Seq at all "streamable" |
2022-12-12 19:33:33 +0100 | <EvanR> | consume it incrementally as it is constructed |
2022-12-12 19:33:37 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 19:33:43 +0100 | <whatsupdoc> | Haskell would completely fizzle out into obscurity if it wasn’t for the fact that it has some qualities that are very appealing to programmers. It has a very strong fan base, and some are almost religious about it. |
2022-12-12 19:34:24 +0100 | Guest23 | (~Guest23@27.57.46.219) (Ping timeout: 268 seconds) |
2022-12-12 19:37:13 +0100 | <shapr> | whatsupdoc: Are there other languages where that statement doesn't hold? |
2022-12-12 19:37:29 +0100 | fizbin | (~fizbin@user/fizbin) (Ping timeout: 252 seconds) |
2022-12-12 19:38:27 +0100 | <EvanR> | yeah that hot take is unnecessarily specialized |
2022-12-12 19:38:31 +0100 | eggplantade | (~Eggplanta@104-55-37-220.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
2022-12-12 19:39:45 +0100 | <shapr> | whatsupdoc: I can't think of a language where that's not a true statement, can you think of any? |
2022-12-12 19:40:11 +0100 | <shapr> | Oh wait, some languages don't have a strong fan base, maybe SNOBOL? |
2022-12-12 19:40:21 +0100 | <shapr> | Oh wait, I do know fanatic SNOBOL people, hm. |
2022-12-12 19:40:40 +0100 | <mauke> | ALGOL |
2022-12-12 19:40:50 +0100 | <dsal> | Java's a neat case where it was a gross and slow language but people Made It Happen. JavaScript is kind of the same. |
2022-12-12 19:41:26 +0100 | <whatsupdoc> | Haskell is not taught in schools and is almost never used in industry. Thus, there is very little incentive for programmers to learn the language except out of pure intellectual interest. |
2022-12-12 19:41:31 +0100 | <shapr> | At the time, Java was "C without memory allocation", like putting a handle on the blade-only piece of sharp metal. |
2022-12-12 19:41:43 +0100 | <dsal> | I don't think it's appealing to programmers and I can't imagine it's got a strong fan base, but it got a lot of money behind it. |
2022-12-12 19:41:45 +0100 | <shapr> | whatsupdoc: Are you sure about that statement? |
2022-12-12 19:42:05 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Quit: Client closed) |
2022-12-12 19:42:12 +0100 | <[exa]> | whatsupdoc: is htat message from a happy future? |
2022-12-12 19:42:15 +0100 | <dsal> | Haskell is great in industry. Recommended. |
2022-12-12 19:42:28 +0100 | <shapr> | Is this a "I need to write a paper about Haskell and I'm going to ask questions by being wrong on the internet" ? |
2022-12-12 19:42:55 +0100 | <dsal> | heh |
2022-12-12 19:43:30 +0100 | <shapr> | whatsupdoc: Do you have any support or citations for that statement? |
2022-12-12 19:43:44 +0100 | <EvanR> | industrial haskell, downtempo haskell, psychobilly haskell |
2022-12-12 19:43:52 +0100 | <EvanR> | it's all good |
2022-12-12 19:43:52 +0100 | <shapr> | ooh, I want some psychobilly haskell |
2022-12-12 19:44:00 +0100 | <shapr> | Euterpia? |
2022-12-12 19:44:35 +0100 | <shapr> | whatsupdoc: oh wait, even better! What information did you use to establish the veracity of that statement, and what information would change your mind? |
2022-12-12 19:44:53 +0100 | <shapr> | cause like, I don't wanna spend time discussing if it's not gonna go anywhere |
2022-12-12 19:44:58 +0100 | <whatsupdoc> | shapr: chill bro i'm just quoting quora https://www.quora.com/Why-dont-more-programmers-use-Haskell |
2022-12-12 19:45:01 +0100 | fizbin | (~fizbin@user/fizbin) |
2022-12-12 19:45:12 +0100 | <shapr> | Oh, I didn't know you were a ChatGPT instance, sorry. |
2022-12-12 19:45:46 +0100 | <whatsupdoc> | They're getting good :) |
2022-12-12 19:46:11 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 19:47:44 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) |
2022-12-12 19:47:58 +0100 | burnsidesLlama | (~burnsides@138.199.22.99) (Ping timeout: 268 seconds) |
2022-12-12 19:49:59 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 19:50:43 +0100 | __monty__ | (~toonn@user/toonn) |
2022-12-12 19:53:13 +0100 | wootehfoot | (~wootehfoo@user/wootehfoot) |
2022-12-12 19:54:29 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 260 seconds) |
2022-12-12 19:58:25 +0100 | <chreekat> | “ ” “ ” ‘ ’ ノ( º _ ºノ) here I had some extra |
2022-12-12 19:59:58 +0100 | TimWolla | (~timwolla@2a01:4f8:150:6153:beef::6667) (Quit: Bye) |
2022-12-12 20:01:01 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) (Remote host closed the connection) |
2022-12-12 20:07:27 +0100 | TimWolla | (~timwolla@2a01:4f8:150:6153:beef::6667) |
2022-12-12 20:07:38 +0100 | <DigitalKiwi> | shapr: iirc some SNOBOL fans made lua lol |
2022-12-12 20:08:14 +0100 | <DigitalKiwi> | Influenced by |
2022-12-12 20:08:15 +0100 | <DigitalKiwi> | C++, CLU, Modula, Scheme, SNOBOL |
2022-12-12 20:08:27 +0100 | <DigitalKiwi> | or maybe roberto hated it and that's why they made lua |
2022-12-12 20:10:38 +0100 | TimWolla | (~timwolla@2a01:4f8:150:6153:beef::6667) (Remote host closed the connection) |
2022-12-12 20:10:45 +0100 | <DigitalKiwi> | for some reason i read quora and thought bash.org |
2022-12-12 20:10:49 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 20:11:45 +0100 | sadmax | (~user@209.205.174.253) |
2022-12-12 20:11:50 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) |
2022-12-12 20:14:46 +0100 | enoq | (~enoq@2a05:1141:1f5:5600:b9c9:721a:599:bfe7) (Quit: enoq) |
2022-12-12 20:15:05 +0100 | jargon | (~jargon@174-22-192-24.phnx.qwest.net) |
2022-12-12 20:16:08 +0100 | doyougnu | (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) |
2022-12-12 20:16:32 +0100 | TimWolla | (~timwolla@2a01:4f8:150:6153:beef::6667) |
2022-12-12 20:17:36 +0100 | doyougnu | (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) (Remote host closed the connection) |
2022-12-12 20:18:10 +0100 | doyougnu | (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) |
2022-12-12 20:18:43 +0100 | <geekosaur> | interesting that you can get two such different languages from SNOBOL |
2022-12-12 20:18:50 +0100 | <geekosaur> | (the other was Icon) |
2022-12-12 20:19:12 +0100 | <monochrom> | CLU has very good ideas about data abstraction. |
2022-12-12 20:19:55 +0100 | <monochrom> | Oh but we got a million languages from Algol. Some say from C. >:) |
2022-12-12 20:20:20 +0100 | <monochrom> | And some others, on the opposite side, say from lambda calculus >:) |
2022-12-12 20:20:53 +0100 | <monochrom> | Oh nevermind, your point is about the descendents being very different. |
2022-12-12 20:21:25 +0100 | <monochrom> | Then again I guess the descendents of Algol have huge differences too... |
2022-12-12 20:21:52 +0100 | <geekosaur> | didn't SML claim to have gotten some things from Algol? |
2022-12-12 20:22:18 +0100 | <monochrom> | That I don't know. |
2022-12-12 20:23:27 +0100 | <monochrom> | But it may be true that Algol defined/clarified lexical scoping. That would be a mother of everything henceforth. |
2022-12-12 20:23:42 +0100 | <DigitalKiwi> | std(lib)s |
2022-12-12 20:23:57 +0100 | <dolio> | Didn't lambda calculus clarify lexical scoping? :þ |
2022-12-12 20:24:01 +0100 | <monochrom> | And certainly true that Algol proved that recursion works. |
2022-12-12 20:24:08 +0100 | <monochrom> | haha |
2022-12-12 20:24:30 +0100 | <monochrom> | Well, Lisp then ruined it, so we needed an Algol to restore it... |
2022-12-12 20:24:38 +0100 | <dolio> | Yeah, that's true. |
2022-12-12 20:24:49 +0100 | fizbin | (~fizbin@user/fizbin) (Ping timeout: 260 seconds) |
2022-12-12 20:26:29 +0100 | wroathe | (~wroathe@207-153-38-140.fttp.usinternet.com) |
2022-12-12 20:26:29 +0100 | wroathe | (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host) |
2022-12-12 20:26:29 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-12-12 20:28:19 +0100 | ft | (~ft@p4fc2a257.dip0.t-ipconnect.de) |
2022-12-12 20:30:34 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) (Remote host closed the connection) |
2022-12-12 20:33:09 +0100 | Lycurgus | (~juan@user/Lycurgus) |
2022-12-12 20:33:33 +0100 | <monochrom> | Ugh did you or did you not see it coming (I didn't) that celebrity names in function programming (e.g., Lennart Augustsson, Koen Claessen, SPJ) would co-author a paper with Tim Sweeney?! |
2022-12-12 20:33:46 +0100 | <monochrom> | Here: http://lambda-the-ultimate.org/node/5662 |
2022-12-12 20:35:14 +0100 | fizbin | (~fizbin@user/fizbin) |
2022-12-12 20:35:26 +0100 | <monochrom> | Hey this is interesing. |
2022-12-12 20:36:09 +0100 | <dolio> | Sweeny's been talking about FP for game stuff off and on for like a decade, but never doing anything about it. |
2022-12-12 20:36:37 +0100 | <geekosaur> | I was surprised to see so many FP folks working for Epic; SPJ I knew about but not that he would be joining a bunch of others |
2022-12-12 20:39:00 +0100 | <shapr> | geekosaur: I got a shared object working in a compiled Haskell program on Android! |
2022-12-12 20:39:07 +0100 | <shapr> | still can't get it working in ghci on Android :-( |
2022-12-12 20:39:08 +0100 | <geekosaur> | yay! |
2022-12-12 20:39:12 +0100 | <shapr> | but hey, progress! |
2022-12-12 20:39:38 +0100 | <[exa]> | whaaaaaat |
2022-12-12 20:39:39 +0100 | <geekosaur> | still think you have to somehow convince ghci to use the system linker / dlopen instead of its own linker |
2022-12-12 20:39:47 +0100 | <[exa]> | shapr: does that have a webpage or something? |
2022-12-12 20:39:59 +0100 | <shapr> | uh, a gist? |
2022-12-12 20:40:02 +0100 | <shapr> | https://gist.github.com/shapr/11e41ca59fb60f8dc98b3ff145932ef0 |
2022-12-12 20:40:04 +0100 | <[exa]> | ah okay :D |
2022-12-12 20:40:08 +0100 | <[exa]> | but yeah that's cool |
2022-12-12 20:40:16 +0100 | <geekosaur> | termux just plays too many games with the whole dynamic link mechanism |
2022-12-12 20:40:17 +0100 | <shapr> | It requires that you have the matching libchallenge_bypass_ristretto.so that's cross compiled via nix |
2022-12-12 20:41:01 +0100 | thyriaen | (~thyriaen@2a01:aea0:dd4:4bae:6245:cbff:fe9f:48b1) (Remote host closed the connection) |
2022-12-12 20:41:10 +0100 | wootehfoot | (~wootehfoo@user/wootehfoot) (Read error: Connection reset by peer) |
2022-12-12 20:41:54 +0100 | <shapr> | [exa]: We're working our way towards using shared objects from inside an Obelisk app : https://github.com/obsidiansystems/obelisk |
2022-12-12 20:45:00 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 260 seconds) |
2022-12-12 20:45:14 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 260 seconds) |
2022-12-12 20:47:19 +0100 | gurkenglas | (~gurkengla@p548ac72e.dip0.t-ipconnect.de) |
2022-12-12 20:49:35 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) |
2022-12-12 20:50:43 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Ping timeout: 260 seconds) |
2022-12-12 21:00:10 +0100 | <EvanR> | what's the relation between Data.Map and priority queue, does it function as one? is it literally one? is it a bad priority queue? |
2022-12-12 21:00:26 +0100 | <EvanR> | I see minView or maxView has log N complexity |
2022-12-12 21:00:38 +0100 | ec | (~ec@gateway/tor-sasl/ec) |
2022-12-12 21:01:45 +0100 | <c_wraith> | it works as a priority queue, sure. It does have the downside that priorities are required to be unique |
2022-12-12 21:02:04 +0100 | <monochrom> | Yeah, that. |
2022-12-12 21:02:21 +0100 | <monochrom> | I am lazy so I just use a priority queue library from hackaage. |
2022-12-12 21:03:14 +0100 | <EvanR> | oh right |
2022-12-12 21:03:20 +0100 | ec_ | (~ec@gateway/tor-sasl/ec) (Ping timeout: 255 seconds) |
2022-12-12 21:03:21 +0100 | <EvanR> | I just ran into that 5 minutes ago |
2022-12-12 21:04:15 +0100 | <monochrom> | In reality I needed a priority-search queue so I use psqueues |
2022-12-12 21:04:51 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 21:04:54 +0100 | <monochrom> | Although, my use case was compiled many years ago and I have never needed to compile it again. So I don't know whether psqueues is usable today. |
2022-12-12 21:05:19 +0100 | <c_wraith> | I used psqueues for an AoC problem last year |
2022-12-12 21:05:27 +0100 | <monochrom> | Ah OK that's nice. |
2022-12-12 21:06:39 +0100 | bgs | (~bgs@212-85-160-171.dynamic.telemach.net) (Remote host closed the connection) |
2022-12-12 21:06:43 +0100 | Lycurgus | (~juan@user/Lycurgus) (Quit: Exeunt: personae.ai-integration.biz) |
2022-12-12 21:07:02 +0100 | avicenzi | (~avicenzi@2a00:ca8:a1f:b004::c32) (Ping timeout: 256 seconds) |
2022-12-12 21:07:11 +0100 | <EvanR> | I replaced Data.Set for my A* with a list and it runs way faster |
2022-12-12 21:07:29 +0100 | <DigitalKiwi> | i use nix-on-droid to run ghci on android lol |
2022-12-12 21:08:18 +0100 | <geekosaur> | I use it somewhat regularly |
2022-12-12 21:08:25 +0100 | <geekosaur> | (psqueues) |
2022-12-12 21:09:13 +0100 | <geekosaur> | well, have two programs written several years ago but they get recompiled every time I upgrade ghc so 🙂 |
2022-12-12 21:10:33 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Ping timeout: 260 seconds) |
2022-12-12 21:11:13 +0100 | JordiGH | (~jordi@user/jordigh) |
2022-12-12 21:11:23 +0100 | ballast | (~ballast@cpe-104-32-238-223.socal.res.rr.com) |
2022-12-12 21:11:30 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 21:11:39 +0100 | <JordiGH> | What's that thing where you have a function with a generic type but it's so generic that you can actually deduce the only possible implementation of that function? |
2022-12-12 21:12:20 +0100 | <monochrom> | Free theorems. Parametricity. |
2022-12-12 21:12:35 +0100 | <JordiGH> | Something like if t -> t is the type and it has to hold for all types, then the only thing the function can be is the identity function or something like that (but a more interesting example, if possible) |
2022-12-12 21:13:07 +0100 | <ballast> | how about (a,b) -> a |
2022-12-12 21:13:17 +0100 | <monochrom> | If f::t->[t], and f () = [(), (), ()], then we know f 4 = [4,4,4]. |
2022-12-12 21:14:03 +0100 | <JordiGH> | ballast: Ah, that must be a projection? |
2022-12-12 21:14:29 +0100 | waleee | (~waleee@h-176-10-137-138.NA.cust.bahnhof.se) |
2022-12-12 21:14:32 +0100 | <ballast> | JordiGH I think so, I don't have a proof that it must be though. |
2022-12-12 21:14:54 +0100 | <monochrom> | If g :: t -> (t -> t) -> t, then we know that for some natural n, g z s = s (s (s ... s z)...) (n copies of s there). |
2022-12-12 21:14:55 +0100 | coot | (~coot@213.134.171.3) |
2022-12-12 21:15:22 +0100 | <monochrom> | n does not depend on z or s. |
2022-12-12 21:15:50 +0100 | <JordiGH> | So does this general kind of deduction have a name I can google for and get a bunch of SEO crap from Geeksforgeeks? |
2022-12-12 21:15:58 +0100 | <monochrom> | I wrote two names. |
2022-12-12 21:16:06 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
2022-12-12 21:16:26 +0100 | <JordiGH> | Oh, sorry, missed that. |
2022-12-12 21:17:07 +0100 | <monochrom> | http://www.vex.net/~trebla/haskell/abs-type-param.html |
2022-12-12 21:17:44 +0100 | <EvanR> | (a,b) -> a, you are required to return an a. There is only one way to get one |
2022-12-12 21:17:52 +0100 | <EvanR> | given what you are given |
2022-12-12 21:18:09 +0100 | <monochrom> | (a,b) -> a is one of the worked examples in my article. |
2022-12-12 21:20:14 +0100 | <iqubic> | Teah, there's only really one way to write (a, b) -> a. |
2022-12-12 21:20:33 +0100 | <iqubic> | *yeah |
2022-12-12 21:20:57 +0100 | <monochrom> | Or rather, more intuitively but still being pretty careful, you have no choice because you aren't allowed runtime type information. |
2022-12-12 21:21:39 +0100 | <monochrom> | In Java Generics, you can totally code up "if (x instanceOf Integer) { ... } else { ...}". |
2022-12-12 21:22:35 +0100 | <iqubic> | Right. |
2022-12-12 21:23:07 +0100 | <monochrom> | Although, the perspective of stating it positively and connecting to abstract type programming is also interesting. |
2022-12-12 21:23:25 +0100 | <monochrom> | (Hint: Dependency injection totally rely on this too.) |
2022-12-12 21:24:36 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 21:24:39 +0100 | <JordiGH> | This kinda reminds me of how something like harmonic functions work. You specify that it has to work this way for a dense set (e.g. satisfy the Cauchy-Riemann equations, or have a complex derivative or whatever) and that condition is so strong that it tells you everything, everywhere about that function. |
2022-12-12 21:24:59 +0100 | <JordiGH> | In this case, the condition "works for all types" is just too strrong. |
2022-12-12 21:25:24 +0100 | burnsidesLlama | (~burnsides@138.199.22.99) |
2022-12-12 21:25:47 +0100 | <monochrom> | Oh, complex analysis and its "it must be an analytic function" is very constraining too. |
2022-12-12 21:26:19 +0100 | <monochrom> | So much so that "analytic and bounded" implies "constant". |
2022-12-12 21:27:19 +0100 | <monochrom> | Lately I learned from 3Blue1Brown (I think? Or could be another math youtuber) that CR is trying to say angle-preserving. |
2022-12-12 21:27:41 +0100 | wrengr | (~wrengr@201.59.83.34.bc.googleusercontent.com) |
2022-12-12 21:29:12 +0100 | <JordiGH> | Yeah, conformal. |
2022-12-12 21:29:49 +0100 | <JordiGH> | Probably 3B1B, I'm sure he's made complex analysis videos. |
2022-12-12 21:31:05 +0100 | burnsidesLlama | (~burnsides@138.199.22.99) (Ping timeout: 260 seconds) |
2022-12-12 21:32:55 +0100 | <ballast> | I want to write a library function over a State monad that has return type State MyState (). This function only depends on the MyState but the idea is that you can use it so long as you have embedded MyState in your overall application state. I'm running into an issue though where I want to accept a handler that is of type State a (). This doesn't |
2022-12-12 21:32:55 +0100 | <ballast> | unify with my return type and my way of making it work is taking another input which is an accessor (a -> MyState). Is there a cleaner way of going about doing this? |
2022-12-12 21:33:17 +0100 | <dolio> | The closest math analogue is "natural." The historical, intuitive descriptions are almost identical. But the exact characterizations differ. |
2022-12-12 21:33:41 +0100 | <dolio> | And naturality is weaker than parametricity. |
2022-12-12 21:34:07 +0100 | irrgit | (~irrgit@146.70.27.218) (Read error: Connection reset by peer) |
2022-12-12 21:36:24 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Quit: Client closed) |
2022-12-12 21:37:11 +0100 | king_gs | (~Thunderbi@187.201.150.200) |
2022-12-12 21:37:55 +0100 | <EvanR> | ballast, class Monad m => HasMyState m where xD -- don't do this |
2022-12-12 21:37:59 +0100 | ec | (~ec@gateway/tor-sasl/ec) (Ping timeout: 255 seconds) |
2022-12-12 21:38:46 +0100 | <ballast> | in general does the state monad assume that the state is the same? I've tried hoogling for StateT s m a -> (s -> t) -> StateT t m a. Perhaps I'm just thinking about this problem wrong? |
2022-12-12 21:39:39 +0100 | <EvanR> | you'd need some kind of (s -> t) and (t -> s) wouldn't you |
2022-12-12 21:39:50 +0100 | <EvanR> | or a lens to put the updated MyState back |
2022-12-12 21:40:02 +0100 | <ballast> | yeah I was using a lens (simplified it for the problem statement) |
2022-12-12 21:40:57 +0100 | <ballast> | ah i see, that's why I wasn't getting any hits on hoogle |
2022-12-12 21:41:36 +0100 | king_gs | (~Thunderbi@187.201.150.200) (Ping timeout: 256 seconds) |
2022-12-12 21:42:22 +0100 | ec | (~ec@gateway/tor-sasl/ec) |
2022-12-12 21:43:20 +0100 | <ballast> | I guess instead of taking a lens I could take as an argument (MyState -> a) and require that the user modifies their state using that function. It seems a little clunky but I want to allow the user access to their whole state when they write their handler. |
2022-12-12 21:44:50 +0100 | <monochrom> | This is why you need either (MyState -> a, a -> MyState) or the equivalent lens. |
2022-12-12 21:45:54 +0100 | festive_kurbus | (~festive_k@user/kurbus) |
2022-12-12 21:46:52 +0100 | <ballast> | ah yeah fair, I can't seem to write it with just (MyState -> a) |
2022-12-12 21:46:54 +0100 | <monochrom> | Alternatively you could narrow it to (MyState -> a) -> Reader a t -> State MyState t, but I don't know of a library that has it. |
2022-12-12 21:48:29 +0100 | <ballast> | If you were making an API, would you rather take (MyState -> a, a -> MyState) or a lens? I feel like if I were a consumer of the API and weren't using lenses I would be annoyed. |
2022-12-12 21:48:47 +0100 | <monochrom> | I would offer both. |
2022-12-12 21:48:54 +0100 | <ballast> | Seems fair. |
2022-12-12 21:49:38 +0100 | <monochrom> | But I think lens already has it. |
2022-12-12 21:50:05 +0100 | <ballast> | Oh, an API for converting (a -> b, b -> a) into something like Lens a a b b ? |
2022-12-12 21:50:13 +0100 | <c_wraith> | :t lens |
2022-12-12 21:50:14 +0100 | <lambdabot> | Functor f => (s -> a) -> (s -> b -> t) -> (a -> f b) -> s -> f t |
2022-12-12 21:50:23 +0100 | <ballast> | I use "API" poorly, I just mean some sort of method |
2022-12-12 21:50:28 +0100 | <c_wraith> | close, but the setter needs an extra value |
2022-12-12 21:50:29 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) (Remote host closed the connection) |
2022-12-12 21:50:30 +0100 | <monochrom> | No, the complete bridge between State MyState and State a |
2022-12-12 21:50:42 +0100 | <c_wraith> | ah. zoom is a bit funny |
2022-12-12 21:50:44 +0100 | <c_wraith> | :t zoom |
2022-12-12 21:50:45 +0100 | <lambdabot> | Zoom m n s t => LensLike' (Zoomed m c) t s -> m c -> n c |
2022-12-12 21:51:07 +0100 | <c_wraith> | that works within State, but it's... well, the type it has. |
2022-12-12 21:51:59 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 21:52:07 +0100 | <c_wraith> | > (1,2) &~ zoom _2 (id += 5) |
2022-12-12 21:52:09 +0100 | <lambdabot> | (1,7) |
2022-12-12 21:53:09 +0100 | <ballast> | ah yeah that is pretty much what I'm looking for |
2022-12-12 21:53:35 +0100 | kenran | (~user@user/kenran) |
2022-12-12 21:53:39 +0100 | <c_wraith> | so yeah, lens already does it. :) |
2022-12-12 21:53:46 +0100 | <ballast> | unfortunately I want to also take something of type n c as an argument |
2022-12-12 21:54:08 +0100 | kenran | (~user@user/kenran) (Remote host closed the connection) |
2022-12-12 21:54:14 +0100 | pavonia | (~user@user/siracusa) |
2022-12-12 21:54:47 +0100 | <ballast> | but I'm feeling a little better about just taking a lens as an argument per monochrom's suggestion of just offering an alternate method that takes the setter/getter functions directly |
2022-12-12 21:55:23 +0100 | <monochrom> | The Law of Gravity Lensing: Every sufficiently massive program contains a lens implementation. >:) |
2022-12-12 21:55:29 +0100 | tvandinther | (~tvandinth@111.69.34.210) |
2022-12-12 21:57:22 +0100 | <ballast> | ah so I can just use sets to create a setter from (a -> MyState, MyState -> a). I think that makes things easy enough, thanks guys! |
2022-12-12 21:58:01 +0100 | <ballast> | wrapping my head around s t a b makes me feel stabby 🙃 |
2022-12-12 21:58:37 +0100 | <darkling> | :) @ monochrom |
2022-12-12 22:02:01 +0100 | festive_kurbus | (~festive_k@user/kurbus) (Quit: Client closed) |
2022-12-12 22:02:20 +0100 | <tvandinther> | Hello, quick design question. I have a type `b` which is a compound data structure of all processed types `a`. I have a function `a -> b -> b` which highlights a new `b` from the compound structure according to its source `a` . Hopefully that part made sense. My question is, I want to make a `Map a b` but have access lazily evaluated that my |
2022-12-12 22:02:20 +0100 | <tvandinther> | function `a -> b -> b` operates on the single underlying data structure to return `b` with the correct highlight. Is this something I get for free with Haskell's laziness? Or should I opt for a `Set a` and expose `b` along with `a -> b -> b` ? |
2022-12-12 22:05:49 +0100 | <ballast> | tvandinther: is your idea to have the map's structure be lazy or its contents be lazy? |
2022-12-12 22:06:45 +0100 | <tvandinther> | the contents. I want `a -> b -> b` evaluated when accessed, and have just a single `b` in memory until a key is accessed. |
2022-12-12 22:08:16 +0100 | <ballast> | So your idea is to construct your map in a way similar to `fromList . map (f b) $ as` where `f :: b -> a -> b`, `as :: [a]`? |
2022-12-12 22:08:46 +0100 | <ballast> | er... let's assume that `fromList` is a magical function that can figure out the `a` associated with the mapped values |
2022-12-12 22:09:00 +0100 | <tvandinther> | Yes, that looks right |
2022-12-12 22:09:59 +0100 | <ballast> | I personally don't see the reason to hide `b` in this case, but I don't have your whole context. My intuition says that it _should_ be OK but your map is going to get big if you are forcing a lot of its entries. |
2022-12-12 22:10:16 +0100 | <ballast> | (my intuition is not the same as an actual answer, though) |
2022-12-12 22:10:53 +0100 | <ballast> | What I like about your alternative is that you can enforce that there will only be one `b` kicking around |
2022-12-12 22:12:04 +0100 | <ballast> | whereas once you force a leaf of the `Map a b` I don't see any reason why it would disappear. |
2022-12-12 22:13:07 +0100 | <tvandinther> | Originally I thought to have my execution of the routine to be a mapping from `Set a -> Map a b` but I suppose it could just as easily be `Set a -> (a -> b)` where `a -> b` has `b` partially applied. |
2022-12-12 22:13:57 +0100 | king_gs | (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) |
2022-12-12 22:15:04 +0100 | bobbingbob | (~dfadsva@2604:3d09:207f:f650::7b3a) |
2022-12-12 22:15:05 +0100 | <ballast> | Why do you need the `Set a` in the second case? |
2022-12-12 22:15:12 +0100 | bobbingbob | (~dfadsva@2604:3d09:207f:f650::7b3a) () |
2022-12-12 22:15:15 +0100 | <ballast> | Or did you mean `(a -> Maybe b)` as your return type |
2022-12-12 22:16:17 +0100 | <tvandinther> | I pass in a unique `[a]` so I figure a set would ensure that |
2022-12-12 22:17:49 +0100 | <ballast> | To me, `Map a b ~ (a -> Maybe b)` unless your map has every possible `a` in it. |
2022-12-12 22:17:59 +0100 | jmdaemon | (~jmdaemon@user/jmdaemon) |
2022-12-12 22:18:47 +0100 | king_gs | (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) (Ping timeout: 264 seconds) |
2022-12-12 22:19:48 +0100 | <tvandinther> | Essentially the process is I get a bunch of unique `a` and turn them into `[b]` and `fold (<>) -> b` |
2022-12-12 22:20:08 +0100 | <tvandinther> | So there should be a result for each `a` passed in |
2022-12-12 22:23:00 +0100 | doyougnu | (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) (Ping timeout: 248 seconds) |
2022-12-12 22:23:51 +0100 | <dsal> | Do you mean `[a] -> [b] -> b` ? That's just foldMap |
2022-12-12 22:23:55 +0100 | <dsal> | :t foldMap |
2022-12-12 22:23:56 +0100 | <lambdabot> | (Foldable t, Monoid m) => (a -> m) -> t a -> m |
2022-12-12 22:24:12 +0100 | terrorjack | (~terrorjac@2a01:4f8:1c1e:509a::1) (Ping timeout: 265 seconds) |
2022-12-12 22:25:00 +0100 | <dsal> | That's mildly confusing. If you have `(a -> b)` and you want `[a] -> b` then that's a foldMap. |
2022-12-12 22:25:13 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 260 seconds) |
2022-12-12 22:26:07 +0100 | terrorjack | (~terrorjac@2a01:4f8:1c1e:509a::1) |
2022-12-12 22:27:09 +0100 | <tvandinther> | I'm using `sconcat` to combine them |
2022-12-12 22:28:04 +0100 | <tvandinther> | Sorry for the confusion. I may lack the understanding to properly explain whats happening |
2022-12-12 22:28:34 +0100 | <tvandinther> | I think my original question about the map usage was answered though. |
2022-12-12 22:29:27 +0100 | ballast | (~ballast@cpe-104-32-238-223.socal.res.rr.com) (Quit: Client closed) |
2022-12-12 22:29:52 +0100 | <geekosaur> | > foldMap f [a,b,c] |
2022-12-12 22:29:53 +0100 | <lambdabot> | error: |
2022-12-12 22:29:53 +0100 | <lambdabot> | • Ambiguous type variable ‘a0’ arising from a use of ‘show_M119220221989... |
2022-12-12 22:29:53 +0100 | <lambdabot> | prevents the constraint ‘(Show a0)’ from being solved. |
2022-12-12 22:29:58 +0100 | ballast | (~ballast@cpe-104-32-238-223.socal.res.rr.com) |
2022-12-12 22:30:13 +0100 | <geekosaur> | > foldMap f [a,b,c] :: Expr |
2022-12-12 22:30:14 +0100 | <lambdabot> | f a <> f b <> f c <> mempty |
2022-12-12 22:31:09 +0100 | <dsal> | :t sconcat |
2022-12-12 22:31:10 +0100 | <lambdabot> | error: |
2022-12-12 22:31:10 +0100 | <lambdabot> | • Variable not in scope: sconcat |
2022-12-12 22:31:10 +0100 | <lambdabot> | • Perhaps you meant one of these: |
2022-12-12 22:31:12 +0100 | <ballast> | sorry I had to bail for a sec, to your original question it seems like if you only ever want to be using one of the `b`s at a time, then a `Map a b` might not be the appropriate data structure. |
2022-12-12 22:31:33 +0100 | <dsal> | oh, sconcat is fold for semigroups. |
2022-12-12 22:31:57 +0100 | <ballast> | but again i think it depends. if `length [a]` is small and each `a` and `b` are small then maybe it doesn't matter |
2022-12-12 22:32:12 +0100 | <ballast> | or if you want to cache the `b` once you create it |
2022-12-12 22:35:02 +0100 | coot | (~coot@213.134.171.3) (Quit: coot) |
2022-12-12 22:35:54 +0100 | coot | (~coot@213.134.171.3) |
2022-12-12 22:36:20 +0100 | <tvandinther> | The efficiency might be built in to the language. Say `b` was a record with one large field and one short string field. Each time I made a new `b` with a different short string value, only that difference is stored, right? |
2022-12-12 22:38:11 +0100 | <ballast> | Sorry, I don't know enough to answer that question. |
2022-12-12 22:38:23 +0100 | <tvandinther> | no worries |
2022-12-12 22:42:06 +0100 | <EvanR> | records are reallocated and rescribbled if any fields are updated |
2022-12-12 22:42:26 +0100 | <EvanR> | the fields not changed are carried over as is, unless you are also using unpacking |
2022-12-12 22:42:53 +0100 | <EvanR> | the fields not changed can benefit from sharing, unless you are also using unpacking |
2022-12-12 22:43:33 +0100 | <geekosaur> | but unpacking works best with short fields so if this is relevant then you shouldn't be using it |
2022-12-12 22:44:57 +0100 | fizbin | (~fizbin@user/fizbin) (Ping timeout: 268 seconds) |
2022-12-12 22:46:50 +0100 | Cale | (~cale@cpef48e38ee8583-cm30b7d4b3fc20.cpe.net.cable.rogers.com) |
2022-12-12 22:49:21 +0100 | coot | (~coot@213.134.171.3) (Quit: coot) |
2022-12-12 22:50:59 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) |
2022-12-12 22:55:23 +0100 | ec | (~ec@gateway/tor-sasl/ec) (Ping timeout: 255 seconds) |
2022-12-12 22:55:40 +0100 | eggplantade | (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) (Ping timeout: 260 seconds) |
2022-12-12 22:56:44 +0100 | ec | (~ec@gateway/tor-sasl/ec) |
2022-12-12 22:58:48 +0100 | fizbin | (~fizbin@user/fizbin) |
2022-12-12 23:02:15 +0100 | takuan | (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
2022-12-12 23:04:30 +0100 | albet70 | (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection) |
2022-12-12 23:10:37 +0100 | albet70 | (~xxx@2400:8902::f03c:92ff:fe60:98d8) |
2022-12-12 23:10:50 +0100 | king_gs | (~Thunderbi@187.201.150.200) |
2022-12-12 23:10:51 +0100 | j4cc3b | (~jeffreybe@pool-74-105-2-138.nwrknj.fios.verizon.net) (Ping timeout: 248 seconds) |
2022-12-12 23:13:42 +0100 | burnsidesLlama | (~burnsides@138.199.22.99) |
2022-12-12 23:15:16 +0100 | king_gs | (~Thunderbi@187.201.150.200) (Ping timeout: 248 seconds) |
2022-12-12 23:16:28 +0100 | fserucas | (~fserucas@2001:818:e376:a400:fb92:70c1:dd88:c7d7) (Remote host closed the connection) |
2022-12-12 23:16:31 +0100 | fizbin | (~fizbin@user/fizbin) (Remote host closed the connection) |
2022-12-12 23:16:51 +0100 | fserucas | (~fserucas@2001:818:e376:a400:fb92:70c1:dd88:c7d7) |
2022-12-12 23:18:22 +0100 | <dminuoso> | I think the more relevant term here is *unboxed* and *boxed* |
2022-12-12 23:18:53 +0100 | mestre | (~mestre@191.177.185.178) |
2022-12-12 23:19:01 +0100 | <dminuoso> | If its boxed, the new value will have all "unchanged" fields with a pointer to the old value |
2022-12-12 23:21:20 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) |
2022-12-12 23:26:26 +0100 | merijn | (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
2022-12-12 23:27:03 +0100 | niko | (niko@libera/staff/niko) |
2022-12-12 23:30:56 +0100 | ballast | (~ballast@cpe-104-32-238-223.socal.res.rr.com) (Quit: Client closed) |
2022-12-12 23:31:09 +0100 | mmhat | (~mmh@p200300f1c7390125ee086bfffe095315.dip0.t-ipconnect.de) |
2022-12-12 23:33:03 +0100 | troydm | (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 268 seconds) |
2022-12-12 23:33:26 +0100 | michalz | (~michalz@185.246.204.87) (Remote host closed the connection) |
2022-12-12 23:34:12 +0100 | mmhat | (~mmh@p200300f1c7390125ee086bfffe095315.dip0.t-ipconnect.de) (Client Quit) |
2022-12-12 23:35:39 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
2022-12-12 23:36:00 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) |
2022-12-12 23:43:23 +0100 | tomokojun | (~tomokojun@75.164.52.103) (Quit: じゃあね〜。) |
2022-12-12 23:47:16 +0100 | Guest|46 | (~Guest|46@158.red-79-151-122.dynamicip.rima-tde.net) |
2022-12-12 23:49:50 +0100 | <EvanR> | and if the field is unpacked, it won't xD |
2022-12-12 23:51:22 +0100 | chomwitt | (~chomwitt@ppp-94-69-55-246.home.otenet.gr) (Ping timeout: 256 seconds) |
2022-12-12 23:52:47 +0100 | azimut_ | (~azimut@gateway/tor-sasl/azimut) |
2022-12-12 23:52:59 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 255 seconds) |
2022-12-12 23:53:26 +0100 | azimut | (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds) |
2022-12-12 23:53:34 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) |
2022-12-12 23:57:58 +0100 | Guest|46 | (~Guest|46@158.red-79-151-122.dynamicip.rima-tde.net) (Quit: Guest|46) |