Logs: liberachat/#haskell
| 2021-08-24 07:29:12 | <dminuoso> | It's just that `traverse` is characterstic of the thing that lets you "operate on each thing". So `traverse` itself is a first class optic, a Traversal. |
| 2021-08-24 07:29:30 | <dminuoso> | If you monomorphize this into |
| 2021-08-24 07:29:31 | <arahael> | Aaand error message! |
| 2021-08-24 07:29:34 | <arahael> | 24/Aug/2021:17:28:58 +1000 [Error#yesod-core] Exception from Warp: Network.Socket.accept: resource exhausted (Too many open files) @(yesod-core-1.6.21.0-aa8cb2d15ab3f57565dd6843d5c747c9da7580c51a33acffed1522ce0cdf2caa:Yesod.Core.Dispatch src/Yesod/Core/Dispatch.hs:205:23) |
| 2021-08-24 07:29:46 | <tomsmeding> | yay |
| 2021-08-24 07:29:51 | <dminuoso> | traverseList :: Applicative f => (a -> f b) -> [a] -> f [b] |
| 2021-08-24 07:30:02 | <dminuoso> | Then thats a "traversal that targets each item in a list" |
| 2021-08-24 07:30:13 | <dminuoso> | But we could also write such a thing, that targets each *second* item in a list. |
| 2021-08-24 07:30:37 | <Athas> | Is there a function '[a] -> [(a,a)]' that turns '[1,2,3,4]' into '[(1,2),(3,4)]'? |
| 2021-08-24 07:31:01 | <dminuoso> | Athas: What are the rules of that function? |
| 2021-08-24 07:31:06 | <tomsmeding> | dminuoso's and Athas's last messages seem strangely related |
| 2021-08-24 07:31:17 | <Athas> | dminuoso: I don't care about the edge cases, if that's what you mean. |
| 2021-08-24 07:31:25 | <dminuoso> | Athas: No I really dont know what that function is supposed to do |
| 2021-08-24 07:31:32 | <Athas> | Clearly I should add a dependency on topograph to get it! |
| 2021-08-24 07:31:52 | <dminuoso> | Athas: I can think of at least a handful of differnet implementations that would produce that result given [1,2,3,4] |
| 2021-08-24 07:32:02 | <Athas> | dminuoso: this is its specification: pairs [] = []; pairs (x:y:l) = (x,y) : pairs l |
| 2021-08-24 07:32:04 | <dminuoso> | What would the function produce given [1,2,3], or [1...100]? |
| 2021-08-24 07:32:22 | <dminuoso> | I see |
| 2021-08-24 07:32:23 | <Rembane_> | arahael: Yay! It just struck me, you can lower the number of allowed open files using the command ulimit, this will make testing faster. |
| 2021-08-24 07:32:35 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection) |
| 2021-08-24 07:33:21 | <arahael> | Rembane_: Im' actually wondering how to make it multithreaded, as I have several cores. |
| 2021-08-24 07:33:28 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 2021-08-24 07:33:38 | <dminuoso> | Athas: does it have to be tuples, or can it be lists too? |
| 2021-08-24 07:33:53 | <Rembane_> | arahael: That will certainly make your troubleshooting more interesting. :) |
| 2021-08-24 07:34:00 | <arahael> | Rembane_: Then, my next thing will be to more simplistically configure my client apps not to open so many connections. :) |
| 2021-08-24 07:34:11 | <Athas> | dminuoso: Is there space for that kind of wiggle room in type type? |
| 2021-08-24 07:34:29 | <dminuoso> | Athas: I can conjure up some `Int -> [a] -> [[a]]` fairly easily? |
| 2021-08-24 07:34:37 | <dminuoso> | I know you know this too |
| 2021-08-24 07:34:43 | <dminuoso> | So Im thinking we have our wires crossed |
| 2021-08-24 07:34:46 | <arahael> | Yesod's website says this: "The Haskell runtime is asynchronous automatically. Instead of dealing with... blah blah blah"... So I'm wondering how, now. :) |
| 2021-08-24 07:34:52 | <Athas> | But the type must be '[a] -> [(a,a)]'. |
| 2021-08-24 07:35:08 | <dminuoso> | So that's a no on "can it be lists too". |
| 2021-08-24 07:35:11 | <Rembane_> | arahael: Or make them close them faster. IIRC the web server that Yesod is built upon opens a green thread for each connection, so if you compile the project using -threaded you should get one executing thread per core. |
| 2021-08-24 07:35:35 | <arahael> | Rembane_: Thanks, will look that up... |
| 2021-08-24 07:35:38 | <Drew[m]> | tomsmeding: you said a few days ago that you were able to use HLS without issue on ghcup when you compiled it under GHC 9.0.1. I tried it and I get dependency resolution errors for days. How were you building it? |
| 2021-08-24 07:36:32 | <dminuoso> | timCF: As a simplification, you can think of every lens/traversal as something sort of like "traverse", and functions like `view/over` just use this "traverse-like" thing by providing it some `f`. |
| 2021-08-24 07:36:50 | → | cfricke joins (~cfricke@user/cfricke) |
| 2021-08-24 07:36:51 | <arahael> | Rembane_: Ah, so I have to set ghc-options in the cabal file. |
| 2021-08-24 07:38:01 | <dminuoso> | Athas: Im not seeing any non-convoluted option to construct `pairs` other than just writing it out like you did. |
| 2021-08-24 07:38:36 | <Rembane_> | arahael: Exactly. |
| 2021-08-24 07:39:03 | <arahael> | Hmm, odd... Rembane_ If I compile it with -threaded, shouldn't it consume something like 400% CPU if I have closer to four cores and they're all otherwise idle? |
| 2021-08-24 07:39:14 | <timCF> | dminuoso: thanks for simple explanations) |
| 2021-08-24 07:39:37 | × | son0p quits (~ff@181.136.122.143) (Ping timeout: 252 seconds) |
| 2021-08-24 07:40:39 | × | azeem quits (~azeem@176.201.15.223) (Read error: Connection reset by peer) |
| 2021-08-24 07:40:50 | <Rembane_> | arahael: It should, if they have something to do. Are they idle? |
| 2021-08-24 07:41:38 | × | cfricke quits (~cfricke@user/cfricke) (Client Quit) |
| 2021-08-24 07:41:38 | <arahael> | Rembane_: My load average is only 1.58 |
| 2021-08-24 07:42:11 | <arahael> | (And the CPU utilisation for the particular yesod server never goes above 100%, except sometimes 100.3%, which I guess is a rounding error) |
| 2021-08-24 07:42:52 | <arahael> | Nothing else is consuming significant CPU now. I've even killed the test script, though the yesod service hasn't noticed yet as it's still chewing through a pile of old connections. |
| 2021-08-24 07:43:17 | → | azeem joins (~azeem@dynamic-adsl-94-34-33-6.clienti.tiscali.it) |
| 2021-08-24 07:44:07 | <Rembane_> | arahael: Run the program with the -N4 command line argument and see if it gets better. |
| 2021-08-24 07:44:54 | <arahael> | Rembane_: As in, `cabal run -N4 familyserver...`? |
| 2021-08-24 07:45:14 | <Rembane_> | arahael: I think so, or perhaps use -- -N4 at the end of the command |
| 2021-08-24 07:45:21 | <Rembane_> | arahael: More on multicore here: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/using-concurrent.html |
| 2021-08-24 07:45:28 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-08-24 07:46:53 | <arahael> | Ah, interesting, so I probably should use something like `+RTS -N4 -RTS` |
| 2021-08-24 07:47:25 | <tomsmeding> | Drew[m]: 'cp cabal.project.ghc901 cabal.project; cabal build' |
| 2021-08-24 07:47:35 | <Rembane_> | arahael: YEs! |
| 2021-08-24 07:47:35 | <tomsmeding> | (after 'git pull; cabal update') |
| 2021-08-24 07:47:57 | <tomsmeding> | Drew[m]: let me guess: you missed the cabal.project.ghc901 :p (I missed it for a while too) |
| 2021-08-24 07:48:43 | <tomsmeding> | arahael: cabal run familyserver |
| 2021-08-24 07:48:47 | <tomsmeding> | arahael: cabal run familyserver -- +RTS -N4 |
| 2021-08-24 07:48:48 | <tomsmeding> | sorry |
| 2021-08-24 07:49:02 | <tomsmeding> | oh you got that already :p |
| 2021-08-24 07:50:15 | → | cfricke joins (~cfricke@user/cfricke) |
| 2021-08-24 07:50:18 | <arahael> | Odd, I had to put that at the very end, not at the start of the arguments, but using `-- +RTS -N4` makes a huge difference, it's now using almost 400% of the CPU. |
| 2021-08-24 07:50:39 | <Rembane_> | Ha! Win! :D |
| 2021-08-24 07:50:59 | <arahael> | And it's substantially faster now. |
| 2021-08-24 07:51:50 | <arahael> | Taking forever to handle a new connection when there's a massive backlog, though. |
| 2021-08-24 07:52:06 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-08-24 07:52:09 | <Rembane_> | Does the program talk to anything else? Like a database. |
| 2021-08-24 07:52:13 | <arahael> | (So I think each of the 4 threads is still themselves inherently sequential) |
| 2021-08-24 07:52:16 | <arahael> | Nope. All memory. |
| 2021-08-24 07:52:29 | <Rembane_> | They probably are. Think of each connection as its own thread. |
| 2021-08-24 07:52:49 | <arahael> | Yeah, they don't seem to be that concurrent. |
| 2021-08-24 07:52:51 | × | timCF quits (~timCF@m91-129-108-244.cust.tele2.ee) (Quit: leaving) |
| 2021-08-24 07:52:59 | → | __monty__ joins (~toonn@user/toonn) |
| 2021-08-24 07:55:21 | → | kuribas joins (~user@ip-188-118-57-242.reverse.destiny.be) |
| 2021-08-24 07:56:41 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 250 seconds) |
| 2021-08-24 07:58:51 | <merijn> | arahael: oh, wanna bet I know the problem? |
| 2021-08-24 07:59:05 | <merijn> | arahael: Run with "+RTS -sstderr" |
| 2021-08-24 07:59:18 | <merijn> | And then pastebin the GC log at the end :p |
| 2021-08-24 07:59:48 | <arahael> | Yep, I'm happy with this. Also I've noticed that my client program has `config.httpMaximumConnectionsPerHost = 50` which explains why I was getting `wc -l` to report 52. |
| 2021-08-24 08:00:13 | <arahael> | merijn: I didn't get a GC log! |
| 2021-08-24 08:00:37 | <merijn> | arahael: Does your program terminate or do you SIGINT it? |
| 2021-08-24 08:00:53 | <arahael> | merijn: I think it's SIGINT, ie, I kill it by using ^c. |
| 2021-08-24 08:01:02 | <arahael> | It otherwise never terminates. |
| 2021-08-24 08:01:06 | <merijn> | yeah, it doesn't report a log then :p |
| 2021-08-24 08:01:07 | <arahael> | (Unless it runs out of file handles) |
| 2021-08-24 08:01:26 | <merijn> | I forgot how to make it print a GC log early, though |
| 2021-08-24 08:01:39 | → | reumeth joins (~reumeth@user/reumeth) |
| 2021-08-24 08:01:40 | <arahael> | Will do that another day, then. :) It's bound to be interesting. |
| 2021-08-24 08:03:22 | <merijn> | arahael: The real question I wanted to know is: Is it spending ages GCing, because then you're getting hurt by "the parallel GC is garbage and shouldn't be enabled" |
| 2021-08-24 08:03:48 | <merijn> | You can try using "+RTS -qg" and see if it's faster that way |
| 2021-08-24 08:03:58 | <Drew[m]> | tomsmeding: I noticed that but it turns out I didn't know the propper way to select the right project file in a folder with two of them |
| 2021-08-24 08:03:59 | <arahael> | merijn: Ah, no, I doubt it, I'm subjectively seeing much more work being done. |
| 2021-08-24 08:04:16 | <arahael> | merijn: Ie, my client app seems faster, and the logs from the server are definitely visibily significantly faster. |
| 2021-08-24 08:04:32 | <merijn> | arahael: Sure, but maybe they could be *even* faster :p |
| 2021-08-24 08:05:20 | <arahael> | Heh. :) |
| 2021-08-24 08:05:28 | <jchia[m]> | QuickCheck question: How can I set the random seed for running quickCheck? QCGen seems to be an opaque type and google shows many outdated answers that don't work. I just want quickcheck to run with the same failing input every time so that I can debug. |
All times are in UTC.