Logs: liberachat/#haskell
| 2021-06-21 23:00:57 | <davean> | Cajun: GHC version that is |
| 2021-06-21 23:01:06 | <davean> | Cajun: so if you want an older base, move back a major GHC version |
| 2021-06-21 23:01:11 | <davean> | or upgrade the package to work with newer GHC |
| 2021-06-21 23:01:16 | <shachaf> | monochrom: That one is different. |
| 2021-06-21 23:01:23 | <Cajun> | i used to use 8.8.4, should i try using that? |
| 2021-06-21 23:02:04 | <davean> | Cajun: Yes, that would use base 4.13 |
| 2021-06-21 23:02:05 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-06-21 23:02:12 | <shachaf> | Pretend it's a strict language. To compute ([x1]++[x2])++[x3], you go [x1,x1]++[x3], [x1,x2,x3] |
| 2021-06-21 23:02:13 | <davean> | which you'll notice is in range for the constraints specified |
| 2021-06-21 23:02:18 | × | chexum quits (~chexum@gateway/tor-sasl/chexum) (Ping timeout: 244 seconds) |
| 2021-06-21 23:02:27 | <shachaf> | Uh, [x1,x2]++[x3] |
| 2021-06-21 23:02:37 | <shachaf> | In the second step, (++) has to traverse the entire list just to append [x3] |
| 2021-06-21 23:02:49 | <davean> | Cajun: Basicly all you have to do is look at what it tells you and do it |
| 2021-06-21 23:03:00 | <sclv> | Cajun: you could also just try passing the --allow-newer flag, cross your fingers, and pray to your diety of choice |
| 2021-06-21 23:03:08 | <davean> | Cajun: it tells you two things don't fit together, change one of them to match the other |
| 2021-06-21 23:03:12 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds) |
| 2021-06-21 23:03:27 | <sclv> | it looks like a bump to Chart-diagrams to allow it to work with diagrams-core 1.5 could work, but that might fail |
| 2021-06-21 23:03:29 | <shachaf> | And then if you need to go to [x1,x2,x3]++[x4], this (++) also needs to traverse the entire list on the left. |
| 2021-06-21 23:03:38 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-21 23:03:50 | <sclv> | using the allow newer flag says "ignore the constraints, and try to build anyway, and then maybe there will be errors, who knows" |
| 2021-06-21 23:04:03 | <monochrom> | OK, I meant: "head (( ... (((x1 :) . (x2 :)) . (x3 :)) . (x4 :) ...) [])" is still much faster than "head (...(([x1]++[x2])++[x3])++[x4] ...)" empirically. |
| 2021-06-21 23:04:10 | <davean> | if you do what sclv says, if it breaks you may not notice, and you get to keep all the pieces |
| 2021-06-21 23:04:11 | × | tzar_bomba quits (~tzar_bomb@78-56-41-78.static.zebra.lt) (Quit: Client closed) |
| 2021-06-21 23:04:25 | <davean> | monochrom: right, its lazy |
| 2021-06-21 23:04:40 | <shachaf> | Yes, it works the same way in a lazy language. |
| 2021-06-21 23:04:41 | <davean> | monochrom: so the first doesn't have to walk the list repeatedly? |
| 2021-06-21 23:04:48 | <Cajun> | davean: thanks! im guessing adjusting the leftmost part of => is easier to do than trying to change the rightmost part? |
| 2021-06-21 23:04:49 | <sclv> | often i'll also locally pull in the offending package, and try to fix it by hand, and if it works, then I can A) depend on the local version and B) submit a PR request back upstream |
| 2021-06-21 23:04:50 | × | fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Ping timeout: 258 seconds) |
| 2021-06-21 23:04:58 | <davean> | Cajun: depends entirely |
| 2021-06-21 23:05:37 | × | ddellacosta quits (~ddellacos@86.106.121.100) (Ping timeout: 265 seconds) |
| 2021-06-21 23:05:54 | <sclv> | if you're in a cabal project already, then if you `cabal unpack SOMEPACKAGE` it'll unpack it into that directory, and if you get it building, and have a cabal.project set up, cabal will use the local source version over the one from hackage |
| 2021-06-21 23:06:19 | × | jiribenes quits (~jiribenes@rosa.jiribenes.com) (Remote host closed the connection) |
| 2021-06-21 23:06:30 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-06-21 23:06:49 | <shachaf> | With difference lists -- let a = (:) -- you have something like ((a 1 . a 2) . a 3). You need to do linear work once to turn that into [1,2,3], but that's it. |
| 2021-06-21 23:08:04 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-21 23:08:11 | <davean> | Cajun: personally my first approach is always "change whichever side moves to newer versions" because thats the longer term approach, but if I have an easier time changing the other side, I might be expedient |
| 2021-06-21 23:09:01 | <shachaf> | This isn't a very clear answer, hmm. |
| 2021-06-21 23:09:02 | <davean> | sclv: I would say I'd be suspicious of allow-newere here since he rest of that ecosystem seems to be bumped. |
| 2021-06-21 23:09:20 | <davean> | shachaf: I tihnk linear verses quadratic work is pretty clear? |
| 2021-06-21 23:09:33 | <davean> | shachaf: but I mean also, lazinessed helps with one and not the other |
| 2021-06-21 23:09:47 | <shachaf> | Yes, but the question was why. |
| 2021-06-21 23:09:58 | <shachaf> | I don't think laziness is that relevant here. You have exactly the same thing in a strict language. |
| 2021-06-21 23:10:08 | <davean> | Why is it linear verses quadratic? |
| 2021-06-21 23:10:18 | <sclv> | davean: i'm not suspicius because the offending package is Chart-diagrams which isn't part of the diagrams ecosystem, its part of the "bridge" to that ecosystem from the Chart ecosystem :-) |
| 2021-06-21 23:10:19 | <davean> | I mean ... you showed that directly |
| 2021-06-21 23:10:30 | <shachaf> | I just don't think my explanation was very good. |
| 2021-06-21 23:10:52 | <davean> | shachaf: you have MORE here than in a strict language though, because to take head you don't even have to do the entire linear walk, just O(1) |
| 2021-06-21 23:10:54 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-06-21 23:11:04 | <shachaf> | No, you have to do the whole linear thing. |
| 2021-06-21 23:11:19 | <shachaf> | Because your compositions are left associated, ((a 1 . a 2) . a 3) . a 4 |
| 2021-06-21 23:11:34 | <shachaf> | So you need to go through the whole thing to get to the 1. |
| 2021-06-21 23:12:26 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-21 23:14:22 | × | zeenk quits (~zeenk@2a02:2f04:a00e:6e00:d401:4c92:fecc:16f9) (Quit: Konversation terminated!) |
| 2021-06-21 23:14:22 | <davean> | shachaf: With that construction, but you can setup one that doesn't |
| 2021-06-21 23:14:51 | <davean> | Depending on how much you're optimizing the specific case |
| 2021-06-21 23:15:04 | <shachaf> | I mean, we were talking about difference lists. Of course you can set up other data structures. |
| 2021-06-21 23:15:23 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-06-21 23:15:29 | <davean> | Oh i think of difference lists as the specific signature, not an alg |
| 2021-06-21 23:15:44 | <davean> | maybe that doesn't match the actual usage of the term |
| 2021-06-21 23:15:57 | <shachaf> | Oh, maybe you mean any function of the form (l ++) |
| 2021-06-21 23:16:14 | <shachaf> | But the point of using difference lists here is "constant time append". |
| 2021-06-21 23:16:24 | <davean> | [a] -> [a] is what I've seen defined as difference lists |
| 2021-06-21 23:16:29 | <shachaf> | Which you do get! But you don't get constant-time head. |
| 2021-06-21 23:16:47 | <shachaf> | I don't think people would call reverse a difference list. |
| 2021-06-21 23:16:55 | <shachaf> | Just functions of the form (l ++) for some l. |
| 2021-06-21 23:16:56 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-21 23:17:01 | <davean> | mmm |
| 2021-06-21 23:17:19 | <davean> | Thats fair I suppose. Different than what I saw specificly defined, but I'd buy that I was being too general |
| 2021-06-21 23:17:47 | × | killsushi quits (~killsushi@user/killsushi) (Read error: Connection reset by peer) |
| 2021-06-21 23:18:04 | <shachaf> | The term comes from Prolog, right? Where you would leave the end of the list as a thing you can unify with. |
| 2021-06-21 23:18:14 | → | killsushi joins (~killsushi@user/killsushi) |
| 2021-06-21 23:18:19 | <davean> | I had no clue that was a thing |
| 2021-06-21 23:18:30 | <davean> | I've never heard of it in regards to prolog |
| 2021-06-21 23:18:41 | <shachaf> | I think that's where the term comes from, at least. |
| 2021-06-21 23:19:05 | <shachaf> | The point is, a list is a thing that looks like (1 : 2 : 3 : []). A difference list is like a list, but parameterized on nil, so it's of the form (\nil -> 1 : 2 : 3 : nil) |
| 2021-06-21 23:19:31 | <shachaf> | So the nil is like a hole that you can fill in later, making list A end at the beginning of list B. |
| 2021-06-21 23:19:55 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-06-21 23:20:31 | <shachaf> | (\nil -> 1 : 2 : 3 : nil) [4,5,6] ---> [1,2,3,4,5,6], without ever having to actually traverse a [1,2,3] list. |
| 2021-06-21 23:21:09 | <davean> | Right but notice with THAT |
| 2021-06-21 23:21:17 | <davean> | > head $ (\nil -> 1 : 2 : 3 : nil) undefined |
| 2021-06-21 23:21:19 | <lambdabot> | 1 |
| 2021-06-21 23:21:29 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-21 23:21:31 | <davean> | er |
| 2021-06-21 23:21:36 | <davean> | that was a dumb thing to say |
| 2021-06-21 23:21:46 | × | moet_ quits (~moet@172.58.19.20) (Ping timeout: 252 seconds) |
| 2021-06-21 23:22:44 | <shachaf> | Yes, right, once you have something of that form, you can take the head in constant time. |
| 2021-06-21 23:23:05 | <shachaf> | You can always flatten it: flatten dlist = (dlist [] ++) |
| 2021-06-21 23:23:14 | <shachaf> | But that's also a (worst-case) linear-time operation. |
| 2021-06-21 23:24:16 | × | betelgeuse quits (~john2gb@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-06-21 23:25:48 | → | betelgeuse joins (~john2gb@94-225-47-8.access.telenet.be) |
| 2021-06-21 23:28:18 | → | thyriaen joins (~thyriaen@45.178.73.238) |
| 2021-06-21 23:28:30 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-06-21 23:29:08 | <thyriaen> | Hello, i just started out with haskell and wrote my first function - something really strange is happening - i assume it has something to do with being lazy but i do not understand - can someone help me out ? |
| 2021-06-21 23:29:51 | <thyriaen> | https://hastebin.com/uduwetocof.apache this is the code i loaded into ghci |
| 2021-06-21 23:30:32 | <thyriaen> | Thank you very much - i have found my error ;) |
| 2021-06-21 23:32:29 | <geekosaur> | rubber duck debugging at its finest :) |
| 2021-06-21 23:32:33 | × | pretty_dumm_guy quits (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) (Quit: WeeChat 3.3-dev) |
| 2021-06-21 23:33:52 | × | janiczek quits (~janiczek@89-24-215-117.customers.tmcz.cz) (Ping timeout: 252 seconds) |
| 2021-06-21 23:34:37 | <monochrom> | I and my TA once discussed giving out rubber ducks to students. |
All times are in UTC.