Logs on 2022-12-12 (liberachat/#haskell)
| 00:02:52 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
| 00:03:52 | <dsal> | Yeah, that's kind of obvious now… I'm going to keep hitting this until something meaningful happens. |
| 00:08:40 | <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 |
| 00:09:03 | <dsal> | Oh. I need to do something different for the first one. |
| 00:09:35 | <dsal> | And I need the thing that happened to each one to be known for the next one. |
| 00:09:38 | → | beteigeuze joins (~Thunderbi@bl14-81-220.dsl.telepac.pt) |
| 00:09:47 | × | chomwitt quits (~chomwitt@2a02:587:7a05:dc00:1ac0:4dff:fedb:a3f1) (Ping timeout: 248 seconds) |
| 00:10:13 | <c_wraith> | do you need to pass information the other direction? |
| 00:10:50 | <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. |
| 00:10:55 | <dsal> | Which is kind of scanl. |
| 00:11:11 | → | ddellacosta joins (~ddellacos@143.244.47.89) |
| 00:11:12 | <c_wraith> | ok, just checking. I didn't actually do the problem, so I'm not sure what your goal is |
| 00:12:34 | <dsal> | The actual thing I did was this (passing the previous answer with manual recursion): https://www.irccloud.com/pastebin/kEKQJccG/follow.hs |
| 00:12:50 | <dsal> | I'm just trying to figure out how to make that better by using recursion-schemes and more code. |
| 00:15:50 | → | fizbin joins (~fizbin@user/fizbin) |
| 00:30:54 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
| 00:31:24 | → | FinnElija joins (~finn_elij@user/finn-elija/x-0085643) |
| 00:31:27 | <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 |
| 00:32:11 | → | qy joins (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
| 00:32:31 | <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. |
| 00:33:01 | × | Topsi quits (~Topsi@dialin-80-228-141-073.ewe-ip-backbone.de) (Read error: Connection reset by peer) |
| 00:34:47 | × | ix quits (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Ping timeout: 265 seconds) |
| 00:35:57 | <c_wraith> | yeah, that forces it to go all the way to the end first |
| 00:36:40 | <dsal> | That's a bit counterintuitive. I'd think looking at the first thing would only require the first thing. |
| 00:36:51 | <c_wraith> | your code that isn't using recursion schemes doesn't do that - it only looks at the current element |
| 00:37:06 | <dsal> | Yeah, because I'm passing the previous along. |
| 00:37:40 | <c_wraith> | so why do that here? |
| 00:37:51 | <dsal> | This *feels* like it wants to do the right thing, it just does it backwards from what I expect. |
| 00:37:55 | <c_wraith> | It's the same trick as 3-arg foldr |
| 00:38:17 | <dsal> | What do you mean 3-arg foldr? |
| 00:38:22 | → | adium joins (adium@user/adium) |
| 00:38:49 | <c_wraith> | I actually mean 4-arg. I can count that high, I swear. |
| 00:40:44 | <hpc> | @let data Count = Zero | One | Infinity |
| 00:40:45 | <lambdabot> | Defined. |
| 00:40:46 | <hpc> | :P |
| 00:40:58 | <c_wraith> | but anyway, the idea is that your recursion scheme returns a function, and that function is what does the final processing |
| 00:42:17 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 246 seconds) |
| 00:42:32 | × | acidjnk quits (~acidjnk@p200300d6e7137a35c0a7281abf493a9c.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 00:43:35 | <dsal> | Hmm... It's already getting a bit unwieldy, but can it even do the thing? |
| 00:43:43 | <c_wraith> | It can certainly do it. |
| 00:43:44 | <dsal> | Or is the idea to push the state through in a sort of schwartizan transform? |
| 00:44:10 | <dsal> | Which I could do with just regular map. heh |
| 00:44:15 | <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. |
| 00:44:37 | <dsal> | Yeah, that's what I'd hope for. heh. |
| 00:44:44 | <dsal> | My actual goal is to get some intuition for this. |
| 00:45:10 | <dsal> | I'm assuming the `Nil` case is just not interesting at all. |
| 00:46:13 | × | qy quits (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Quit: WeeChat 3.7.1) |
| 00:46:53 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 00:46:57 | × | fizbin quits (~fizbin@user/fizbin) (Ping timeout: 268 seconds) |
| 00:47:32 | → | ix joins (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
| 00:49:11 | × | ix quits (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Client Quit) |
| 00:50:32 | → | ix joins (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
| 00:54:12 | × | mestre quits (~mestre@191.177.185.178) (Ping timeout: 248 seconds) |
| 00:55:03 | <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 |
| 00:55:42 | <c_wraith> | err. indeed. the id and the x at the end are definitely in the wrong spots |
| 00:57:10 | <c_wraith> | It should be more like \xs -> ... xs hp (no id at all, I misremembered why it's there with foldr) |
| 00:57:34 | <c_wraith> | in fact, hp should be a parameter too. |
| 00:57:55 | <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 |
| 00:58:24 | × | gurkenglas quits (~gurkengla@p548ac72e.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 00:58:41 | <dsal> | Hmm... Thanks. I'll mangle that around. |
| 00:59:21 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 01:01:07 | → | Guest7583 joins (Guest75@2a01:7e01::f03c:92ff:fe5d:7b18) |
| 01:04:09 | <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". |
| 01:04:31 | <dsal> | Otherwise, might as well just do the same thing with foldr |
| 01:08:15 | <c_wraith> | well, the advantage you get with para is that you get to bail out early |
| 01:08:30 | <c_wraith> | ... while returning the unchanged tail of the list |
| 01:08:34 | ← | L29Ah parts (~L29Ah@wikipedia/L29Ah) () |
| 01:08:40 | <c_wraith> | Doing that with foldr requires an extra parameter |
| 01:08:50 | <c_wraith> | ... one *more* extra parameter |
| 01:09:33 | <c_wraith> | that is... para gives you access to knots |
| 01:09:37 | <c_wraith> | foldr doesn't |
| 01:09:50 | → | L29Ah joins (~L29Ah@wikipedia/L29Ah) |
| 01:10:00 | <c_wraith> | both of them would need an extra parameter for passing down the hp value |
| 01:10:25 | Axma25968 | is now known as Axman6 |
| 01:10:28 | × | albet70 quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection) |
| 01:13:44 | <dsal> | Oh, that's right. I wasn't thinking about how bailing out of foldr throws away the tail. |
| 01:14:31 | → | POGtastic joins (~mike@2601:1c0:6000:fe1:50c1:1bcb:3a70:9713) |
| 01:15:25 | <c_wraith> | in either case, the extra parameter is awkward to deal with |
| 01:15:44 | × | troydm quits (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 260 seconds) |
| 01:16:36 | → | albet70 joins (~xxx@2400:8902::f03c:92ff:fe60:98d8) |
| 01:25:26 | × | CiaoSen quits (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 255 seconds) |
| 01:28:53 | × | xff0x_ quits (~xff0x@ai071162.d.east.v6connect.net) (Ping timeout: 268 seconds) |
| 01:33:32 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
| 01:36:19 | × | ix quits (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Quit: WeeChat 3.7.1) |
| 01:37:35 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 246 seconds) |
| 01:37:42 | → | ix joins (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
| 01:38:01 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 01:38:07 | inkbottle[m] | is now known as zebrag[m] |
| 01:38:45 | × | ddellacosta quits (~ddellacos@143.244.47.89) (Ping timeout: 268 seconds) |
| 01:40:29 | → | ddellacosta joins (~ddellacos@89.45.224.169) |
| 01:41:05 | <dsal> | c_wraith: neat The idea worked. |
| 01:41:38 | <c_wraith> | well there you go. Not an amazing change in and of itself, but that's how you'd use cata for that |
| 01:41:48 | → | razetime joins (~quassel@49.207.203.213) |
| 01:44:56 | <dsal> | Did require me passing out on the floor for some reason, though. |
| 01:45:12 | <c_wraith> | sounds normal for your first time |
| 01:46:17 | <dsal> | Heh. It's about +7 loc |
| 01:46:31 | <dsal> | Part of that is just line wrapping though since I'm just using git diff. |
| 01:48:15 | × | stiell quits (~stiell@gateway/tor-sasl/stiell) (Remote host closed the connection) |
| 01:48:40 | <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. |
| 01:48:43 | → | stiell joins (~stiell@gateway/tor-sasl/stiell) |
| 01:49:13 | <c_wraith> | yeah.. I ignored that and went with the exact same functionality as your starting function |
| 01:49:50 | <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. |
| 01:50:11 | <c_wraith> | yeah, it's a case where you need several reps |
| 01:50:34 | <dsal> | I ended up here: https://www.irccloud.com/pastebin/P4iBthnt/para.hs |
| 01:51:25 | <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. |
| 01:51:44 | <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 |
| 01:52:07 | <dsal> | Oh right. I almost had names that made sense to me. |
| 01:53:49 | <dsal> | `remaining` and `done` at least might be useful crumbs. |
| 01:54:04 | <dsal> | Though `done` seems kind of confusing. |
| 01:54:47 | <dsal> | I can see why they went with `t` and `a`. I can put the pieces together, but naming is hard. |
| 01:56:34 | <c_wraith> | at least you have a concrete case, where you know what every variable contains. |
| 01:56:40 | <dsal> | Is there a name for this fold-to-a-function trick? It seems like the opposite of currying. |
| 01:58:15 | × | harveypwca quits (~harveypwc@2601:246:c180:a570:3828:d8:e523:3f67) (Quit: Leaving) |
| 02:00:19 | <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. |
| 02:00:20 | × | ddellacosta quits (~ddellacos@89.45.224.169) (Ping timeout: 268 seconds) |
| 02:06:48 | → | ddellacosta joins (~ddellacos@143.244.47.100) |
| 02:06:50 | × | jao quits (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) (Ping timeout: 260 seconds) |
| 02:10:47 | × | beteigeuze quits (~Thunderbi@bl14-81-220.dsl.telepac.pt) (Ping timeout: 252 seconds) |
| 02:12:19 | × | ddellacosta quits (~ddellacos@143.244.47.100) (Ping timeout: 260 seconds) |
| 02:12:34 | <jackdk> | uniplate is cool, and the plated operations in lens are even cooler |
| 02:13:19 | → | xff0x_ joins (~xff0x@125x103x176x34.ap125.ftth.ucom.ne.jp) |
| 02:16:28 | → | ddellacosta joins (~ddellacos@89.45.224.156) |
| 02:16:38 | × | POGtastic quits (~mike@2601:1c0:6000:fe1:50c1:1bcb:3a70:9713) (Quit: WeeChat 3.6) |
| 02:18:02 | × | ix quits (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Quit: WeeChat 3.7.1) |
| 02:19:23 | → | ix joins (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
| 02:20:20 | × | ix quits (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) (Client Quit) |
| 02:21:24 | × | phma quits (~phma@host-67-44-208-203.hnremote.net) (Read error: Connection reset by peer) |
| 02:21:38 | → | ix joins (~ix@2a02:8010:674f:0:d65d:64ff:fe52:5efe) |
| 02:22:50 | × | ddellacosta quits (~ddellacos@89.45.224.156) (Ping timeout: 256 seconds) |
| 02:23:49 | → | phma joins (phma@2001:5b0:2144:3348:b796:42a8:66d:6853) |
| 02:24:48 | → | ddellacosta joins (~ddellacos@89.45.224.208) |
| 02:24:54 | → | money_ joins (~money@user/polo) |
| 02:25:35 | money | is now known as Guest3515 |
| 02:25:35 | money_ | is now known as money |
| 02:27:47 | <dsal> | Yeah, it's nice when I've got a recursive data structure more complex than list |
| 02:28:20 | × | Unicorn_Princess quits (~Unicorn_P@user/Unicorn-Princess/x-3540542) (Remote host closed the connection) |
| 02:29:54 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 02:36:46 | → | money_ joins (~money@user/polo) |
| 02:37:34 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 256 seconds) |
| 02:39:05 | × | money quits (~money@user/polo) (Ping timeout: 256 seconds) |
| 02:39:25 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 02:40:01 | money_ | is now known as money |
| 02:47:02 | × | money quits (~money@user/polo) (Quit: late) |
| 02:47:51 | → | money joins (~money@user/polo) |
| 02:48:26 | × | ddellacosta quits (~ddellacos@89.45.224.208) (Ping timeout: 268 seconds) |
| 02:50:32 | → | bontaq joins (~user@ool-45779fe5.dyn.optonline.net) |
| 02:54:58 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:44ff:72e2:5072:e2ac) (Remote host closed the connection) |
| 02:58:45 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:44ff:72e2:5072:e2ac) |
| 03:00:27 | → | ddellacosta joins (~ddellacos@89.45.224.156) |
| 03:04:28 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 268 seconds) |
| 03:18:11 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 264 seconds) |
| 03:20:05 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 03:22:03 | × | money quits (~money@user/polo) (Quit: late) |
| 03:22:30 | → | money joins (~money@user/polo) |
| 03:24:25 | × | thegeekinside quits (~thegeekin@189.217.82.244) (Read error: Connection reset by peer) |
| 03:25:33 | → | Guest23 joins (~Guest23@27.57.46.219) |
| 03:27:38 | → | RedSwan joins (~jared@174-23-134-43.slkc.qwest.net) |
| 03:33:00 | × | [itchyjunk] quits (~itchyjunk@user/itchyjunk/x-7353470) (Read error: Connection reset by peer) |
| 03:40:52 | × | td_ quits (~td@83.135.9.54) (Ping timeout: 265 seconds) |
| 03:42:18 | → | td_ joins (~td@83.135.9.32) |
| 03:42:34 | → | ballast joins (~ballast@cpe-104-32-238-223.socal.res.rr.com) |
| 03:45:35 | × | mzan quits (~quassel@mail.asterisell.com) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
| 03:46:36 | → | mzan joins (~quassel@mail.asterisell.com) |
| 03:47:00 | × | shapr quits (~user@68.54.166.125) (Ping timeout: 248 seconds) |
| 03:47:23 | × | Guest23 quits (~Guest23@27.57.46.219) (Ping timeout: 246 seconds) |
| 03:49:16 | <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. |
| 03:50:26 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Ping timeout: 255 seconds) |
| 03:50:56 | <ballast> | by "carrying around" I mean having as a part of application state - could clarify my particular use case more if needed |
| 03:51:36 | → | king_gs joins (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) |
| 03:51:57 | <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) |
| 03:52:35 | → | FinnElija joins (~finn_elij@user/finn-elija/x-0085643) |
| 03:54:19 | <c_wraith> | efficiency in some use cases is the biggest difference |
| 03:54:38 | × | ddellacosta quits (~ddellacos@89.45.224.156) (Ping timeout: 256 seconds) |
| 03:54:43 | <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 ? |
| 03:55:19 | <c_wraith> | If you're updating, maps can be a *lot* more efficient |
| 03:55:21 | <sm> | also much more if a pain for inspecting inner state, debugging etc |
| 03:58:57 | × | ballast quits (~ballast@cpe-104-32-238-223.socal.res.rr.com) (Quit: Client closed) |
| 04:00:00 | × | Taneb quits (~Taneb@runciman.hacksoc.org) (Quit: I seem to have stopped.) |
| 04:00:18 | × | money quits (~money@user/polo) (Quit: late) |
| 04:00:20 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 04:00:50 | → | money joins (~money@user/polo) |
| 04:01:13 | → | Taneb joins (~Taneb@runciman.hacksoc.org) |
| 04:05:27 | → | sagax joins (~sagax_nb@user/sagax) |
| 04:14:52 | × | lisbeths quits (uid135845@id-135845.lymington.irccloud.com) (Quit: Connection closed for inactivity) |
| 04:18:26 | × | machinedgod quits (~machinedg@d198-53-218-113.abhsia.telus.net) (Ping timeout: 256 seconds) |
| 04:19:08 | → | j4cc3b joins (~jeffreybe@pool-74-105-2-138.nwrknj.fios.verizon.net) |
| 04:20:30 | × | king_gs quits (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) (Ping timeout: 265 seconds) |
| 04:20:48 | → | lisbeths joins (uid135845@id-135845.lymington.irccloud.com) |
| 04:21:32 | × | finsternis quits (~X@23.226.237.192) (Read error: Connection reset by peer) |
| 04:26:32 | → | ballast joins (~ballast@cpe-104-32-238-223.socal.res.rr.com) |
| 04:28:24 | → | fizbin joins (~fizbin@user/fizbin) |
| 04:28:40 | <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? |
| 04:29:24 | × | wroathe quits (~wroathe@user/wroathe) (Ping timeout: 260 seconds) |
| 04:30:01 | <c_wraith> | that sounds like a case where a function is perfectly fine |
| 04:32:14 | <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. |
| 04:32:47 | <ballast> | Thanks for the input |
| 04:32:57 | <c_wraith> | well, if you're adding in some cases that aren't in the map, it's not overly clever anymore. :) |
| 04:34:52 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
| 04:36:11 | × | notzmv quits (~zmv@user/notzmv) (Ping timeout: 264 seconds) |
| 04:37:56 | <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. |
| 04:38:17 | × | russruss quits (~russruss@my.russellmcc.com) (Quit: The Lounge - https://thelounge.chat) |
| 04:38:19 | <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. |
| 04:38:58 | <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. |
| 04:39:30 | → | russruss joins (~russruss@my.russellmcc.com) |
| 04:40:11 | → | notzmv joins (~zmv@user/notzmv) |
| 04:55:00 | <dsal> | > para (\a b -> sum a + sum b) [1, 1, 1, 1] |
| 04:55:02 | <lambdabot> | 10 |
| 04:55:05 | <dsal> | Neat. |
| 04:59:06 | × | money quits (~money@user/polo) (Quit: late) |
| 04:59:07 | <int-e> | > sum . zipWith (*) [1..] $ [1,1,1,1] |
| 04:59:08 | <lambdabot> | 10 |
| 04:59:30 | <int-e> | (I took a moment to figure out what that code did.) |
| 04:59:39 | × | Erutuon_ quits (~Erutuon@user/erutuon) (Ping timeout: 265 seconds) |
| 05:01:02 | → | troydm joins (~troydm@host-176-37-124-197.b025.la.net.ua) |
| 05:03:28 | → | aeroplane joins (~user@user/aeroplane) |
| 05:04:07 | → | money joins (~money@user/polo) |
| 05:08:20 | → | tvandinther joins (~tvandinth@101.98.118.246) |
| 05:08:35 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Remote host closed the connection) |
| 05:08:56 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 05:10:01 | <tvandinther> | How can I bind `a -> b` when I have a monad in a monad? E.g. `IO (Maybe a)` |
| 05:10:59 | <tvandinther> | doing something like `>>= ( >>= f)` works, whats the usual approach? |
| 05:11:27 | <jackdk> | If it's just a pure function `a -> b` I would consider `fmap . fmap` |
| 05:11:34 | <jackdk> | :t fmap . fmap |
| 05:11:34 | <lambdabot> | (Functor f1, Functor f2) => (a -> b) -> f1 (f2 a) -> f1 (f2 b) |
| 05:11:38 | × | Guest7583 quits (Guest75@2a01:7e01::f03c:92ff:fe5d:7b18) (Ping timeout: 260 seconds) |
| 05:12:07 | <jackdk> | With those specific types `IO (Maybe a)`, I would consider working in the `MaybeT IO` monad |
| 05:16:10 | <tvandinther> | How much understanding of transformers should I have to use that, because I currently have none |
| 05:17:05 | → | tomokojun joins (~tomokojun@75.164.52.103) |
| 05:21:34 | <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 |
| 05:21:44 | <jackdk> | tvandinther: challenge: given `newtype M a = M (IO (Maybe a))`, write its `Functor`, `Applicative`, and `Monad`instances |
| 05:22:03 | <jackdk> | this has a point, trust me, and pastebin your results in this channel |
| 05:23:12 | → | rekahsoft joins (~rekahsoft@bras-base-wdston4533w-grc-05-184-144-15-227.dsl.bell.ca) |
| 05:25:34 | <tvandinther> | Not urgently so happy to learn this. |
| 05:25:39 | <tvandinther> | I can give that a shot |
| 05:26:46 | × | forell quits (~forell@user/forell) (Quit: ZNC - https://znc.in) |
| 05:27:00 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 256 seconds) |
| 05:27:04 | → | forell joins (~forell@user/forell) |
| 05:28:47 | × | ballast quits (~ballast@cpe-104-32-238-223.socal.res.rr.com) (Quit: Client closed) |
| 05:31:15 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 05:34:56 | × | rekahsoft quits (~rekahsoft@bras-base-wdston4533w-grc-05-184-144-15-227.dsl.bell.ca) (Ping timeout: 256 seconds) |
| 05:37:23 | × | iqubic quits (~avi@2601:602:9502:c70:3fce:1b2:5b0b:b57c) (Remote host closed the connection) |
| 05:37:59 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds) |
| 05:39:23 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 05:40:20 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 05:40:36 | × | bontaq quits (~user@ool-45779fe5.dyn.optonline.net) (Ping timeout: 248 seconds) |
| 05:44:04 | × | money quits (~money@user/polo) (Quit: late) |
| 05:47:35 | × | j4cc3b quits (~jeffreybe@pool-74-105-2-138.nwrknj.fios.verizon.net) (Ping timeout: 264 seconds) |
| 05:53:44 | <tvandinther> | I'm struggling with the implementation of bind |
| 05:54:42 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 252 seconds) |
| 05:56:29 | <jackdk> | What do you have so far? Put it into a pastebin and pop the link in here |
| 05:59:35 | <tvandinther> | https://paste.tomsmeding.com/NxM2S9Ns |
| 06:01:01 | <jackdk> | OK, so `a'` has type `Maybe a`, right? What if you put a `case`-expression under it: `case a of ...` |
| 06:01:14 | → | iqubic joins (~avi@2601:602:9502:c70:6c06:b297:7404:329f) |
| 06:01:54 | <tvandinther> | yeah I figure I'd do `Nothing -> pure Nothing` and then for Just I have a raw `a` |
| 06:02:06 | → | Lycurgus joins (~juan@user/Lycurgus) |
| 06:02:15 | <jackdk> | yep, and what do you have that can accept an `a`? |
| 06:02:32 | × | mvk quits (~mvk@2607:fea8:5ce3:8500::efb) (Quit: Going elsewhere) |
| 06:02:47 | <tvandinther> | I apply that to f to get `M b` |
| 06:03:25 | <jackdk> | And can you then make that fit? |
| 06:05:38 | <tvandinther> | Do I have to move the M constructor into the do block? Otherwise I'm doing `M $ M b` right? |
| 06:05:46 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 268 seconds) |
| 06:06:39 | <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) }` |
| 06:07:13 | <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" |
| 06:07:21 | <iqubic> | V2 is from Data.Linear |
| 06:07:49 | <tvandinther> | I gotta run off now but I'll pick this back up later. Thanks jackdk |
| 06:07:54 | <jackdk> | ok, good luck |
| 06:08:08 | × | tvandinther quits (~tvandinth@101.98.118.246) (Quit: Client closed) |
| 06:08:12 | <iqubic> | So, why the heck am I getting an undefined array element thing here? |
| 06:09:16 | <iqubic> | Oh, I see the issue here. |
| 06:09:34 | <iqubic> | I'm parsing the grid from a string and I have a copy paste error |
| 06:09:55 | <iqubic> | The number of elements I passed to the array construct was one less than expected. |
| 06:14:23 | → | chomwitt joins (~chomwitt@2a02:587:7a05:dc00:1ac0:4dff:fedb:a3f1) |
| 06:14:26 | × | ChaiTRex quits (~ChaiTRex@user/chaitrex) (Remote host closed the connection) |
| 06:14:58 | → | ChaiTRex joins (~ChaiTRex@user/chaitrex) |
| 06:16:08 | × | notzmv quits (~zmv@user/notzmv) (Ping timeout: 255 seconds) |
| 06:19:30 | → | takuan joins (~takuan@178-116-218-225.access.telenet.be) |
| 06:21:27 | → | money joins (~money@user/polo) |
| 06:31:52 | → | bgs joins (~bgs@212-85-160-171.dynamic.telemach.net) |
| 06:34:07 | → | king_gs joins (~Thunderbi@187.201.150.200) |
| 06:35:03 | × | money quits (~money@user/polo) (Quit: late) |
| 06:37:05 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 06:38:56 | → | money joins (~money@user/polo) |
| 06:39:18 | → | mncheckm joins (~mncheck@193.224.205.254) |
| 06:41:42 | × | Lycurgus quits (~juan@user/Lycurgus) (Quit: Exeunt https://tinyurl.com/4m8d4kd5) |
| 06:49:55 | <iqubic> | How can I tell if/when I should inline functions I've written? |
| 06:50:02 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 06:50:38 | → | califax joins (~califax@user/califx) |
| 06:53:40 | × | king_gs quits (~Thunderbi@187.201.150.200) (Read error: Connection reset by peer) |
| 06:53:51 | → | king_gs1 joins (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) |
| 06:56:09 | king_gs1 | is now known as king_gs |
| 07:01:49 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 07:05:53 | × | emmanuelux quits (~emmanuelu@user/emmanuelux) (Quit: au revoir) |
| 07:07:37 | → | kenran joins (~user@user/kenran) |
| 07:09:55 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 07:10:19 | × | kenran quits (~user@user/kenran) (Remote host closed the connection) |
| 07:19:24 | × | money quits (~money@user/polo) (Quit: late) |
| 07:24:43 | × | [_________] quits (~oos95GWG@user/oos95GWG) (Quit: [_________]) |
| 07:26:34 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 256 seconds) |
| 07:28:27 | → | waleee joins (~waleee@h-176-10-137-138.NA.cust.bahnhof.se) |
| 07:29:53 | → | [_________] joins (~oos95GWG@user/oos95GWG) |
| 07:31:59 | × | king_gs quits (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) (Ping timeout: 264 seconds) |
| 07:32:55 | × | fizbin quits (~fizbin@user/fizbin) (Ping timeout: 260 seconds) |
| 07:35:54 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 252 seconds) |
| 07:36:59 | × | bgs quits (~bgs@212-85-160-171.dynamic.telemach.net) (Remote host closed the connection) |
| 07:41:45 | → | burnsidesLlama joins (~burnsides@119247164140.ctinets.com) |
| 07:49:02 | ← | jakalx parts (~jakalx@base.jakalx.net) () |
| 07:54:09 | × | burnsidesLlama quits (~burnsides@119247164140.ctinets.com) (Ping timeout: 260 seconds) |
| 08:02:37 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 08:05:35 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds) |
| 08:06:53 | × | [_________] quits (~oos95GWG@user/oos95GWG) (Quit: [_________]) |
| 08:07:18 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 255 seconds) |
| 08:08:05 | → | tvandinther joins (~tvandinth@101.98.118.246) |
| 08:08:09 | × | waleee quits (~waleee@h-176-10-137-138.NA.cust.bahnhof.se) (Ping timeout: 265 seconds) |
| 08:08:54 | → | [_________] joins (~oos95GWG@user/oos95GWG) |
| 08:09:12 | → | waleee joins (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) |
| 08:10:36 | <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? |
| 08:11:51 | × | jpds2 quits (~jpds@gateway/tor-sasl/jpds) (Remote host closed the connection) |
| 08:11:59 | <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 |
| 08:12:10 | <jackdk> | and inside the `...` you have `MaybeT m` as your monad |
| 08:12:52 | → | jpds2 joins (~jpds@gateway/tor-sasl/jpds) |
| 08:13:50 | <tvandinther> | Seems like a sensible name especially if its used with IO inside of it. |
| 08:14:45 | <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 |
| 08:14:48 | → | trev joins (~trev@user/trev) |
| 08:14:58 | → | gmg joins (~user@user/gehmehgeh) |
| 08:15:00 | <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" |
| 08:15:24 | × | heartburn quits (~gass@2a00:d880:3:1::b1e4:b241) (Ping timeout: 255 seconds) |
| 08:15:35 | <dminuoso> | Or that's one way of interpreting it anyway |
| 08:15:56 | × | shriekingnoise quits (~shrieking@186.137.167.202) (Quit: Quit) |
| 08:16:02 | <dminuoso> | tvandinther: Note that you can easily use MaybeT on other monads too, like Identity. |
| 08:17:30 | → | heartburn joins (~gass@2a00:d880:3:1::b1e4:b241) |
| 08:17:52 | <dminuoso> | But its sometimes very vague and usually derived from the authors mental model |
| 08:19:03 | <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? |
| 08:19:15 | × | Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
| 08:19:34 | <tvandinther> | And this deconstructor is usually hidden / unavailable to you unless you specify it in the newtype declaration? |
| 08:20:25 | <dminuoso> | The constructor (no such thing as a deconstructor) can only hidden by not exporting it from a module. |
| 08:21:21 | <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) |
| 08:22:33 | <dminuoso> | Note, that when you declare a newtype or a data, you cannot not have a constructor. It is mandatory. |
| 08:22:54 | <tvandinther> | what is it called when you specify a function in a newtype to access its insides? |
| 08:23:08 | <dminuoso> | It's a field accessor |
| 08:23:18 | → | acidjnk joins (~acidjnk@p200300d6e7137a35c0a7281abf493a9c.dip0.t-ipconnect.de) |
| 08:23:18 | <[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 |
| 08:23:37 | <dminuoso> | In a newtype it does take the role of a "deconstructor" if you want, but it is not common terminology. |
| 08:24:14 | <dminuoso> | But for a data type, which can have multiple fields, it does not hold true anymore. So just call it a field |
| 08:25:15 | <dminuoso> | (Or the proper technical term is `field label` actually) |
| 08:25:24 | <dminuoso> | Or `selector function` |
| 08:25:42 | <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? |
| 08:25:48 | → | avicenzi joins (~avicenzi@2a00:ca8:a1f:b004::c32) |
| 08:26:01 | <dminuoso> | tvandinther: For a newtype, there is no runtime representation |
| 08:26:11 | <dminuoso> | So the act of pattern matching is a noop |
| 08:26:28 | <dminuoso> | Even the use of a field label/selector function/accessor in a newtype is a noop |
| 08:26:38 | × | waleee quits (~waleee@2001:9b0:213:7200:cc36:a556:b1e8:b340) (Ping timeout: 255 seconds) |
| 08:26:44 | <dminuoso> | tvandinther: It might be helpful to understand that its rather the other way around |
| 08:27:02 | <dminuoso> | The fundamental principle of operation in haskell is case-of. |
| 08:27:25 | <tvandinther> | yeah makes sense. I knew about the runtime thing. Just trying to connect the dots. This makes sense for the most part. |
| 08:27:27 | <dminuoso> | So the use of a field label actually desugars into a case-of pattern matching, which the compiler will know to handle |
| 08:27:36 | → | king_gs joins (~Thunderbi@187.201.150.200) |
| 08:27:41 | <dminuoso> | For a newtype it will compile just into whats called a coercion |
| 08:27:48 | <dminuoso> | In the GHC compiler anyway |
| 08:27:58 | <dminuoso> | Which eventually is just a noop |
| 08:28:09 | <dminuoso> | % newtype D = D Int |
| 08:28:09 | <yahb2> | <no output> |
| 08:28:28 | <dminuoso> | `let x = case f of D i -> i` is a noop |
| 08:28:51 | <dminuoso> | (If we ignore what's going on with x) |
| 08:29:03 | <dminuoso> | ` case f of D i -> i` is the better example. thats a noop |
| 08:29:26 | <dminuoso> | tvandinther: one cool thing is, in GHC haskell *all* evaluation is eventually driven just by case-of. |
| 08:29:38 | <dminuoso> | It's the fundamental framework |
| 08:30:03 | <tvandinther> | Funny because thats what my code looks like too before I refactor |
| 08:30:27 | <mauke> | it can't be all case-of |
| 08:30:46 | <dminuoso> | mauke: Im talking about the driver of evalution. |
| 08:30:48 | <mauke> | we have at least application |
| 08:30:54 | <dminuoso> | Not all there is in the language |
| 08:31:09 | <mauke> | LC evaluates things without case/of |
| 08:31:16 | <dminuoso> | LC? |
| 08:31:20 | <mauke> | lambda calculus |
| 08:31:28 | <dminuoso> | Sure. And? |
| 08:31:38 | <mauke> | and Haskell is based on it |
| 08:31:55 | <mauke> | so when you have 'f x', you need to evaluate f to proceed |
| 08:31:56 | <[exa]> | mauke: haskell is explicitly extended by deconstructible types |
| 08:32:15 | <dminuoso> | Haskell is based on Core, which is losely based on System FC, and it fundamentally includes case-of |
| 08:32:22 | <dminuoso> | https://downloads.haskell.org/ghc/9.0.1/docs/html/libraries/ghc-9.0.1/GHC-Core.html#t:Expr |
| 08:32:34 | <mauke> | no, that's an implementation detail of how GHC does things |
| 08:32:57 | <dminuoso> | Yes, so? |
| 08:33:02 | <dminuoso> | I was talking about GHC Haskell. |
| 08:33:08 | <[exa]> | I love the scale of that implementation detail. :D |
| 08:33:34 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 08:33:34 | <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. |
| 08:33:48 | <mauke> | but it's not the Haskell case-of |
| 08:34:20 | → | fizbin joins (~fizbin@user/fizbin) |
| 08:34:50 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 255 seconds) |
| 08:35:24 | <dminuoso> | mauke: The Haskell report is filled with that influence. Most desugaring rules or semantic equivalences are expressed in case-of translation. |
| 08:35:40 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 08:35:45 | <dminuoso> | In case of what we were talking about |
| 08:35:46 | <mauke> | yes, that's Haskell case-of, not Core case-of |
| 08:35:51 | <mauke> | which has different semantics |
| 08:36:02 | <mauke> | and I see even GHC.Core.Expr contains App |
| 08:36:26 | <[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. |
| 08:37:14 | <dminuoso> | [Leary]: Hah, I want to see some code written in that style. |
| 08:37:21 | <[exa]> | more thunks!!!11 |
| 08:37:41 | <dminuoso> | mauke: There's a deep connection regardless. |
| 08:37:59 | <mauke> | anyway, my point is that 'f x' forces the evaluation of f without any case-of |
| 08:38:07 | <dminuoso> | Only if a case-of demands it. |
| 08:38:13 | <dminuoso> | It's really case-of that drives evaluation. |
| 08:38:37 | <mauke> | no, if you allow that argument that case-of doesn't drive evaluation either |
| 08:38:40 | <mauke> | er |
| 08:38:43 | <mauke> | s/that/then/ |
| 08:39:09 | <mauke> | because case-of only evaluates its scrutinee if the whole expression is demanded externally |
| 08:39:21 | <mauke> | (by another case-of or by application) |
| 08:39:32 | <mniip> | ultimately what drives evaluation is the case main realWorld# of (# _, _ #) -> ... |
| 08:40:45 | <mauke> | consider: seq a b = case a of _ -> b -- this is not a valid implementation of seq |
| 08:41:11 | <mniip> | is that a haskell case-of or a core case-of? |
| 08:41:19 | <mauke> | exactly :-) |
| 08:41:47 | <mniip> | also I think that would be a core lint if a was a function type |
| 08:48:54 | → | burnsidesLlama joins (~burnsides@119247164140.ctinets.com) |
| 08:49:42 | × | wrengr quits (~wrengr@201.59.83.34.bc.googleusercontent.com) (Remote host closed the connection) |
| 08:51:30 | → | machinedgod joins (~machinedg@d198-53-218-113.abhsia.telus.net) |
| 08:54:02 | <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? |
| 08:54:43 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 08:56:40 | × | king_gs quits (~Thunderbi@187.201.150.200) (Read error: Connection reset by peer) |
| 08:57:02 | → | king_gs joins (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) |
| 08:57:42 | <mauke> | yes |
| 08:58:47 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 08:59:20 | <[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 |
| 08:59:20 | <[Leary]> | s> -> <C1-result>) ...` instead of `case val of { C1 <C1-args> -> <C1-result>; ... }` for `val :: Foo`. |
| 08:59:21 | → | lortabac joins (~lortabac@2a01:e0a:541:b8f0:7f4a:7261:e423:f5a7) |
| 09:00:04 | × | crazazy[m] quits (~crazazyut@2001:470:69fc:105::2:ba2a) (Quit: You have been kicked for being idle) |
| 09:00:05 | × | UdayKiran[m] quits (~neoatnebu@2001:470:69fc:105::2:bae0) (Quit: You have been kicked for being idle) |
| 09:00:06 | × | olivermead[m] quits (~olivermea@2001:470:69fc:105::2:4289) (Quit: You have been kicked for being idle) |
| 09:00:13 | → | califax joins (~califax@user/califx) |
| 09:00:30 | <mauke> | oh, like either and bool |
| 09:01:08 | <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. |
| 09:01:39 | <dminuoso> | Especially on unary constructors |
| 09:01:41 | <dminuoso> | or nullary |
| 09:02:06 | <dminuoso> | `comparing x s t u` you cant clearly see which branch is which |
| 09:02:22 | <dminuoso> | A partial solution to this would be agda's mixfix perhaps |
| 09:03:02 | → | Guest23 joins (~Guest23@27.57.46.219) |
| 09:03:43 | → | fserucas joins (~fserucas@2001:818:e376:a400:fb92:70c1:dd88:c7d7) |
| 09:04:23 | × | lortabac quits (~lortabac@2a01:e0a:541:b8f0:7f4a:7261:e423:f5a7) (Ping timeout: 264 seconds) |
| 09:04:37 | × | tvandinther quits (~tvandinth@101.98.118.246) (Quit: Client closed) |
| 09:04:42 | <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 |
| 09:04:48 | <dminuoso> | do |
| 09:05:05 | → | coot joins (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) |
| 09:05:23 | × | jamestmartin quits (~james@jtmar.me) (Quit: ZNC 1.8.2+deb2+b1 - https://znc.in) |
| 09:05:29 | → | nut joins (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) |
| 09:05:33 | → | jamestmartin joins (~james@jtmar.me) |
| 09:05:34 | <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 |
| 09:06:20 | <dminuoso> | It's also mildly annoying that reordering the pattern matching requires doing it at all call-sites |
| 09:06:32 | <dminuoso> | (assuming incompatible types) |
| 09:06:43 | <dminuoso> | or well, even worse with compatible types, you have to find all the uses. |
| 09:11:06 | × | use-value quits (~Thunderbi@2a00:23c6:8a03:2f01:a541:ddec:fa11:d52f) (Read error: Connection reset by peer) |
| 09:12:13 | → | michalz joins (~michalz@185.246.204.87) |
| 09:15:03 | × | Guest23 quits (~Guest23@27.57.46.219) (Remote host closed the connection) |
| 09:16:12 | → | use-value joins (~Thunderbi@2a00:23c6:8a03:2f01:75c2:a71f:beaa:29bf) |
| 09:16:32 | → | lortabac joins (~lortabac@2a01:e0a:541:b8f0:a897:84c:1a93:9078) |
| 09:19:40 | ← | jakalx parts (~jakalx@base.jakalx.net) (Error from remote client) |
| 09:20:18 | <[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. |
| 09:24:51 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 09:29:49 | × | xff0x_ quits (~xff0x@125x103x176x34.ap125.ftth.ucom.ne.jp) (Ping timeout: 260 seconds) |
| 09:33:18 | Guest3515 | is now known as money |
| 09:33:51 | → | Guest23 joins (~Guest23@27.57.46.219) |
| 09:33:54 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 09:34:45 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 09:38:48 | <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 } |
| 09:39:03 | <mauke> | either xyz (Left f) (Right g) |
| 09:39:37 | → | Feuermagier joins (~Feuermagi@user/feuermagier) |
| 09:39:55 | <dminuoso> | Cunning |
| 09:40:08 | × | burnsidesLlama quits (~burnsides@119247164140.ctinets.com) (Remote host closed the connection) |
| 09:47:41 | → | RobertKrook48 joins (~RobertKro@c-fe44205c.024-139-67626724.bbcust.telenor.se) |
| 09:47:55 | × | gmg quits (~user@user/gehmehgeh) (Quit: Leaving) |
| 09:47:55 | × | tzh quits (~tzh@c-24-21-73-154.hsd1.or.comcast.net) (Quit: zzz) |
| 09:49:04 | <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? |
| 09:49:20 | <dminuoso> | The signal is sent to the RTS. |
| 09:49:32 | → | Robert42 joins (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) |
| 09:49:58 | <merijn> | "you don't want to know" |
| 09:50:05 | <dminuoso> | Heh, I was waiting for you to answer. |
| 09:50:24 | <merijn> | If this is at all relevant for your program, best rethink your program architecture now |
| 09:50:33 | <Robert42> | 'hypothetical scenario' |
| 09:51:02 | <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.) |
| 09:51:05 | <money> | Yeah |
| 09:51:13 | <merijn> | That will then send an async exception to the main thread |
| 09:51:37 | <Robert42> | Okay, thanks! |
| 09:52:01 | <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 |
| 09:52:52 | <merijn> | [citation needed] |
| 09:53:20 | <merijn> | Or maybe I should say "allegedly" |
| 09:53:33 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:44ff:72e2:5072:e2ac) (Remote host closed the connection) |
| 09:53:35 | × | king_gs quits (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) (Ping timeout: 264 seconds) |
| 09:53:43 | <dminuoso> | Can you elaborate perhaps? |
| 09:54:06 | → | nschoe joins (~q@141.101.51.197) |
| 09:54:32 | <Robert42> | Me? |
| 09:54:37 | <dminuoso> | No merijn |
| 09:54:39 | <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 :) |
| 09:55:00 | <dminuoso> | You ought to write some detailed description on this. |
| 09:55:30 | <dminuoso> | installHandler has worked fine to do cleanup on SIGINT for graceful shutdowns for me |
| 09:55:48 | <dminuoso> | To claim that this is just wishful thinking is quite a hyperbole. |
| 09:56:09 | <merijn> | dminuoso: I mean, it depends on what actual expectations you have |
| 09:56:54 | <merijn> | dminuoso: If you're just throwing an async exception at some thread, it's probably gonna always work |
| 09:57:01 | → | burnsidesLlama joins (~burnsides@119247164140.ctinets.com) |
| 09:57:30 | <merijn> | But then, you don't really have to do anything, since that's also the default configuration for SIGINT |
| 09:57:35 | <dminuoso> | Let me turn it around: What cant I expect of it? |
| 09:57:40 | → | king_gs joins (~Thunderbi@187.201.150.200) |
| 09:58:07 | <dminuoso> | Well in particular I might do things like close a socket, wait for workers to complete, and then just exit the process. |
| 09:58:43 | <Robert42> | Any experience with catch/catches in Control.Exception for catching ctrl-c? |
| 09:59:44 | <merijn> | Robert42: By default Ctrl-C just gets turned into an async exception to the main thread that works like any other async exception |
| 10:00:11 | <dminuoso> | So far I have never understood what issues you do have with say installHandler |
| 10:00:15 | <dminuoso> | What wont work? |
| 10:01:13 | <Robert42> | I never said anything won't work, I am just curious how it works |
| 10:01:32 | <dminuoso> | Robert42: Not talking to you :) |
| 10:01:42 | <Robert42> | Ah okay :P |
| 10:02:23 | <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 |
| 10:04:14 | <dminuoso> | Robert42: It doesnt receive a signal, it potentially gets an async exception thrown at it. |
| 10:04:43 | <Robert42> | Sorry, I think I am using the word signal wrong |
| 10:04:48 | <Robert42> | I get your point though |
| 10:05:08 | <Robert42> | It is eventually notified that a signal was raised (wherever) |
| 10:05:15 | <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 |
| 10:05:24 | <Robert42> | Yes, great |
| 10:05:26 | <Robert42> | That makes it clear |
| 10:05:30 | <Robert42> | Thanks |
| 10:05:47 | <dminuoso> | There's some strange edge cases (like installing a handler while a signal is in-flight) |
| 10:05:52 | × | lortabac quits (~lortabac@2a01:e0a:541:b8f0:a897:84c:1a93:9078) (Ping timeout: 252 seconds) |
| 10:06:52 | → | lortabac joins (~lortabac@2a01:e0a:541:b8f0:3891:dc8:a59a:66) |
| 10:10:59 | → | MajorBiscuit joins (~MajorBisc@145.94.137.174) |
| 10:11:51 | × | werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 256 seconds) |
| 10:12:50 | → | werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
| 10:14:24 | → | freeside joins (~mengwong@pd907d273.dip0.t-ipconnect.de) |
| 10:17:31 | → | Lord_of_Life_ joins (~Lord@user/lord-of-life/x-2819915) |
| 10:17:31 | × | king_gs quits (~Thunderbi@187.201.150.200) (Read error: Connection reset by peer) |
| 10:17:39 | × | werneta quits (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 260 seconds) |
| 10:18:07 | → | werneta joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
| 10:18:44 | → | king_gs joins (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) |
| 10:18:50 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 256 seconds) |
| 10:19:47 | × | nut quits (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Ping timeout: 256 seconds) |
| 10:20:18 | Lord_of_Life_ | is now known as Lord_of_Life |
| 10:20:28 | × | ft quits (~ft@p4fc2a257.dip0.t-ipconnect.de) (Quit: leaving) |
| 10:26:43 | × | burnsidesLlama quits (~burnsides@119247164140.ctinets.com) (Remote host closed the connection) |
| 10:27:12 | × | zer0bitz_ quits (~zer0bitz@196.244.192.57) (Read error: Connection reset by peer) |
| 10:27:13 | <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 |
| 10:27:38 | → | burnsidesLlama joins (~burnsides@119247164140.ctinets.com) |
| 10:28:28 | <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/ |
| 10:28:51 | <dminuoso> | Mmm, Ill have to benchmark mine |
| 10:29:02 | × | econo quits (uid147250@user/econo) (Quit: Connection closed for inactivity) |
| 10:29:04 | <dminuoso> | I just rotate a Seq at each character |
| 10:29:08 | × | freeside quits (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 248 seconds) |
| 10:29:11 | <dminuoso> | As a circular buffer |
| 10:30:22 | <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 |
| 10:30:45 | <dminuoso> | Mmm that's nice |
| 10:30:50 | <dminuoso> | I would probably use bytestring instead |
| 10:31:03 | <merijn> | dminuoso: Quite pleased with the simplicity: https://github.com/merijn/AdventOfCode/blob/master/Day6.hs#L12-L16 |
| 10:32:11 | × | king_gs quits (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) (Ping timeout: 265 seconds) |
| 10:33:04 | → | zer0bitz joins (~zer0bitz@196.244.192.56) |
| 10:36:45 | → | cfricke joins (~cfricke@user/cfricke) |
| 10:39:50 | × | RobertKrook48 quits (~RobertKro@c-fe44205c.024-139-67626724.bbcust.telenor.se) (Ping timeout: 255 seconds) |
| 10:40:22 | × | Robert42 quits (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) (Ping timeout: 256 seconds) |
| 10:40:53 | <dminuoso> | merijn: It's quite nice indeed. |
| 10:41:03 | <dminuoso> | Keeps nice locality of reference as well |
| 10:41:18 | <dminuoso> | I wanted to do the same, but lazyness never occured to me |
| 10:41:25 | × | cfricke quits (~cfricke@user/cfricke) (Client Quit) |
| 10:41:41 | → | freeside joins (~mengwong@pd907d273.dip0.t-ipconnect.de) |
| 10:44:06 | <aeroplane> | May I know how do you handle SIGNIT in haskell, I will be grateful if you point me to a simple example. |
| 10:44:41 | <dminuoso> | `Posix.installHandler Posix.sigINT (Posix.Catch $ io goodbye >> closeSocket) Nothing` |
| 10:45:44 | × | RedSwan quits (~jared@174-23-134-43.slkc.qwest.net) (Ping timeout: 268 seconds) |
| 10:46:25 | × | freeside quits (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 10:50:36 | <merijn> | dminuoso: 93% productivity, 44,432 max residency, so really quite nice :> |
| 10:50:59 | <merijn> | dminuoso: Not sure if there's a better way to check each chunk for doubles, though |
| 10:51:15 | <merijn> | There's probably a cleverer way, but I couldn't be arsed, since I'm behind :p |
| 10:51:25 | <dminuoso> | merijn: I would not go the lazyness route though |
| 10:51:31 | <dminuoso> | its a lot of unnecessary indirecftion that hampers reading |
| 10:52:50 | <merijn> | hmm |
| 10:53:01 | <merijn> | on the one hand, most stuff using the term "metaverse" is dumb |
| 10:53:34 | <merijn> | on the other hand, Tim Sweeney seems interested in PLT and an SPJ talk on PL for "the metaverse" might be actually interesting... |
| 10:53:40 | <merijn> | Anyone watched it yet? |
| 10:54:02 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) |
| 10:58:39 | → | dextaa6 joins (~DV@user/dextaa) |
| 10:58:45 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) (Ping timeout: 255 seconds) |
| 10:59:05 | × | burnsidesLlama quits (~burnsides@119247164140.ctinets.com) (Remote host closed the connection) |
| 11:00:37 | → | jao joins (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) |
| 11:00:56 | → | CiaoSen joins (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) |
| 11:01:02 | → | beteigeuze joins (~Thunderbi@bl14-81-220.dsl.telepac.pt) |
| 11:01:09 | × | dextaa quits (~DV@user/dextaa) (Ping timeout: 268 seconds) |
| 11:01:09 | dextaa6 | is now known as dextaa |
| 11:04:22 | × | jpds2 quits (~jpds@gateway/tor-sasl/jpds) (Remote host closed the connection) |
| 11:04:57 | × | ChaiTRex quits (~ChaiTRex@user/chaitrex) (Remote host closed the connection) |
| 11:04:58 | × | FinnElija quits (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
| 11:11:23 | → | jpds2 joins (~jpds@gateway/tor-sasl/jpds) |
| 11:11:23 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 11:11:49 | × | jonathanx__ quits (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
| 11:13:12 | <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 |
| 11:13:22 | → | FinnElija joins (~finn_elij@user/finn-elija/x-0085643) |
| 11:13:51 | → | jonathanx joins (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
| 11:13:53 | → | Jade[m] joins (~jade1024m@2001:470:69fc:105::2:d68a) |
| 11:14:32 | → | ChaiTRex joins (~ChaiTRex@user/chaitrex) |
| 11:18:48 | → | Robert75 joins (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) |
| 11:19:01 | <Robert75> | Okay I have another fun one for you merijn |
| 11:20:23 | <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? |
| 11:20:25 | × | Guest23 quits (~Guest23@27.57.46.219) (Ping timeout: 260 seconds) |
| 11:20:49 | × | Robert75 quits (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) (Remote host closed the connection) |
| 11:22:13 | → | Robert10 joins (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) |
| 11:22:14 | → | cfricke joins (~cfricke@user/cfricke) |
| 11:22:30 | <Robert10> | Sorry, I disconnected. I am not sure if my message was transmitted |
| 11:22:39 | <Robert10> | I said "I had another fun one for you @merijn) |
| 11:22:45 | <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?" |
| 11:23:32 | <merijn> | Define "always" |
| 11:23:49 | <Robert10> | Hm |
| 11:23:53 | <merijn> | and what "do-the-thing" is :p |
| 11:23:59 | <merijn> | In general: no |
| 11:24:02 | <Robert10> | The handler I installed for my own exception type, imagine that "do-the-thing" closes a socket or something |
| 11:24:10 | <merijn> | Actually, maybe? |
| 11:24:13 | <Robert10> | WIll the socket always close if my own exception is thrown before killthread? |
| 11:24:18 | <merijn> | I think catch runs with async masked? |
| 11:24:25 | <Robert10> | before the exception thrown by killthread is handled* |
| 11:24:53 | <merijn> | Robert10: Why even have 2 exceptions? |
| 11:25:02 | <merijn> | killThread literally just throws an async exception |
| 11:25:13 | <merijn> | Just use finally instead of catch and killThread only? |
| 11:25:22 | <merijn> | :t Control.Exception.finally |
| 11:25:23 | <lambdabot> | IO a -> IO b -> IO a |
| 11:26:32 | <Robert10> | Hm, I guess `onException` is more in line with what I want |
| 11:26:40 | <Robert10> | But yes, that is a great suggestion |
| 11:26:50 | × | nschoe quits (~q@141.101.51.197) (Ping timeout: 256 seconds) |
| 11:29:26 | <dminuoso> | merijn: https://gist.github.com/dminuoso/cf4ffb90aa48c82cf8e4946e941c5940 |
| 11:29:28 | <dminuoso> | Is what Im thinking |
| 11:29:56 | → | burnsidesLlama joins (~burnsides@119247164140.ctinets.com) |
| 11:30:18 | <dminuoso> | Might need some minimal tweaking, but in principle I think this is as performant as you can make it |
| 11:31:30 | <dminuoso> | Probably best with -XStrict |
| 11:32:35 | <dminuoso> | At least for relatively small inputs since this is just a linear scan |
| 11:33:19 | <dminuoso> | But given that this is tight loop, catch line prefetching should kick in nicely |
| 11:34:04 | <dminuoso> | merijn: One thing strikes me very odd, is your use of a set. |
| 11:34:39 | × | burnsidesLlama quits (~burnsides@119247164140.ctinets.com) (Ping timeout: 260 seconds) |
| 11:34:43 | <dminuoso> | actually with this in mind, my code will perform faster at any window sizse (since you need to linearly scan each windo anyway) |
| 11:35:31 | → | burnsidesLlama joins (~burnsides@119247164140.ctinets.com) |
| 11:40:34 | × | califax quits (~califax@user/califx) (Quit: ZNC 1.8.2 - https://znc.in) |
| 11:41:23 | → | califax joins (~califax@user/califx) |
| 11:41:36 | → | Katarushisu4 joins (~Katarushi@cpc147790-finc20-2-0-cust502.4-2.cable.virginm.net) |
| 11:42:42 | × | Katarushisu quits (~Katarushi@cpc147790-finc20-2-0-cust502.4-2.cable.virginm.net) (Ping timeout: 256 seconds) |
| 11:42:42 | Katarushisu4 | is now known as Katarushisu |
| 11:49:53 | × | chomwitt quits (~chomwitt@2a02:587:7a05:dc00:1ac0:4dff:fedb:a3f1) (Ping timeout: 256 seconds) |
| 11:51:34 | × | troydm quits (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 260 seconds) |
| 11:57:54 | → | sterni joins (~lukas@user/sterni) |
| 12:03:00 | → | Guest23 joins (~Guest23@27.57.46.219) |
| 12:03:46 | <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 |
| 12:03:52 | <dminuoso> | *quickly enough |
| 12:04:08 | × | Guest23 quits (~Guest23@27.57.46.219) (Client Quit) |
| 12:08:04 | × | burnsidesLlama quits (~burnsides@119247164140.ctinets.com) (Remote host closed the connection) |
| 12:08:37 | → | chomwitt joins (~chomwitt@ppp-94-69-55-246.home.otenet.gr) |
| 12:08:40 | → | burnsidesLlama joins (~burnsides@138.199.22.99) |
| 12:09:29 | × | califax quits (~califax@user/califx) (Ping timeout: 255 seconds) |
| 12:09:56 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 255 seconds) |
| 12:10:40 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 12:10:47 | → | califax joins (~califax@user/califx) |
| 12:16:15 | <dminuoso> | Same for productivity I guess |
| 12:16:45 | <dminuoso> | (which could indicate you are doing a lot of unnessary work) |
| 12:16:59 | × | CiaoSen quits (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 246 seconds) |
| 12:20:44 | × | Robert10 quits (~Robert@c-fe44205c.024-139-67626724.bbcust.telenor.se) (Ping timeout: 260 seconds) |
| 12:21:39 | × | mmhat quits (~mmh@p200300f1c73901ceee086bfffe095315.dip0.t-ipconnect.de) (Ping timeout: 260 seconds) |
| 12:22:01 | → | mmhat joins (~mmh@p200300f1c7390125ee086bfffe095315.dip0.t-ipconnect.de) |
| 12:31:33 | → | freeside joins (~mengwong@pd907d273.dip0.t-ipconnect.de) |
| 12:48:38 | <merijn> | dminuoso: What do you do? Write an individual scan? |
| 12:49:00 | <merijn> | I was gonna do some early bail out on detecting duplicates, but it was so fast this way I didn't bother |
| 12:49:44 | <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 |
| 12:51:03 | → | Guest23 joins (~Guest23@27.57.46.219) |
| 12:51:07 | <dminuoso> | merijn: Well it is essentially a linear scan in memory, yes |
| 12:52:21 | <merijn> | dminuoso: The logic for an *efficient* early bail out for duplicates just seemed annoying to write :p |
| 12:55:37 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) |
| 12:58:44 | <dminuoso> | merijn: Dunno, didnt seem annoying to me *shrugs* |
| 12:59:12 | → | shapr joins (~user@68.54.166.125) |
| 12:59:53 | × | coot quits (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Quit: coot) |
| 13:00:10 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) (Ping timeout: 260 seconds) |
| 13:00:38 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 13:00:55 | × | AlexZenon quits (~alzenon@178.34.161.14) (Quit: ;-) |
| 13:01:14 | × | Alex_test quits (~al_test@178.34.161.14) (Quit: ;-) |
| 13:01:37 | × | AlexNoo quits (~AlexNoo@178.34.161.14) (Quit: Leaving) |
| 13:01:42 | → | nschoe joins (~q@141.101.51.197) |
| 13:02:29 | → | shriekingnoise joins (~shrieking@186.137.167.202) |
| 13:06:11 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds) |
| 13:10:11 | × | emergence quits (emergence@2607:5300:60:5910:dcad:beff:feef:5bc) (Quit: Ping timeout (120 seconds)) |
| 13:10:25 | → | emergence joins (emergence@2607:5300:60:5910:dcad:beff:feef:5bc) |
| 13:12:07 | → | mikoto-chan joins (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
| 13:12:25 | → | AlexNoo joins (~AlexNoo@178.34.161.14) |
| 13:17:11 | → | AlexZenon joins (~alzenon@178.34.161.14) |
| 13:17:20 | × | mikoto-chan quits (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 256 seconds) |
| 13:22:09 | → | Alex_test joins (~al_test@178.34.161.14) |
| 13:24:22 | → | mikoto-chan joins (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
| 13:25:49 | <merijn> | yegh |
| 13:26:04 | <merijn> | I thought I could reuse last years nice convolution for day 8, but that doesn't quite work |
| 13:26:47 | → | xff0x_ joins (~xff0x@ai071162.d.east.v6connect.net) |
| 13:30:56 | × | freeside quits (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 13:31:59 | × | jmdaemon quits (~jmdaemon@user/jmdaemon) (Ping timeout: 265 seconds) |
| 13:33:41 | × | burnsidesLlama quits (~burnsides@138.199.22.99) (Remote host closed the connection) |
| 13:34:38 | → | burnsidesLlama joins (~burnsides@138.199.22.99) |
| 13:35:49 | → | coot joins (~coot@213.134.171.3) |
| 13:38:54 | × | burnsidesLlama quits (~burnsides@138.199.22.99) (Ping timeout: 260 seconds) |
| 13:42:47 | → | freeside joins (~mengwong@pd907d273.dip0.t-ipconnect.de) |
| 13:44:34 | → | irrgit joins (~irrgit@146.70.27.218) |
| 13:45:41 | × | irrgit__ quits (~irrgit@176.113.74.74) (Quit: Leaving) |
| 13:46:14 | → | CiaoSen joins (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) |
| 14:00:20 | → | thegeekinside joins (~thegeekin@189.217.82.244) |
| 14:04:52 | × | lisbeths quits (uid135845@id-135845.lymington.irccloud.com) (Quit: Connection closed for inactivity) |
| 14:06:42 | → | thyriaen joins (~thyriaen@2a01:aea0:dd4:4bae:6245:cbff:fe9f:48b1) |
| 14:07:33 | → | Erutuon_ joins (~Erutuon@user/erutuon) |
| 14:10:39 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 14:10:47 | × | fizbin quits (~fizbin@user/fizbin) (Ping timeout: 246 seconds) |
| 14:11:44 | × | mikoto-chan quits (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 256 seconds) |
| 14:12:23 | × | Erutuon_ quits (~Erutuon@user/erutuon) (Ping timeout: 260 seconds) |
| 14:13:34 | → | mikoto-chan joins (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
| 14:14:46 | → | Erutuon_ joins (~Erutuon@user/erutuon) |
| 14:15:57 | × | festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed) |
| 14:17:26 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 14:18:08 | × | razetime quits (~quassel@49.207.203.213) (Ping timeout: 252 seconds) |
| 14:20:33 | × | niko quits (niko@libera/staff/niko) (Ping timeout: 615 seconds) |
| 14:21:20 | × | jpds2 quits (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 255 seconds) |
| 14:23:17 | → | jpds2 joins (~jpds@gateway/tor-sasl/jpds) |
| 14:23:55 | × | Guest23 quits (~Guest23@27.57.46.219) (Ping timeout: 260 seconds) |
| 14:24:02 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Ping timeout: 255 seconds) |
| 14:26:23 | × | festive_kurbus quits (~festive_k@user/kurbus) (Ping timeout: 260 seconds) |
| 14:31:34 | <merijn> | Wait...it *is* a convolution, I'm just thinking wrong |
| 14:33:40 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 14:34:00 | × | mncheckm quits (~mncheck@193.224.205.254) (Remote host closed the connection) |
| 14:37:14 | × | mikoto-chan quits (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 256 seconds) |
| 14:39:11 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 14:41:09 | → | mikoto-chan joins (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
| 14:42:05 | → | motherfsck joins (~motherfsc@user/motherfsck) |
| 14:43:13 | × | motherfsck quits (~motherfsc@user/motherfsck) (Client Quit) |
| 14:43:33 | → | motherfsck joins (~motherfsc@user/motherfsck) |
| 14:46:25 | × | freeside quits (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 265 seconds) |
| 14:48:54 | <dminuoso> | Can someone explain to me where `Typeable t` comes from? https://gist.github.com/dminuoso/f4025f0d06d685f3f2104a6c65b5a7ad |
| 14:49:07 | <dminuoso> | It's not a superclass of my SwaggerOptions helper class, Im a bit baffled |
| 14:52:36 | <[Leary]> | superclass of ToSchema? |
| 14:53:01 | <dminuoso> | `class Typeable a => ToSchema a where` |
| 14:53:13 | <dminuoso> | So how is this asking for `Typeable t`, rather than `Typeable (CustomSchema t a)`? |
| 14:54:08 | <[Leary]> | That's implied by concreteness of CustomSchema ... if it already knows `Typeable a` from the context. |
| 14:54:36 | ← | jakalx parts (~jakalx@base.jakalx.net) (Error from remote client) |
| 14:54:56 | <mniip> | dminuoso, the automatically generated instance is (Typeable t, Typeable a) => Typeable (CustomSchema t a) |
| 14:55:14 | <dminuoso> | mniip: Without any `deriving Typeable`? |
| 14:55:23 | <mniip> | yup |
| 14:55:27 | <dminuoso> | Oh wow. Okay. |
| 14:55:31 | <mniip> | that's how Typeable work as of... ghc 8? |
| 14:55:43 | dminuoso | readies his sed |
| 14:55:55 | <mniip> | 7.10 even |
| 14:56:23 | <dminuoso> | Even type error slicing would have been difficult with a hidden generated typeclass instance |
| 14:56:29 | <dminuoso> | But oh well, thanks for the pointer |
| 14:57:08 | → | razetime joins (~quassel@49.207.203.213) |
| 15:00:09 | → | freeside joins (~mengwong@pd907d273.dip0.t-ipconnect.de) |
| 15:01:14 | → | mncheck joins (~mncheck@193.224.205.254) |
| 15:02:16 | × | mncheck quits (~mncheck@193.224.205.254) (Remote host closed the connection) |
| 15:02:19 | × | kritzefitz quits (~kritzefit@debian/kritzefitz) (Ping timeout: 260 seconds) |
| 15:02:53 | → | mncheckm joins (~mncheck@193.224.205.254) |
| 15:03:51 | × | cfricke quits (~cfricke@user/cfricke) (Quit: WeeChat 3.7.1) |
| 15:04:09 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 15:05:00 | × | freeside quits (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 15:06:37 | × | Feuermagier quits (~Feuermagi@user/feuermagier) (Quit: Leaving) |
| 15:07:10 | → | doyougnu joins (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) |
| 15:07:50 | × | mikoto-chan quits (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 256 seconds) |
| 15:10:01 | → | Lycurgus joins (~juan@user/Lycurgus) |
| 15:10:35 | ← | jakalx parts (~jakalx@base.jakalx.net) () |
| 15:11:13 | × | Ranhir quits (~Ranhir@157.97.53.139) (Read error: Connection reset by peer) |
| 15:12:28 | × | festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed) |
| 15:14:25 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 15:15:02 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 15:17:20 | → | freeside joins (~mengwong@pd907d273.dip0.t-ipconnect.de) |
| 15:26:48 | × | festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed) |
| 15:27:55 | → | bgs joins (~bgs@212-85-160-171.dynamic.telemach.net) |
| 15:28:37 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 15:28:59 | → | dcoutts joins (~duncan@host86-151-44-212.range86-151.btcentralplus.com) |
| 15:30:17 | → | Daelyte joins (~Icecoldfr@2607:fea8:680:1070:f98a:1300:69ec:7b77) |
| 15:31:57 | × | Daelyte quits (~Icecoldfr@2607:fea8:680:1070:f98a:1300:69ec:7b77) (Remote host closed the connection) |
| 15:34:13 | → | Unicorn_Princess joins (~Unicorn_P@user/Unicorn-Princess/x-3540542) |
| 15:34:43 | × | dsrt^ quits (~dsrt@76.145.185.103) (Remote host closed the connection) |
| 15:37:54 | → | Barfolomew joins (~Barfolome@2a0a-a546-5b20-1-7fee-17bd-2c6b-c767.ipv6dyn.netcologne.de) |
| 15:39:46 | <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 |
| 15:40:04 | → | sadmax joins (~user@209.205.174.253) |
| 15:40:26 | → | Ranhir joins (~Ranhir@157.97.53.139) |
| 15:40:46 | → | kritzefitz joins (~kritzefit@debian/kritzefitz) |
| 15:40:47 | → | Guest23 joins (~Guest23@27.57.46.219) |
| 15:41:36 | <merijn> | Barfolomew: I mean, that example doesn't really make sense, imo? |
| 15:42:08 | × | Lycurgus quits (~juan@user/Lycurgus) (Quit: Exeunt: https://tinyurl.com/4m8d4kd5) |
| 15:42:17 | <merijn> | Barfolomew: That code would "just work" if you deleted the fundep and fixed you instance to be "instance Less Simple t where" |
| 15:43:14 | <merijn> | as-is it can't work, since in the class definition 'less' has kind '* -> *', but "Simple t" in the instance declaration has kind * |
| 15:44:10 | <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. ;) |
| 15:45:15 | × | Digit quits (~user@user/digit) (Ping timeout: 260 seconds) |
| 15:46:17 | → | mikoto-chan joins (~mikoto-ch@85-76-2-122-nat.elisa-mobile.fi) |
| 15:46:35 | <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’”. |
| 15:46:56 | × | cheater quits (~Username@user/cheater) (Ping timeout: 256 seconds) |
| 15:46:56 | → | cheater1__ joins (~Username@user/cheater) |
| 15:47:00 | cheater1__ | is now known as cheater |
| 15:47:11 | <merijn> | Barfolomew: Does it say some stuff about FlexibleInstances? |
| 15:47:41 | <merijn> | (in the error) |
| 15:47:48 | <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.) |
| 15:47:52 | <Barfolomew> | merijn: Yes, it does |
| 15:48:06 | <merijn> | Barfolomew: Yeah, just enable FlexibleInstances and it'll work |
| 15:48:32 | <merijn> | Barfolomew: The Haskell Report is...overly strict in what you are allowed to write in instance definitions |
| 15:49:19 | <merijn> | FlexibleInstances basically stops adhering strictly to the Haskell2010 report limitations of instance definitions |
| 15:50:05 | <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 ;) |
| 15:50:34 | <Barfolomew> | merijn: I enabled FlexibleInstance and MultiParamTypeClasses (but not FuctionalDependencies), (and added the `Num t =>` to `f`, and now it compiles. |
| 15:51:07 | × | festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed) |
| 15:51:33 | <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? |
| 15:52:04 | <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) |
| 15:52:30 | → | nut joins (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) |
| 15:52:42 | <merijn> | Barfolomew: You are misremembering, FlexibleInstances/FlexibleContexts are completely benign |
| 15:52:59 | <merijn> | Barfolomew: Possibly thinking of OverlappingInstances |
| 15:54:26 | <merijn> | There are only a handful of extensions that can lead to runtime problems |
| 15:54:47 | × | mikoto-chan quits (~mikoto-ch@85-76-2-122-nat.elisa-mobile.fi) (Read error: Connection reset by peer) |
| 15:57:19 | <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 … |
| 15:58:15 | → | Sgeo joins (~Sgeo@user/sgeo) |
| 15:58:17 | <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) |
| 15:58:17 | → | eggplantade joins (~Eggplanta@104-55-37-220.lightspeed.sntcca.sbcglobal.net) |
| 15:58:18 | <Barfolomew> | merijn: E.g. I had assumed, I could write `https://pastes.io/dpetdeuokq` |
| 15:58:32 | <Barfolomew> | Oops, wrong paste |
| 15:59:18 | <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. |
| 15:59:48 | <merijn> | Barfolomew: You'd have to change your class definition |
| 15:59:55 | <Jade[m]> | is there something like `Glyph-Haskell` which essentially has a custom prelude or other modules that exports unicode alternatives for functions? |
| 15:59:55 | <Jade[m]> | If not I think I'd want to make that just for fun |
| 16:00:22 | <merijn> | Jade[m]: There is already unicode syntax for a bunch of stuff like forall and arrows |
| 16:00:31 | <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”. |
| 16:00:32 | × | aeroplane quits (~user@user/aeroplane) (Read error: Connection reset by peer) |
| 16:00:32 | <merijn> | Jade[m]: Check the manual on the UnicodeSyntax extension |
| 16:00:47 | <Jade[m]> | Will look into it, thanks |
| 16:00:49 | → | mikoto-chan joins (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
| 16:00:49 | <merijn> | Barfolomew: It's not dangerous so much, as it leads to questionable code |
| 16:01:18 | × | sadmax quits (~user@209.205.174.253) (Read error: No route to host) |
| 16:01:22 | × | xsarnik quits (xsarnik@lounge.fi.muni.cz) (Quit: Ping timeout (120 seconds)) |
| 16:01:23 | × | xstill_ quits (xstill@fimu/xstill) (Quit: Ping timeout (120 seconds)) |
| 16:01:53 | <merijn> | Barfolomew: The "right" FunDeps approach would be like: https://paste.tomsmeding.com/KzLhaKPn |
| 16:02:05 | <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 |
| 16:02:17 | <merijn> | Barfolomew: i.e. don't parameterise the less type in the class |
| 16:02:45 | <merijn> | Jade[m]: Probably someone has already made something like that, but don't let that stop you ;) |
| 16:02:59 | × | eggplantade quits (~Eggplanta@104-55-37-220.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds) |
| 16:03:06 | <EvanR> | thy code is unclean |
| 16:03:12 | <merijn> | You can disable/hide the standard Prelude fairly easily |
| 16:03:16 | <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? |
| 16:04:14 | × | Guest23 quits (~Guest23@27.57.46.219) (Ping timeout: 265 seconds) |
| 16:05:33 | <merijn> | Barfolomew: It does, though? |
| 16:06:02 | <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? |
| 16:06:08 | <Barfolomew> | *still |
| 16:06:53 | <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? |
| 16:06:59 | <Jade[m]> | https://hackage.haskell.org/package/base-unicode-symbols |
| 16:06:59 | <Jade[m]> | Seems to already do a lot but I want to continue this ad absurdum |
| 16:07:09 | <merijn> | Barfolomew: https://paste.tomsmeding.com/XhtW4eBa |
| 16:07:33 | <EvanR> | emoji haskell |
| 16:07:44 | <merijn> | Note that'd be more sensible to move the Num constraint on t into the Less class |
| 16:08:07 | <Jade[m]> | > <@jade1024:matrix.org> https://hackage.haskell.org/package/base-unicode-symbols |
| 16:08:07 | <Jade[m]> | > Seems to already do a lot but I want to continue this ad absurdum |
| 16:08:07 | <Jade[m]> | This essentially unicodifies all "mathy" symbols |
| 16:08:09 | <lambdabot> | <hint>:1:1: error: parse error on input ‘<@’ |
| 16:08:09 | <lambdabot> | error: |
| 16:08:09 | <lambdabot> | Unexpected do block in function application: |
| 16:08:09 | <lambdabot> | do a lot but I want to continue this ad absurdum |
| 16:08:11 | <Jade[m]> | > <@jade1024:matrix.org> https://hackage.haskell.org/package/base-unicode-symbols |
| 16:08:11 | <Jade[m]> | > Seems to already do a lot but I want to continue this ad absurdum |
| 16:08:11 | <Jade[m]> | * This essentially unicodifies all "mathy" symbols, nothing beyond |
| 16:08:12 | <merijn> | Barfolomew: No, with the fundeps approach you pass a type of kind * as the argument for less |
| 16:08:12 | <lambdabot> | <hint>:1:1: error: parse error on input ‘<@’ |
| 16:08:13 | <lambdabot> | error: |
| 16:08:13 | <lambdabot> | Unexpected do block in function application: |
| 16:08:15 | <lambdabot> | do a lot but I want to continue this ad absurdum |
| 16:08:23 | <Barfolomew> | merijn: How does babby^Wcode work?? How girl^Wtype get pregnant^Waccepted? XD |
| 16:08:45 | <Barfolomew> | merijn: Aah, OK, I think it finally clicked. |
| 16:08:50 | <merijn> | Barfolomew: the fundeps says that the type of 't' is determined by type 'less' |
| 16:09:00 | <merijn> | Barfolomew: So in "instance Less (Simple1 t) t where |
| 16:09:01 | <merijn> | " |
| 16:09:05 | → | sadmax joins (~user@209.205.174.253) |
| 16:09:10 | → | Digitteknohippie joins (~user@user/digit) |
| 16:09:14 | <Barfolomew> | merijn: Fundeps = “You don’t need to specify the type parameters anymore, since they are uniquely determined.” |
| 16:09:44 | <merijn> | Barfolomew: Well, you need a relation between the type of the first and second argument of 'f' |
| 16:09:54 | <merijn> | One way to do that is to have it as explicit parameter |
| 16:10:16 | <Barfolomew> | Barfolomew: I really hate that I get older and can’t just “see” these things anymore. :-/ … Stupid candy addiction… |
| 16:10:18 | <merijn> | The other way to do it is to say that 't' is uniquely determined by 'less' and therefore they are still linked |
| 16:12:41 | → | bontaq joins (~user@ool-45779fe5.dyn.optonline.net) |
| 16:13:14 | → | fizbin joins (~fizbin@user/fizbin) |
| 16:13:23 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 16:14:21 | × | mmhat quits (~mmh@p200300f1c7390125ee086bfffe095315.dip0.t-ipconnect.de) (Quit: WeeChat 3.7.1) |
| 16:21:18 | ← | L29Ah parts (~L29Ah@wikipedia/L29Ah) (Disconnected: Replaced by new connection) |
| 16:21:31 | → | L29Ah joins (~L29Ah@wikipedia/L29Ah) |
| 16:23:00 | <Jade[m]> | I wish you could use a prime (`'`) with infix operators |
| 16:24:31 | × | lortabac quits (~lortabac@2a01:e0a:541:b8f0:3891:dc8:a59a:66) (Quit: WeeChat 2.8) |
| 16:24:53 | <probie> | Jade[m]: you can use the actual prime character from the math block in unicode |
| 16:25:59 | <Jade[m]> | oh that's neat |
| 16:26:01 | <Jade[m]> | thanks |
| 16:26:06 | <probie> | e.g. (+′) is a valid identifier |
| 16:27:01 | <Jade[m]> | thanks! |
| 16:30:56 | → | j4cc3b joins (~jeffreybe@pool-74-105-2-138.nwrknj.fios.verizon.net) |
| 16:31:21 | <Jade[m]> | The big problem with a full unicode prelude is unary functions |
| 16:31:42 | <Jade[m]> | because unicode unary functions are just bad if you have to paranthesize them everytime |
| 16:32:09 | × | nut quits (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Ping timeout: 260 seconds) |
| 16:32:09 | <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… |
| 16:32:49 | × | CiaoSen quits (~Jura@p200300c95747e0002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Quit: CiaoSen) |
| 16:33:41 | <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. :/) |
| 16:36:32 | <merijn> | Barfolomew: Usually what people do is add a dummy argument that lets you infer t |
| 16:36:38 | <merijn> | Or avoid MPTCs :p |
| 16:36:56 | <c_wraith> | Or just write a second class |
| 16:37:24 | × | cheater quits (~Username@user/cheater) (Ping timeout: 260 seconds) |
| 16:37:35 | → | cheater joins (~Username@user/cheater) |
| 16:39:49 | <merijn> | Or no class at all :p |
| 16:40:04 | → | ph88 joins (~ph88@2a02:8109:9e00:71d0:1467:6d51:6255:a37) |
| 16:40:24 | <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 |
| 16:40:24 | <Barfolomew> | into Unicode rehab. ;) |
| 16:41:37 | <Barfolomew> | merijn: Oh trust me, it’s winter, I’m at home, … I already have no class whatsoever. ;) |
| 16:42:02 | <geekosaur> | ′ is U+2032 |
| 16:42:10 | <EvanR> | Jade[m], even worse, all functions in haskell are unary, making me question this entire thing |
| 16:42:28 | × | Kaiepi quits (~Kaiepi@108.175.84.104) (Ping timeout: 248 seconds) |
| 16:44:20 | × | Digitteknohippie quits (~user@user/digit) (Quit: ERC (IRC client for Emacs 27.1)) |
| 16:45:19 | → | Digit joins (~user@user/digit) |
| 16:45:25 | <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. |
| 16:45:59 | → | nut joins (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) |
| 16:46:06 | <EvanR> | phantom? |
| 16:46:12 | × | freeside quits (~mengwong@pd907d273.dip0.t-ipconnect.de) (Ping timeout: 248 seconds) |
| 16:46:24 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 16:46:27 | <Jade[m]> | Oh yeah, yeah I know |
| 16:46:52 | <Jade[m]> | But with "unary" I mean `a -> b` where `b` is not a function |
| 16:47:15 | <EvanR> | redesign haskell so it only has binary operations, then we can live in the promised land of operators everywhere |
| 16:47:31 | <Jade[m]> | haha, just make it into APL |
| 16:47:35 | <probie> | Or just become Agda and have full mixfix functions |
| 16:47:41 | <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. |
| 16:48:04 | <EvanR> | unsafeUnutterablePerformIO |
| 16:48:10 | <EvanR> | or something |
| 16:48:25 | <Barfolomew> | EvanR: That’s what I was thinking of, yeah. :) |
| 16:48:40 | <probie> | You're not living life on the edge until you've needed `unsafeCoerce unsafeCoerce` |
| 16:48:51 | <EvanR> | o_O |
| 16:49:14 | <EvanR> | that's unsafe^2 + 2unsafeCoerce + coerce^2 |
| 16:49:34 | <c_wraith> | one time I wrote f = unsafeCoerce . g . unsafeCoerce |
| 16:49:45 | → | califax joins (~califax@user/califx) |
| 16:49:58 | <c_wraith> | then I looked at it for a minute and went "I feel dumb" and changed it to f = unsafeCoerce g |
| 16:50:20 | <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 |
| 16:50:32 | <probie> | s/an a/an/ |
| 16:50:43 | <EvanR> | main = fix unsafeCoerce |
| 16:50:51 | <c_wraith> | is it broken? |
| 16:50:55 | <Jade[m]> | help |
| 16:51:08 | <EvanR> | it is now |
| 16:51:40 | <Jade[m]> | EvanR: `let fix' = unsafeCoerce fix in fix' unsafeCoerce` |
| 16:53:32 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 246 seconds) |
| 16:55:41 | → | AndreasK joins (sid320732@id-320732.uxbridge.irccloud.com) |
| 16:56:47 | <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 |
| 16:56:48 | <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! ;) |
| 16:58:44 | × | sadmax quits (~user@209.205.174.253) (Ping timeout: 255 seconds) |
| 17:00:47 | <Jade[m]> | > Now if only ChatGPT was actually an AI |
| 17:00:49 | <Jade[m]> | hm? |
| 17:00:49 | <lambdabot> | <hint>:1:39: error: |
| 17:00:49 | <lambdabot> | parse error (possibly incorrect indentation or mismatched brackets) |
| 17:01:35 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 17:01:38 | <Barfolomew> | Jade[m]: Hm? |
| 17:01:48 | → | Kaiepi joins (~Kaiepi@108.175.84.104) |
| 17:02:13 | <Jade[m]> | What do you mean by ChatGPT not being an actual AI? |
| 17:04:00 | <EvanR> | actual AI |
| 17:04:47 | <EvanR> | Barfolomew, that xkcd about the butterfly effect kind of trumps all |
| 17:04:52 | → | econo joins (uid147250@user/econo) |
| 17:05:16 | <Jade[m]> | I still don't get it |
| 17:05:29 | <geekosaur> | struck me as a well trained markov bot, not an ai as such |
| 17:07:20 | <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. |
| 17:07:25 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 17:07:28 | <darkling> | ... but then we don't really need more of those. |
| 17:07:57 | <EvanR> | so you're saying by using one for understand would be a break even |
| 17:08:01 | <EvanR> | undergrad |
| 17:08:07 | <Jade[m]> | ah yes |
| 17:08:22 | <EvanR> | I could have saved myself a lot of stress |
| 17:08:23 | <Jade[m]> | that makes sense I suppose but it strikes me to go beyond recreation a little |
| 17:08:24 | <darkling> | Undergrads can improve with feedback. :) |
| 17:08:37 | <Jade[m]> | though it recreates a lot i agree |
| 17:08:57 | <darkling> | It gets a lot badly wrong, but makes it look plausible. |
| 17:09:13 | <Jade[m]> | hm yeah |
| 17:09:23 | <Jade[m]> | I still think it's pretty cool |
| 17:09:31 | <Jade[m]> | but then again it's by elon musk so ... |
| 17:09:35 | <EvanR> | next step in AI is a thing to identify the previous generation to save the TA time |
| 17:09:36 | <Jade[m]> | yeah ..... |
| 17:09:43 | × | festive_kurbus quits (~festive_k@user/kurbus) (Ping timeout: 260 seconds) |
| 17:09:54 | × | mjs2600 quits (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) (Quit: ZNC 1.8.2 - https://znc.in) |
| 17:10:20 | <EvanR> | repeat the process to cause artificial evolution |
| 17:10:32 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 17:10:37 | <EvanR> | AI arms race |
| 17:11:01 | <Jade[m]> | Which AI can destroy humanity faster??? |
| 17:11:11 | <festive_kurbus> | sir this is a wendys |
| 17:11:27 | → | mjs2600 joins (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) |
| 17:12:05 | <geekosaur> | so you'[re saying add some bacon? |
| 17:13:05 | <darkling> | That usually improves things, IMO. |
| 17:13:27 | <Jade[m]> | AI + bacon |
| 17:13:37 | <darkling> | baicon |
| 17:13:48 | <Jade[m]> | the crossover we didn't want but needed |
| 17:15:58 | <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 |
| 17:15:58 | <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 |
| 17:15:59 | <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 |
| 17:15:59 | <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. :) |
| 17:16:42 | <Jade[m]> | ok yeah I get that |
| 17:16:52 | <Barfolomew> | 🤣 |
| 17:17:09 | <Jade[m]> | so your argument is that the term AI itself has been bastardized to refer to nn's when they are _not_ intelligent |
| 17:17:12 | <Barfolomew> | (Note: I still like neural networks and think they are quite useful. ) |
| 17:17:16 | <Jade[m]> | got it and agree 👍️ |
| 17:17:41 | → | eggplantade joins (~Eggplanta@104-55-37-220.lightspeed.sntcca.sbcglobal.net) |
| 17:17:41 | <Barfolomew> | Jade[m]: Yeah, the term has been destroyed. Just like “Energy” in esoteric circles. |
| 17:17:49 | <Jade[m]> | hahaha |
| 17:17:53 | <Barfolomew> | Or “Hacker”, for that matter. |
| 17:18:17 | <Jade[m]> | I just think about how nn's are just a function being minimized |
| 17:18:25 | <Barfolomew> | I’m all for creating an *actual* AI though. |
| 17:18:27 | <Jade[m]> | that's how I "reason" about it |
| 17:18:46 | <Jade[m]> | Barfolomew: that'd be a self modifying nn? |
| 17:19:21 | <Barfolomew> | Interesting insight. Yeah, minimized is a nice way to see it. But to make an analogy to compression: *lossy* |
| 17:19:22 | <Jade[m]> | not neccesarily nn i guess |
| 17:19:23 | <Jade[m]> | but some sort of self modification? |
| 17:19:34 | <Jade[m]> | haha yeah |
| 17:19:45 | → | tzh joins (~tzh@c-24-21-73-154.hsd1.wa.comcast.net) |
| 17:20:14 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 17:20:17 | → | gmg joins (~user@user/gehmehgeh) |
| 17:20:18 | <geekosaur> | I think a neural network compares to intelligence about the way a sea sponge's neurons compare to a human brain |
| 17:20:31 | <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. 😇 |
| 17:20:46 | <Barfolomew> | geekosaur: Hey, don’t insult sea sponges like that! |
| 17:21:14 | <geekosaur> | neh, the relationship is there. it's just a really long way off from actual intelligence |
| 17:21:41 | <geekosaur> | \problem is, you get an actual artificial intelligence, it'll promptly write chatgpt to think for it 🙂 |
| 17:21:47 | <EvanR> | energy in esoteric circles like physics |
| 17:22:04 | → | troydm joins (~troydm@host-176-37-124-197.b025.la.net.ua) |
| 17:22:09 | <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.) |
| 17:22:31 | <Jade[m]> | Barfolomew: The way we can _already_ see societies biases being part of nn's I don't want a "real" AI |
| 17:22:32 | <Jade[m]> | because if an AI was anything like humanity then it'd be terrible ... |
| 17:22:42 | × | acidjnk quits (~acidjnk@p200300d6e7137a35c0a7281abf493a9c.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 17:23:16 | × | mikoto-chan quits (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 256 seconds) |
| 17:23:46 | <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* ;) |
| 17:23:55 | → | Guest23 joins (~Guest23@27.57.46.219) |
| 17:24:17 | <EvanR> | that doesn't sound right at all |
| 17:24:27 | <EvanR> | I'd be surprised sabine said that |
| 17:25:35 | <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. |
| 17:26:09 | <ggVGc> | what are you basing that on Barfolomew? |
| 17:26:11 | <Barfolomew> | EvanR: She did. Both the creation myth thing and the string theory thing. Many times. |
| 17:26:31 | <Barfolomew> | ggVGc What do you mean? The bias thign? |
| 17:26:37 | <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 |
| 17:26:48 | <ggVGc> | that string theory is pseudoscience |
| 17:26:53 | <ggVGc> | what is pseudo about it? |
| 17:27:18 | <Hecate> | ggVGc is an excellent vim command |
| 17:27:25 | <EvanR> | Barfolomew, if so, I'm chalking that one up to outrage marketing for youtube hits |
| 17:27:25 | <ggVGc> | at this level of physics it's all quite weird shit, and nothing is really verifiable yet |
| 17:27:43 | × | festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed) |
| 17:28:00 | <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 :) |
| 17:28:40 | <ggVGc> | aw man, Heroku has finally killed my site hosting the conversation from a decade ago about this nickk |
| 17:28:42 | <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. |
| 17:29:16 | <ggVGc> | that's a strange definition of pseudo-science to me |
| 17:29:19 | <EvanR> | string theory impossible to test is 2010s troll position |
| 17:29:30 | <ggVGc> | it's very much based on mathematical models, and well accepted physics |
| 17:29:35 | <Barfolomew> | ggVGc: wayback machine @ archive.org? |
| 17:29:38 | <ggVGc> | rather than random made up stuff |
| 17:30:09 | <_________> | loop haskell gravity ftw |
| 17:30:13 | <ggVGc> | what I'm saying is, just because something is hard/currently impossible to experimentally test, doesn't make it not-science |
| 17:30:16 | → | mikoto-chan joins (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) |
| 17:30:40 | <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.:) |
| 17:31:02 | <ggVGc> | anyway, I'm still at quantum harmonic oscillators, so a while to go before I can really comment on string theory I guess |
| 17:32:24 | <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. |
| 17:33:03 | <EvanR> | OKAAAAAY |
| 17:33:21 | <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 |
| 17:33:35 | <EvanR> | talk about armchair quarterbacking |
| 17:33:46 | <ggVGc> | science is still science even when the outcome is incorrect. It's the process that is science or not |
| 17:33:51 | <ggVGc> | and string theory is very much science |
| 17:34:31 | <dolio> | What does this have to do with Haskell? |
| 17:34:34 | <ggVGc> | also, semi-related, I think Sabine might be the funniest person on Youtube for me in many years |
| 17:34:34 | × | coot quits (~coot@213.134.171.3) (Quit: coot) |
| 17:34:53 | <ggVGc> | dolio: no idea, I just joined the conversation, coincidentally to avoid working on my physics lab report |
| 17:35:00 | <EvanR> | why is there no inexplicable popular youtuber talking about haskell |
| 17:35:07 | → | coot joins (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) |
| 17:35:07 | <EvanR> | bly* |
| 17:35:12 | <ggVGc> | have been trying to involve haskell in my studies, but not really found a decent way yet |
| 17:35:25 | <EvanR> | use the quantum mechanics monad |
| 17:35:27 | <geekosaur> | distrotube covers xmonad somewhat regularly |
| 17:35:30 | <ggVGc> | EvanR: there is, they just call it Rust for some reason |
| 17:35:32 | × | mikoto-chan quits (~mikoto-ch@2001:999:700:6f41:84a3:b322:d26d:702e) (Ping timeout: 246 seconds) |
| 17:35:45 | <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 … |
| 17:38:17 | × | trev quits (~trev@user/trev) (Remote host closed the connection) |
| 17:38:38 | <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 |
| 17:38:39 | <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. |
| 17:40:03 | <ggVGc> | yeah, I definitely don't agree with that |
| 17:40:32 | <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 |
| 17:40:33 | × | razetime quits (~quassel@49.207.203.213) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
| 17:41:44 | <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. ;) |
| 17:42:05 | <Barfolomew> | ggVGc: Tardis monad? |
| 17:42:30 | <Barfolomew> | ggVGc: We should rename Haskell to Shiny.:D |
| 17:42:32 | × | MajorBiscuit quits (~MajorBisc@145.94.137.174) (Ping timeout: 256 seconds) |
| 17:43:42 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 17:45:00 | <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? |
| 17:45:55 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 17:46:52 | <geekosaur> | doesn't seem to have stopped a number of alternative Preludes from appearing |
| 17:47:07 | <geekosaur> | (Relude seems to be the most popular but there are several others) |
| 17:47:28 | <ggVGc> | I have thought a lot about if languages should have implicit preludes, builtin globals etc. at all. I think they shouldn't, actually |
| 17:47:58 | <ggVGc> | rather there should be different standard preludes for different use-cases, like education for example |
| 17:48:50 | <EvanR> | I rewrote some haskell last week that should have benefitted from globals |
| 17:48:54 | <EvanR> | it didn't benefit |
| 17:49:04 | <EvanR> | *rewrote it to use actual globals xD |
| 17:49:06 | <monochrom> | Either historical reason or committee decision. |
| 17:49:16 | <geekosaur> | only if there;s some reasonable way to combine such libs, otherwise you just end up with de facto three incompatible languages |
| 17:49:58 | <monochrom> | But I would not add an extra Data.Float, even when I would agree about adding an extra Data.List. |
| 17:50:03 | <geekosaur> | or s/three/numPreludes/ |
| 17:50:52 | <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. |
| 17:51:02 | × | festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed) |
| 17:51:17 | × | gwern quits (~gwern@user/gwern) (Read error: Connection reset by peer) |
| 17:51:26 | <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. |
| 17:53:45 | <monochrom> | More generally, I suggest not shoehorning any actual library organization into any perfectionist ideology. |
| 17:54:06 | <ggVGc> | Barfolomew: just curious, om what are you basing the idea that testability is the difference between science and not-science? |
| 17:54:26 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 246 seconds) |
| 17:54:40 | <ggVGc> | monochrom: could do what lua does and just not have any libraries or ecosystem |
| 17:54:43 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 17:54:44 | <geekosaur> | can we take that discussion to offtopic, please? |
| 17:54:46 | <ggVGc> | and get rid of the issue |
| 17:54:52 | <ggVGc> | yeah, sorry |
| 17:54:54 | → | califax joins (~califax@user/califx) |
| 17:55:42 | <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.) |
| 17:56:06 | <monochrom> | You mean s/any/any single standard/ |
| 17:56:18 | <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 |
| 17:56:29 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 17:56:41 | <monochrom> | Because without a standard, then you just end up with splintered multiplicity of libraries and ecosystems and communities. |
| 17:57:14 | <monochrom> | Ecosystems will exist whether you like it or not. Your only choice is which positive integer of them. |
| 17:57:49 | <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. |
| 17:58:04 | × | ggVGc quits (~ggVGc@a.lowtech.earth) (Quit: WeeChat 3.5) |
| 17:58:35 | <Barfolomew> | monochrom: my point was more that Prelude should not implement anything at all, but be a pure re-exporter. A collection of things. |
| 17:58:40 | <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. |
| 17:59:30 | <monochrom> | Oh well then I'm sure Prelude's floating point stuff is just re-export of GHC.Float. |
| 17:59:47 | → | gwern joins (~gwern@user/gwern) |
| 18:00:23 | <EvanR> | for stuff where list, tuples, strings all make sense, you can use lenses |
| 18:00:54 | → | enoq joins (~enoq@2a05:1141:1f5:5600:b9c9:721a:599:bfe7) |
| 18:00:55 | <EvanR> | for when it doesn't make sense, please don't |
| 18:01:16 | <EvanR> | cough clojure |
| 18:01:42 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 18:01:55 | <sm> | o |
| 18:02:17 | <geekosaur> | there's EnumMap but I think it's not quite what you're after |
| 18:03:11 | <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 |
| 18:03:11 | <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. |
| 18:03:31 | <EvanR> | you mean, make the api be like, Enum p => ... p ... hah |
| 18:03:50 | <EvanR> | for its Int isomorphism ability |
| 18:03:52 | <Barfolomew> | EvanR: *shudders at lenses* : |
| 18:04:20 | × | Barfolomew quits (~Barfolome@2a0a-a546-5b20-1-7fee-17bd-2c6b-c767.ipv6dyn.netcologne.de) (Quit: Client closed) |
| 18:04:35 | <geekosaur> | https://hackage.haskell.org/packages/search?terms=enummap |
| 18:04:36 | × | coot quits (~coot@2a02:a310:e241:1b00:ec1a:e9df:79ac:66ba) (Quit: coot) |
| 18:05:11 | <EvanR> | that's actually neat |
| 18:05:52 | → | Tuplanolla joins (~Tuplanoll@91-159-68-152.elisa-laajakaista.fi) |
| 18:06:26 | <EvanR> | what in the world is this syntax |
| 18:06:29 | <EvanR> | import qualified Data.EnumMap k as EnumMap |
| 18:06:42 | × | pavonia quits (~user@user/siracusa) (Quit: Bye!) |
| 18:07:17 | <EvanR> | module parameter? |
| 18:08:45 | <geekosaur> | no such thing |
| 18:08:48 | × | gmg quits (~user@user/gehmehgeh) (Quit: Leaving) |
| 18:08:59 | × | jargon quits (~jargon@174-22-192-24.phnx.qwest.net) (Ping timeout: 256 seconds) |
| 18:09:06 | <geekosaur> | shows in the source as well so it's not just something being misrendered |
| 18:10:19 | <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 |
| 18:15:11 | → | burnsidesLlama joins (~burnsides@138.199.22.99) |
| 18:15:41 | <EvanR> | ok, I think I will just take p -> Int as part of the API |
| 18:16:48 | → | tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
| 18:21:49 | × | beteigeuze quits (~Thunderbi@bl14-81-220.dsl.telepac.pt) (Remote host closed the connection) |
| 18:22:14 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 18:24:57 | → | acidjnk joins (~acidjnk@p200300d6e7137a279cde44451dfff9db.dip0.t-ipconnect.de) |
| 18:25:49 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 18:26:02 | <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! |
| 18:26:16 | → | paulpaul1076 joins (~textual@95-29-5-111.broadband.corbina.ru) |
| 18:26:36 | <EvanR> | except that precludes streaming the answer lol |
| 18:27:10 | <EvanR> | forwards and backwards in haskell is a fickle mistress |
| 18:27:13 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 252 seconds) |
| 18:27:49 | <geekosaur> | that's a Seq |
| 18:28:14 | × | festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed) |
| 18:28:29 | × | nschoe quits (~q@141.101.51.197) (Quit: Switching off) |
| 18:28:31 | <EvanR> | what is |
| 18:30:08 | × | doyougnu quits (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) (Ping timeout: 256 seconds) |
| 18:32:30 | <geekosaur> | forwards and backwards |
| 18:33:10 | <EvanR> | is Seq at all "streamable" |
| 18:33:33 | <EvanR> | consume it incrementally as it is constructed |
| 18:33:37 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 18:33:43 | <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. |
| 18:34:24 | × | Guest23 quits (~Guest23@27.57.46.219) (Ping timeout: 268 seconds) |
| 18:37:13 | <shapr> | whatsupdoc: Are there other languages where that statement doesn't hold? |
| 18:37:29 | × | fizbin quits (~fizbin@user/fizbin) (Ping timeout: 252 seconds) |
| 18:38:27 | <EvanR> | yeah that hot take is unnecessarily specialized |
| 18:38:31 | × | eggplantade quits (~Eggplanta@104-55-37-220.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 18:39:45 | <shapr> | whatsupdoc: I can't think of a language where that's not a true statement, can you think of any? |
| 18:40:11 | <shapr> | Oh wait, some languages don't have a strong fan base, maybe SNOBOL? |
| 18:40:21 | <shapr> | Oh wait, I do know fanatic SNOBOL people, hm. |
| 18:40:40 | <mauke> | ALGOL |
| 18:40:50 | <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. |
| 18:41:26 | <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. |
| 18:41:31 | <shapr> | At the time, Java was "C without memory allocation", like putting a handle on the blade-only piece of sharp metal. |
| 18:41:43 | <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. |
| 18:41:45 | <shapr> | whatsupdoc: Are you sure about that statement? |
| 18:42:05 | × | festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed) |
| 18:42:12 | <[exa]> | whatsupdoc: is htat message from a happy future? |
| 18:42:15 | <dsal> | Haskell is great in industry. Recommended. |
| 18:42:28 | <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" ? |
| 18:42:55 | <dsal> | heh |
| 18:43:30 | <shapr> | whatsupdoc: Do you have any support or citations for that statement? |
| 18:43:44 | <EvanR> | industrial haskell, downtempo haskell, psychobilly haskell |
| 18:43:52 | <EvanR> | it's all good |
| 18:43:52 | <shapr> | ooh, I want some psychobilly haskell |
| 18:44:00 | <shapr> | Euterpia? |
| 18:44:35 | <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? |
| 18:44:53 | <shapr> | cause like, I don't wanna spend time discussing if it's not gonna go anywhere |
| 18:44:58 | <whatsupdoc> | shapr: chill bro i'm just quoting quora https://www.quora.com/Why-dont-more-programmers-use-Haskell |
| 18:45:01 | → | fizbin joins (~fizbin@user/fizbin) |
| 18:45:12 | <shapr> | Oh, I didn't know you were a ChatGPT instance, sorry. |
| 18:45:46 | <whatsupdoc> | They're getting good :) |
| 18:46:11 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 18:47:44 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) |
| 18:47:58 | × | burnsidesLlama quits (~burnsides@138.199.22.99) (Ping timeout: 268 seconds) |
| 18:49:59 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 18:50:43 | → | __monty__ joins (~toonn@user/toonn) |
| 18:53:13 | → | wootehfoot joins (~wootehfoo@user/wootehfoot) |
| 18:54:29 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 260 seconds) |
| 18:58:25 | <chreekat> | “ ” “ ” ‘ ’ ノ( º _ ºノ) here I had some extra |
| 18:59:58 | × | TimWolla quits (~timwolla@2a01:4f8:150:6153:beef::6667) (Quit: Bye) |
| 19:01:01 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Remote host closed the connection) |
| 19:07:27 | → | TimWolla joins (~timwolla@2a01:4f8:150:6153:beef::6667) |
| 19:07:38 | <DigitalKiwi> | shapr: iirc some SNOBOL fans made lua lol |
| 19:08:14 | <DigitalKiwi> | Influenced by |
| 19:08:15 | <DigitalKiwi> | C++, CLU, Modula, Scheme, SNOBOL |
| 19:08:27 | <DigitalKiwi> | or maybe roberto hated it and that's why they made lua |
| 19:10:38 | × | TimWolla quits (~timwolla@2a01:4f8:150:6153:beef::6667) (Remote host closed the connection) |
| 19:10:45 | <DigitalKiwi> | for some reason i read quora and thought bash.org |
| 19:10:49 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 19:11:45 | → | sadmax joins (~user@209.205.174.253) |
| 19:11:50 | → | azimut joins (~azimut@gateway/tor-sasl/azimut) |
| 19:14:46 | × | enoq quits (~enoq@2a05:1141:1f5:5600:b9c9:721a:599:bfe7) (Quit: enoq) |
| 19:15:05 | → | jargon joins (~jargon@174-22-192-24.phnx.qwest.net) |
| 19:16:08 | → | doyougnu joins (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) |
| 19:16:32 | → | TimWolla joins (~timwolla@2a01:4f8:150:6153:beef::6667) |
| 19:17:36 | × | doyougnu quits (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) (Remote host closed the connection) |
| 19:18:10 | → | doyougnu joins (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) |
| 19:18:43 | <geekosaur> | interesting that you can get two such different languages from SNOBOL |
| 19:18:50 | <geekosaur> | (the other was Icon) |
| 19:19:12 | <monochrom> | CLU has very good ideas about data abstraction. |
| 19:19:55 | <monochrom> | Oh but we got a million languages from Algol. Some say from C. >:) |
| 19:20:20 | <monochrom> | And some others, on the opposite side, say from lambda calculus >:) |
| 19:20:53 | <monochrom> | Oh nevermind, your point is about the descendents being very different. |
| 19:21:25 | <monochrom> | Then again I guess the descendents of Algol have huge differences too... |
| 19:21:52 | <geekosaur> | didn't SML claim to have gotten some things from Algol? |
| 19:22:18 | <monochrom> | That I don't know. |
| 19:23:27 | <monochrom> | But it may be true that Algol defined/clarified lexical scoping. That would be a mother of everything henceforth. |
| 19:23:42 | <DigitalKiwi> | std(lib)s |
| 19:23:57 | <dolio> | Didn't lambda calculus clarify lexical scoping? :þ |
| 19:24:01 | <monochrom> | And certainly true that Algol proved that recursion works. |
| 19:24:08 | <monochrom> | haha |
| 19:24:30 | <monochrom> | Well, Lisp then ruined it, so we needed an Algol to restore it... |
| 19:24:38 | <dolio> | Yeah, that's true. |
| 19:24:49 | × | fizbin quits (~fizbin@user/fizbin) (Ping timeout: 260 seconds) |
| 19:26:29 | → | wroathe joins (~wroathe@207-153-38-140.fttp.usinternet.com) |
| 19:26:29 | × | wroathe quits (~wroathe@207-153-38-140.fttp.usinternet.com) (Changing host) |
| 19:26:29 | → | wroathe joins (~wroathe@user/wroathe) |
| 19:28:19 | → | ft joins (~ft@p4fc2a257.dip0.t-ipconnect.de) |
| 19:30:34 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) (Remote host closed the connection) |
| 19:33:09 | → | Lycurgus joins (~juan@user/Lycurgus) |
| 19:33:33 | <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?! |
| 19:33:46 | <monochrom> | Here: http://lambda-the-ultimate.org/node/5662 |
| 19:35:14 | → | fizbin joins (~fizbin@user/fizbin) |
| 19:35:26 | <monochrom> | Hey this is interesing. |
| 19:36:09 | <dolio> | Sweeny's been talking about FP for game stuff off and on for like a decade, but never doing anything about it. |
| 19:36:37 | <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 |
| 19:39:00 | <shapr> | geekosaur: I got a shared object working in a compiled Haskell program on Android! |
| 19:39:07 | <shapr> | still can't get it working in ghci on Android :-( |
| 19:39:08 | <geekosaur> | yay! |
| 19:39:12 | <shapr> | but hey, progress! |
| 19:39:38 | <[exa]> | whaaaaaat |
| 19:39:39 | <geekosaur> | still think you have to somehow convince ghci to use the system linker / dlopen instead of its own linker |
| 19:39:47 | <[exa]> | shapr: does that have a webpage or something? |
| 19:39:59 | <shapr> | uh, a gist? |
| 19:40:02 | <shapr> | https://gist.github.com/shapr/11e41ca59fb60f8dc98b3ff145932ef0 |
| 19:40:04 | <[exa]> | ah okay :D |
| 19:40:08 | <[exa]> | but yeah that's cool |
| 19:40:16 | <geekosaur> | termux just plays too many games with the whole dynamic link mechanism |
| 19:40:17 | <shapr> | It requires that you have the matching libchallenge_bypass_ristretto.so that's cross compiled via nix |
| 19:41:01 | × | thyriaen quits (~thyriaen@2a01:aea0:dd4:4bae:6245:cbff:fe9f:48b1) (Remote host closed the connection) |
| 19:41:10 | × | wootehfoot quits (~wootehfoo@user/wootehfoot) (Read error: Connection reset by peer) |
| 19:41:54 | <shapr> | [exa]: We're working our way towards using shared objects from inside an Obelisk app : https://github.com/obsidiansystems/obelisk |
| 19:45:00 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 260 seconds) |
| 19:45:14 | × | wroathe quits (~wroathe@user/wroathe) (Ping timeout: 260 seconds) |
| 19:47:19 | → | gurkenglas joins (~gurkengla@p548ac72e.dip0.t-ipconnect.de) |
| 19:49:35 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) |
| 19:50:43 | × | festive_kurbus quits (~festive_k@user/kurbus) (Ping timeout: 260 seconds) |
| 20:00:10 | <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? |
| 20:00:26 | <EvanR> | I see minView or maxView has log N complexity |
| 20:00:38 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 20:01:45 | <c_wraith> | it works as a priority queue, sure. It does have the downside that priorities are required to be unique |
| 20:02:04 | <monochrom> | Yeah, that. |
| 20:02:21 | <monochrom> | I am lazy so I just use a priority queue library from hackaage. |
| 20:03:14 | <EvanR> | oh right |
| 20:03:20 | × | ec_ quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 255 seconds) |
| 20:03:21 | <EvanR> | I just ran into that 5 minutes ago |
| 20:04:15 | <monochrom> | In reality I needed a priority-search queue so I use psqueues |
| 20:04:51 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 20:04:54 | <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. |
| 20:05:19 | <c_wraith> | I used psqueues for an AoC problem last year |
| 20:05:27 | <monochrom> | Ah OK that's nice. |
| 20:06:39 | × | bgs quits (~bgs@212-85-160-171.dynamic.telemach.net) (Remote host closed the connection) |
| 20:06:43 | × | Lycurgus quits (~juan@user/Lycurgus) (Quit: Exeunt: personae.ai-integration.biz) |
| 20:07:02 | × | avicenzi quits (~avicenzi@2a00:ca8:a1f:b004::c32) (Ping timeout: 256 seconds) |
| 20:07:11 | <EvanR> | I replaced Data.Set for my A* with a list and it runs way faster |
| 20:07:29 | <DigitalKiwi> | i use nix-on-droid to run ghci on android lol |
| 20:08:18 | <geekosaur> | I use it somewhat regularly |
| 20:08:25 | <geekosaur> | (psqueues) |
| 20:09:13 | <geekosaur> | well, have two programs written several years ago but they get recompiled every time I upgrade ghc so 🙂 |
| 20:10:33 | × | festive_kurbus quits (~festive_k@user/kurbus) (Ping timeout: 260 seconds) |
| 20:11:13 | → | JordiGH joins (~jordi@user/jordigh) |
| 20:11:23 | → | ballast joins (~ballast@cpe-104-32-238-223.socal.res.rr.com) |
| 20:11:30 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 20:11:39 | <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? |
| 20:12:20 | <monochrom> | Free theorems. Parametricity. |
| 20:12:35 | <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) |
| 20:13:07 | <ballast> | how about (a,b) -> a |
| 20:13:17 | <monochrom> | If f::t->[t], and f () = [(), (), ()], then we know f 4 = [4,4,4]. |
| 20:14:03 | <JordiGH> | ballast: Ah, that must be a projection? |
| 20:14:29 | → | waleee joins (~waleee@h-176-10-137-138.NA.cust.bahnhof.se) |
| 20:14:32 | <ballast> | JordiGH I think so, I don't have a proof that it must be though. |
| 20:14:54 | <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). |
| 20:14:55 | → | coot joins (~coot@213.134.171.3) |
| 20:15:22 | <monochrom> | n does not depend on z or s. |
| 20:15:50 | <JordiGH> | So does this general kind of deduction have a name I can google for and get a bunch of SEO crap from Geeksforgeeks? |
| 20:15:58 | <monochrom> | I wrote two names. |
| 20:16:06 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
| 20:16:26 | <JordiGH> | Oh, sorry, missed that. |
| 20:17:07 | <monochrom> | http://www.vex.net/~trebla/haskell/abs-type-param.html |
| 20:17:44 | <EvanR> | (a,b) -> a, you are required to return an a. There is only one way to get one |
| 20:17:52 | <EvanR> | given what you are given |
| 20:18:09 | <monochrom> | (a,b) -> a is one of the worked examples in my article. |
| 20:20:14 | <iqubic> | Teah, there's only really one way to write (a, b) -> a. |
| 20:20:33 | <iqubic> | *yeah |
| 20:20:57 | <monochrom> | Or rather, more intuitively but still being pretty careful, you have no choice because you aren't allowed runtime type information. |
| 20:21:39 | <monochrom> | In Java Generics, you can totally code up "if (x instanceOf Integer) { ... } else { ...}". |
| 20:22:35 | <iqubic> | Right. |
| 20:23:07 | <monochrom> | Although, the perspective of stating it positively and connecting to abstract type programming is also interesting. |
| 20:23:25 | <monochrom> | (Hint: Dependency injection totally rely on this too.) |
| 20:24:36 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 20:24:39 | <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. |
| 20:24:59 | <JordiGH> | In this case, the condition "works for all types" is just too strrong. |
| 20:25:24 | → | burnsidesLlama joins (~burnsides@138.199.22.99) |
| 20:25:47 | <monochrom> | Oh, complex analysis and its "it must be an analytic function" is very constraining too. |
| 20:26:19 | <monochrom> | So much so that "analytic and bounded" implies "constant". |
| 20:27:19 | <monochrom> | Lately I learned from 3Blue1Brown (I think? Or could be another math youtuber) that CR is trying to say angle-preserving. |
| 20:27:41 | → | wrengr joins (~wrengr@201.59.83.34.bc.googleusercontent.com) |
| 20:29:12 | <JordiGH> | Yeah, conformal. |
| 20:29:49 | <JordiGH> | Probably 3B1B, I'm sure he's made complex analysis videos. |
| 20:31:05 | × | burnsidesLlama quits (~burnsides@138.199.22.99) (Ping timeout: 260 seconds) |
| 20:32:55 | <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 |
| 20:32:55 | <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? |
| 20:33:17 | <dolio> | The closest math analogue is "natural." The historical, intuitive descriptions are almost identical. But the exact characterizations differ. |
| 20:33:41 | <dolio> | And naturality is weaker than parametricity. |
| 20:34:07 | × | irrgit quits (~irrgit@146.70.27.218) (Read error: Connection reset by peer) |
| 20:36:24 | × | festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed) |
| 20:37:11 | → | king_gs joins (~Thunderbi@187.201.150.200) |
| 20:37:55 | <EvanR> | ballast, class Monad m => HasMyState m where xD -- don't do this |
| 20:37:59 | × | ec quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 255 seconds) |
| 20:38:46 | <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? |
| 20:39:39 | <EvanR> | you'd need some kind of (s -> t) and (t -> s) wouldn't you |
| 20:39:50 | <EvanR> | or a lens to put the updated MyState back |
| 20:40:02 | <ballast> | yeah I was using a lens (simplified it for the problem statement) |
| 20:40:57 | <ballast> | ah i see, that's why I wasn't getting any hits on hoogle |
| 20:41:36 | × | king_gs quits (~Thunderbi@187.201.150.200) (Ping timeout: 256 seconds) |
| 20:42:22 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 20:43:20 | <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. |
| 20:44:50 | <monochrom> | This is why you need either (MyState -> a, a -> MyState) or the equivalent lens. |
| 20:45:54 | → | festive_kurbus joins (~festive_k@user/kurbus) |
| 20:46:52 | <ballast> | ah yeah fair, I can't seem to write it with just (MyState -> a) |
| 20:46:54 | <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. |
| 20:48:29 | <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. |
| 20:48:47 | <monochrom> | I would offer both. |
| 20:48:54 | <ballast> | Seems fair. |
| 20:49:38 | <monochrom> | But I think lens already has it. |
| 20:50:05 | <ballast> | Oh, an API for converting (a -> b, b -> a) into something like Lens a a b b ? |
| 20:50:13 | <c_wraith> | :t lens |
| 20:50:14 | <lambdabot> | Functor f => (s -> a) -> (s -> b -> t) -> (a -> f b) -> s -> f t |
| 20:50:23 | <ballast> | I use "API" poorly, I just mean some sort of method |
| 20:50:28 | <c_wraith> | close, but the setter needs an extra value |
| 20:50:29 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) (Remote host closed the connection) |
| 20:50:30 | <monochrom> | No, the complete bridge between State MyState and State a |
| 20:50:42 | <c_wraith> | ah. zoom is a bit funny |
| 20:50:44 | <c_wraith> | :t zoom |
| 20:50:45 | <lambdabot> | Zoom m n s t => LensLike' (Zoomed m c) t s -> m c -> n c |
| 20:51:07 | <c_wraith> | that works within State, but it's... well, the type it has. |
| 20:51:59 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 20:52:07 | <c_wraith> | > (1,2) &~ zoom _2 (id += 5) |
| 20:52:09 | <lambdabot> | (1,7) |
| 20:53:09 | <ballast> | ah yeah that is pretty much what I'm looking for |
| 20:53:35 | → | kenran joins (~user@user/kenran) |
| 20:53:39 | <c_wraith> | so yeah, lens already does it. :) |
| 20:53:46 | <ballast> | unfortunately I want to also take something of type n c as an argument |
| 20:54:08 | × | kenran quits (~user@user/kenran) (Remote host closed the connection) |
| 20:54:14 | → | pavonia joins (~user@user/siracusa) |
| 20:54:47 | <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 |
| 20:55:23 | <monochrom> | The Law of Gravity Lensing: Every sufficiently massive program contains a lens implementation. >:) |
| 20:55:29 | → | tvandinther joins (~tvandinth@111.69.34.210) |
| 20:57:22 | <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! |
| 20:58:01 | <ballast> | wrapping my head around s t a b makes me feel stabby 🙃 |
| 20:58:37 | <darkling> | :) @ monochrom |
| 21:02:01 | × | festive_kurbus quits (~festive_k@user/kurbus) (Quit: Client closed) |
| 21:02:20 | <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 |
| 21:02:20 | <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` ? |
| 21:05:49 | <ballast> | tvandinther: is your idea to have the map's structure be lazy or its contents be lazy? |
| 21:06:45 | <tvandinther> | the contents. I want `a -> b -> b` evaluated when accessed, and have just a single `b` in memory until a key is accessed. |
| 21:08:16 | <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]`? |
| 21:08:46 | <ballast> | er... let's assume that `fromList` is a magical function that can figure out the `a` associated with the mapped values |
| 21:09:00 | <tvandinther> | Yes, that looks right |
| 21:09:59 | <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. |
| 21:10:16 | <ballast> | (my intuition is not the same as an actual answer, though) |
| 21:10:53 | <ballast> | What I like about your alternative is that you can enforce that there will only be one `b` kicking around |
| 21:12:04 | <ballast> | whereas once you force a leaf of the `Map a b` I don't see any reason why it would disappear. |
| 21:13:07 | <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. |
| 21:13:57 | → | king_gs joins (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) |
| 21:15:04 | → | bobbingbob joins (~dfadsva@2604:3d09:207f:f650::7b3a) |
| 21:15:05 | <ballast> | Why do you need the `Set a` in the second case? |
| 21:15:12 | ← | bobbingbob parts (~dfadsva@2604:3d09:207f:f650::7b3a) () |
| 21:15:15 | <ballast> | Or did you mean `(a -> Maybe b)` as your return type |
| 21:16:17 | <tvandinther> | I pass in a unique `[a]` so I figure a set would ensure that |
| 21:17:49 | <ballast> | To me, `Map a b ~ (a -> Maybe b)` unless your map has every possible `a` in it. |
| 21:17:59 | → | jmdaemon joins (~jmdaemon@user/jmdaemon) |
| 21:18:47 | × | king_gs quits (~Thunderbi@2806:103e:29:cdd2:b2dd:cddc:5884:d05c) (Ping timeout: 264 seconds) |
| 21:19:48 | <tvandinther> | Essentially the process is I get a bunch of unique `a` and turn them into `[b]` and `fold (<>) -> b` |
| 21:20:08 | <tvandinther> | So there should be a result for each `a` passed in |
| 21:23:00 | × | doyougnu quits (~doyougnu@cpe-74-69-132-225.stny.res.rr.com) (Ping timeout: 248 seconds) |
| 21:23:51 | <dsal> | Do you mean `[a] -> [b] -> b` ? That's just foldMap |
| 21:23:55 | <dsal> | :t foldMap |
| 21:23:56 | <lambdabot> | (Foldable t, Monoid m) => (a -> m) -> t a -> m |
| 21:24:12 | × | terrorjack quits (~terrorjac@2a01:4f8:1c1e:509a::1) (Ping timeout: 265 seconds) |
| 21:25:00 | <dsal> | That's mildly confusing. If you have `(a -> b)` and you want `[a] -> b` then that's a foldMap. |
| 21:25:13 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 260 seconds) |
| 21:26:07 | → | terrorjack joins (~terrorjac@2a01:4f8:1c1e:509a::1) |
| 21:27:09 | <tvandinther> | I'm using `sconcat` to combine them |
| 21:28:04 | <tvandinther> | Sorry for the confusion. I may lack the understanding to properly explain whats happening |
| 21:28:34 | <tvandinther> | I think my original question about the map usage was answered though. |
| 21:29:27 | × | ballast quits (~ballast@cpe-104-32-238-223.socal.res.rr.com) (Quit: Client closed) |
| 21:29:52 | <geekosaur> | > foldMap f [a,b,c] |
| 21:29:53 | <lambdabot> | error: |
| 21:29:53 | <lambdabot> | • Ambiguous type variable ‘a0’ arising from a use of ‘show_M119220221989... |
| 21:29:53 | <lambdabot> | prevents the constraint ‘(Show a0)’ from being solved. |
| 21:29:58 | → | ballast joins (~ballast@cpe-104-32-238-223.socal.res.rr.com) |
| 21:30:13 | <geekosaur> | > foldMap f [a,b,c] :: Expr |
| 21:30:14 | <lambdabot> | f a <> f b <> f c <> mempty |
| 21:31:09 | <dsal> | :t sconcat |
| 21:31:10 | <lambdabot> | error: |
| 21:31:10 | <lambdabot> | • Variable not in scope: sconcat |
| 21:31:10 | <lambdabot> | • Perhaps you meant one of these: |
| 21:31:12 | <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. |
| 21:31:33 | <dsal> | oh, sconcat is fold for semigroups. |
| 21:31:57 | <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 |
| 21:32:12 | <ballast> | or if you want to cache the `b` once you create it |
| 21:35:02 | × | coot quits (~coot@213.134.171.3) (Quit: coot) |
| 21:35:54 | → | coot joins (~coot@213.134.171.3) |
| 21:36:20 | <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? |
| 21:38:11 | <ballast> | Sorry, I don't know enough to answer that question. |
| 21:38:23 | <tvandinther> | no worries |
| 21:42:06 | <EvanR> | records are reallocated and rescribbled if any fields are updated |
| 21:42:26 | <EvanR> | the fields not changed are carried over as is, unless you are also using unpacking |
| 21:42:53 | <EvanR> | the fields not changed can benefit from sharing, unless you are also using unpacking |
| 21:43:33 | <geekosaur> | but unpacking works best with short fields so if this is relevant then you shouldn't be using it |
| 21:44:57 | × | fizbin quits (~fizbin@user/fizbin) (Ping timeout: 268 seconds) |
| 21:46:50 | → | Cale joins (~cale@cpef48e38ee8583-cm30b7d4b3fc20.cpe.net.cable.rogers.com) |
| 21:49:21 | × | coot quits (~coot@213.134.171.3) (Quit: coot) |
| 21:50:59 | → | eggplantade joins (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) |
| 21:55:23 | × | ec quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 255 seconds) |
| 21:55:40 | × | eggplantade quits (~Eggplanta@2600:1700:38c5:d800:a84a:2d35:f948:fe07) (Ping timeout: 260 seconds) |
| 21:56:44 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 21:58:48 | → | fizbin joins (~fizbin@user/fizbin) |
| 22:02:15 | × | takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
| 22:04:30 | × | albet70 quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection) |
| 22:10:37 | → | albet70 joins (~xxx@2400:8902::f03c:92ff:fe60:98d8) |
| 22:10:50 | → | king_gs joins (~Thunderbi@187.201.150.200) |
| 22:10:51 | × | j4cc3b quits (~jeffreybe@pool-74-105-2-138.nwrknj.fios.verizon.net) (Ping timeout: 248 seconds) |
| 22:13:42 | → | burnsidesLlama joins (~burnsides@138.199.22.99) |
| 22:15:16 | × | king_gs quits (~Thunderbi@187.201.150.200) (Ping timeout: 248 seconds) |
| 22:16:28 | × | fserucas quits (~fserucas@2001:818:e376:a400:fb92:70c1:dd88:c7d7) (Remote host closed the connection) |
| 22:16:31 | × | fizbin quits (~fizbin@user/fizbin) (Remote host closed the connection) |
| 22:16:51 | → | fserucas joins (~fserucas@2001:818:e376:a400:fb92:70c1:dd88:c7d7) |
| 22:18:22 | <dminuoso> | I think the more relevant term here is *unboxed* and *boxed* |
| 22:18:53 | → | mestre joins (~mestre@191.177.185.178) |
| 22:19:01 | <dminuoso> | If its boxed, the new value will have all "unchanged" fields with a pointer to the old value |
| 22:21:20 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 22:26:26 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 256 seconds) |
| 22:27:03 | → | niko joins (niko@libera/staff/niko) |
| 22:30:56 | × | ballast quits (~ballast@cpe-104-32-238-223.socal.res.rr.com) (Quit: Client closed) |
| 22:31:09 | → | mmhat joins (~mmh@p200300f1c7390125ee086bfffe095315.dip0.t-ipconnect.de) |
| 22:33:03 | × | troydm quits (~troydm@host-176-37-124-197.b025.la.net.ua) (Ping timeout: 268 seconds) |
| 22:33:26 | × | michalz quits (~michalz@185.246.204.87) (Remote host closed the connection) |
| 22:34:12 | × | mmhat quits (~mmh@p200300f1c7390125ee086bfffe095315.dip0.t-ipconnect.de) (Client Quit) |
| 22:35:39 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 22:36:00 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 22:43:23 | × | tomokojun quits (~tomokojun@75.164.52.103) (Quit: じゃあね〜。) |
| 22:47:16 | → | Guest|46 joins (~Guest|46@158.red-79-151-122.dynamicip.rima-tde.net) |
| 22:49:50 | <EvanR> | and if the field is unpacked, it won't xD |
| 22:51:22 | × | chomwitt quits (~chomwitt@ppp-94-69-55-246.home.otenet.gr) (Ping timeout: 256 seconds) |
| 22:52:47 | → | azimut_ joins (~azimut@gateway/tor-sasl/azimut) |
| 22:52:59 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 255 seconds) |
| 22:53:26 | × | azimut quits (~azimut@gateway/tor-sasl/azimut) (Ping timeout: 255 seconds) |
| 22:53:34 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 22:57:58 | × | Guest|46 quits (~Guest|46@158.red-79-151-122.dynamicip.rima-tde.net) (Quit: Guest|46) |
| 23:04:44 | × | WarzoneCommand quits (~Frank@77-162-168-71.fixed.kpn.net) (Ping timeout: 260 seconds) |
| 23:12:01 | → | merijn joins (~merijn@86-86-29-250.fixed.kpn.net) |
| 23:16:50 | × | merijn quits (~merijn@86-86-29-250.fixed.kpn.net) (Ping timeout: 268 seconds) |
| 23:16:50 | × | nut quits (~nut@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) (Ping timeout: 268 seconds) |
| 23:17:16 | → | fizbin joins (~fizbin@user/fizbin) |
| 23:24:48 | × | fizbin quits (~fizbin@user/fizbin) (Ping timeout: 256 seconds) |
| 23:26:30 | × | burnsidesLlama quits (~burnsides@138.199.22.99) (Ping timeout: 256 seconds) |
| 23:28:35 | × | son0p quits (~ff@2604:3d08:5b7f:5540:98a9:2169:15a1:4c7f) (Ping timeout: 256 seconds) |
| 23:35:57 | × | motherfsck quits (~motherfsc@user/motherfsck) (Ping timeout: 268 seconds) |
| 23:41:14 | <davean> | geekosaur: I think you're packing a lot of heuristics into "short fields", and while its an ok resultant heuristic, its not quite right. |
| 23:41:42 | <davean> | Like you're probably backing that in based on the overall records updated properties and copying, which only applies sometimes. |
| 23:42:14 | <geekosaur> | I was oversimplifying a fairly complicated description, actually |
| 23:42:19 | <davean> | and access time constant factors not being as relivent to large pieces of data which doesn't apply to fixed size O(1) access members |
| 23:42:29 | <geekosaur> | I considered expanding on it but decided it'd just cause confusion |
| 23:42:33 | <davean> | There are a lot of times its good to unpack a very, very large field. |
| 23:43:06 | <geekosaur> | (although tbh I thought packing should simply have been left out of it) |
| 23:43:49 | × | tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 23:43:56 | <davean> | Thats possible in this specific case, though it is very relevent generally. |
| 23:44:01 | <davean> | Depends on the point you're making! |
| 23:44:29 | <davean> | Also, I'm going to go back to being angry at JuicyPixels for using unboxed values and thus ruining my performance. |
| 23:47:05 | → | burnsidesLlama joins (~burnsides@119247164140.ctinets.com) |
| 23:47:43 | × | burnsidesLlama quits (~burnsides@119247164140.ctinets.com) (Remote host closed the connection) |
| 23:52:15 | × | __monty__ quits (~toonn@user/toonn) (Quit: leaving) |
| 23:54:11 | → | fizbin joins (~fizbin@user/fizbin) |
| 23:54:58 | <dminuoso> | davean: Curious, how is that ruining your performance? |
| 23:57:11 | → | motherfsck joins (~motherfsc@user/motherfsck) |
All times are in UTC on 2022-12-12.