Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,801,035 events total
2025-12-21 18:23:50 <c_wraith> see https://hackage-content.haskell.org/package/ghc-internal-9.1401.0/docs/src/GHC.Internal.Base.html#map for an example. In particular, pay attention to the long section of comments.
2025-12-21 18:24:16 <c_wraith> build itself is documented at https://hackage-content.haskell.org/package/base-4.22.0.0/docs/GHC-List.html#v:build
2025-12-21 18:24:21 <milan2> Ty :)
2025-12-21 18:24:59 <probie> @src foldl
2025-12-21 18:24:59 <lambdabot> foldl f z [] = z
2025-12-21 18:24:59 <lambdabot> foldl f z (x:xs) = foldl f (f z x) xs
2025-12-21 18:25:30 <c_wraith> yeah, the @src database is not what GHC actually uses, either.
2025-12-21 18:27:02 <probie> Yeah, looking at the source for base `foldl k z0 xs = foldr (\(v::a) (fn::b->b) -> oneShot (\(z::b) -> fn (k z v))) (id :: b -> b) xs z0`
2025-12-21 18:27:08 <probie> which is the sort of think I was expecting to see
2025-12-21 18:27:24 <probie> s/think/thing/
2025-12-21 18:28:00 <c_wraith> the @src database is older than the optimizations in GHC that allow foldl-via-foldr to be a good consumer.
2025-12-21 18:28:36 <c_wraith> that optimization was... uh.... "precise arity analysis"?
2025-12-21 18:29:18 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds)
2025-12-21 18:29:38 <c_wraith> https://www.joachim-breitner.de/publications/CallArity-TFP.pdf Well. Sometimes it gets called that.
2025-12-21 18:30:33 <milan2> c_wraith: I think I understand what build does, so for chaining foldr multiple lists are created. But that should not matter as they are produced lazily?
2025-12-21 18:32:20 <c_wraith> it minimizes garbage collector churn
2025-12-21 18:33:00 <c_wraith> every one of those (:) that's actually allocated still goes on the heap and still needs to be collected later.
2025-12-21 18:34:23 <c_wraith> For tight loops, that can make a big difference.
2025-12-21 18:36:04 <c_wraith> I've definitely written code where using build cut the run time by about 65%.... given the specific way the list was later being consumed.
2025-12-21 18:36:52 <milan2> That is considerable.
2025-12-21 18:37:09 <c_wraith> .... also, it was the runtime of that specific operation. Not the whole program. I should be clear, it was a micro-optimization.
2025-12-21 18:40:01 <c_wraith> But the moral of the story - there are a lot of ways to consume and produce lists. Which one is best can be pretty context-dependent. For broad rules: use the least powerful tool that gets the job done.
2025-12-21 18:40:34 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 18:41:07 <milan2> I guess, I am still noob and optimizations are not needed for Advent of Code :D
2025-12-21 18:44:31 <c_wraith> Yeah. In the context of aoc, just avoid the big performance pitfalls and you'll be fine. I mean, people use *far* slower runtimes than what you get out of GHC without trouble. Algorithm choice is the big deal.
2025-12-21 18:45:15 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2025-12-21 18:46:02 <c_wraith> I was actually amused my testing for Day 8, part 2 showed that the classic hyper-optimized mutable reference algorithms weren't any faster than just using Data.Map. At least at that size of problem.
2025-12-21 18:53:28 <monochrom> If you consult base source code for performance prediction, don't forget to look for RULES which can totally override normal source code.
2025-12-21 18:55:54 CiaoSen joins (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db)
2025-12-21 18:56:05 <monochrom> In the case of lists, those rules will suggest that the best way to build list is to use `build`, ironically literally. >:)
2025-12-21 18:56:21 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 19:01:16 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds)
2025-12-21 19:04:06 × CiaoSen quits (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 256 seconds)
2025-12-21 19:06:10 × FloorCalc quits (~user@user/FloorCalc) (Remote host closed the connection)
2025-12-21 19:06:35 FloorCalc joins (~user@user/FloorCalc)
2025-12-21 19:06:59 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 19:10:25 jmcantrell_ joins (~weechat@user/jmcantrell)
2025-12-21 19:12:01 × shaeto quits (~Shaeto@94.25.234.244) (Quit: WeeChat 4.1.1)
2025-12-21 19:12:07 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 265 seconds)
2025-12-21 19:12:23 jmcantrell_ is now known as jmcantrell
2025-12-21 19:21:14 × jmcantrell quits (~weechat@user/jmcantrell) (Ping timeout: 260 seconds)
2025-12-21 19:22:58 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 19:24:53 × trickard quits (~trickard@cpe-81-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-12-21 19:25:06 trickard_ joins (~trickard@cpe-81-98-47-163.wireline.com.au)
2025-12-21 19:25:21 vanishingideal joins (~vanishing@user/vanishingideal)
2025-12-21 19:27:37 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 246 seconds)
2025-12-21 19:34:01 Lord_of_Life_ joins (~Lord@user/lord-of-life/x-2819915)
2025-12-21 19:34:13 × Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 264 seconds)
2025-12-21 19:34:31 <haskellbridge> <Artem> c_wraith: I've rediscovered this several times over the years I did AoC
2025-12-21 19:35:38 ljdarj joins (~Thunderbi@user/ljdarj)
2025-12-21 19:36:50 Lord_of_Life_ is now known as Lord_of_Life
2025-12-21 19:38:08 × _d0t quits (~{-d0t-}@user/-d0t-/x-7915216) (Ping timeout: 260 seconds)
2025-12-21 19:38:34 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 19:38:42 pavonia joins (~user@user/siracusa)
2025-12-21 19:40:12 × ljdarj quits (~Thunderbi@user/ljdarj) (Client Quit)
2025-12-21 19:42:08 _d0t joins (~{-d0t-}@user/-d0t-/x-7915216)
2025-12-21 19:42:35 ljdarj joins (~Thunderbi@user/ljdarj)
2025-12-21 19:43:19 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2025-12-21 19:44:52 Sgeo joins (~Sgeo@user/sgeo)
2025-12-21 19:46:03 Ekho joins (~Ekho@user/ekho)
2025-12-21 19:54:22 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 19:55:43 <milan2> Could anybody check correct answer for aoc 2015 day 3 part 2? I don't believe I have wrong answer. It compiled so it must be correct! Right?! Right?!
2025-12-21 19:56:21 × lambda_gibbon quits (~lambda_gi@2603:7080:ee00:37d8:dcc4:d31b:c3d9:56cd) (Ping timeout: 252 seconds)
2025-12-21 19:57:44 lambda_gibbon joins (~lambda_gi@2603:7080:ee00:37d8:dcc4:d31b:c3d9:56cd)
2025-12-21 19:59:55 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2025-12-21 20:00:13 × ljdarj quits (~Thunderbi@user/ljdarj) (Quit: ljdarj)
2025-12-21 20:00:39 ljdarj1 joins (~Thunderbi@user/ljdarj)
2025-12-21 20:02:59 ljdarj1 is now known as ljdarj
2025-12-21 20:07:26 ljdarj1 joins (~Thunderbi@user/ljdarj)
2025-12-21 20:08:00 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 20:08:47 ystael joins (~ystael@user/ystael)
2025-12-21 20:09:38 × ljdarj quits (~Thunderbi@user/ljdarj) (Ping timeout: 260 seconds)
2025-12-21 20:09:39 ljdarj1 is now known as ljdarj
2025-12-21 20:12:38 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds)
2025-12-21 20:16:18 <milan2> Ah list I constructed by self recursive function was reversed.
2025-12-21 20:23:00 × rainbyte quits (~rainbyte@186.22.19.214) (Quit: rainbyte)
2025-12-21 20:23:23 rainbyte joins (~rainbyte@186.22.19.214)
2025-12-21 20:23:47 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 20:28:10 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 246 seconds)
2025-12-21 20:31:27 karenw joins (~karenw@user/karenw)
2025-12-21 20:39:18 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 20:44:04 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds)
2025-12-21 20:46:53 × trickard_ quits (~trickard@cpe-81-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-12-21 20:47:06 trickard_ joins (~trickard@cpe-81-98-47-163.wireline.com.au)
2025-12-21 20:49:15 Everything joins (~Everythin@172-232-54-192.ip.linodeusercontent.com)
2025-12-21 20:50:10 × gorignak quits (~gorignak@user/gorignak) (Quit: quit)
2025-12-21 20:54:53 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 21:00:01 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds)
2025-12-21 21:07:43 × lambda_gibbon quits (~lambda_gi@2603:7080:ee00:37d8:dcc4:d31b:c3d9:56cd) (Ping timeout: 246 seconds)
2025-12-21 21:09:00 merijn joins (~merijn@host-cl.cgnat-g.v4.dfn.nl)
2025-12-21 21:11:44 × milan2 quits (~milan@88.212.61.169) (Quit: WeeChat 4.5.2)
2025-12-21 21:24:17 <cheater> ne1 here try granule
2025-12-21 21:27:19 × karenw quits (~karenw@user/karenw) (Ping timeout: 246 seconds)
2025-12-21 21:29:24 <EvanR> if it compiles it must be true
2025-12-21 21:37:12 lambda_gibbon joins (~lambda_gi@2603:7080:ee00:37d8:dcc4:d31b:c3d9:56cd)
2025-12-21 21:41:10 × merijn quits (~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 245 seconds)
2025-12-21 21:41:57 × lambda_gibbon quits (~lambda_gi@2603:7080:ee00:37d8:dcc4:d31b:c3d9:56cd) (Ping timeout: 252 seconds)
2025-12-21 21:43:34 × trickard_ quits (~trickard@cpe-81-98-47-163.wireline.com.au) (Ping timeout: 260 seconds)
2025-12-21 21:43:57 trickard_ joins (~trickard@cpe-81-98-47-163.wireline.com.au)
2025-12-21 21:45:23 <int-e> hmm, reversing the input (at least that's what I think it was) is a fun one.

All times are in UTC.