Home liberachat/#haskell: Logs Calendar

Logs on 2024-09-03 (liberachat/#haskell)

00:04:26 machinedgod joins (~machinedg@d50-99-47-73.abhsia.telus.net)
00:08:07 EvanR joins (~EvanR@user/evanr)
00:09:59 × xff0x quits (~xff0x@2405:6580:b080:900:9984:ac36:164d:127b) (Ping timeout: 260 seconds)
00:13:06 × tomboy64 quits (~tomboy64@user/tomboy64) (Ping timeout: 276 seconds)
00:20:41 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
00:25:03 × sawilagar quits (~sawilagar@user/sawilagar) (Ping timeout: 246 seconds)
00:26:50 d34df00d joins (~d34df00d@2600:1702:4f1b:7c10::43)
00:27:24 <d34df00d> Hi!
00:27:36 <d34df00d> What's the easiest way to see what base version corresponds to which ghc release?
00:28:41 <mauke> @where base
00:28:41 <lambdabot> http://darcs.haskell.org/packages/base/
00:28:53 <mauke> @where+ base https://hackage.haskell.org/package/base
00:28:53 <lambdabot> Done.
00:29:42 <mauke> https://hackage.haskell.org/package/base-4.20.0.1/changelog search for "with GHC"
00:29:51 <geekosaur> ghcup shows which base comes with each ghc version
00:29:58 <d34df00d> Oh dang, changelong is something i haven't checked!
00:30:04 <d34df00d> Thanks, that works.
00:30:17 <geekosaur> there's also a table on the ghc wiki showing what bootlibs show with all ghc releases back to (iirc) 7.0
00:30:27 <geekosaur> *go with
00:30:56 × emmanuelux quits (~emmanuelu@user/emmanuelux) (Quit: au revoir)
00:32:06 <d34df00d> ghcup is even nicer, especially since I have it installed on one of my machines I guess.
00:32:10 <d34df00d> Thanks folks!
00:59:34 × vglfr quits (~vglfr@2601:14d:4e01:1370:472:1f80:8d8f:3004) (Ping timeout: 260 seconds)
01:00:45 vglfr joins (~vglfr@c-73-163-164-68.hsd1.md.comcast.net)
01:07:06 × Sgeo quits (~Sgeo@user/sgeo) (Quit: Leaving)
01:11:13 × athan quits (~athan@syn-098-153-145-140.biz.spectrum.com) (Quit: Konversation terminated!)
01:18:17 Sgeo joins (~Sgeo@user/sgeo)
01:37:53 nyc joins (~nyc@user/nyc)
02:11:15 × dostoyevsky2 quits (~sck@user/dostoyevsky2) (Quit: leaving)
02:11:33 dostoyevsky2 joins (~sck@user/dostoyevsky2)
02:19:29 slack1256 joins (~slack1256@2803:c600:5111:8029:8afc:ef98:52db:3f44)
02:22:46 × finsternis quits (~X@23.226.237.192) (Read error: Connection reset by peer)
02:26:52 × slack1256 quits (~slack1256@2803:c600:5111:8029:8afc:ef98:52db:3f44) (Remote host closed the connection)
02:27:04 × vglfr quits (~vglfr@c-73-163-164-68.hsd1.md.comcast.net) (Ping timeout: 260 seconds)
02:28:03 vglfr joins (~vglfr@2607:fb91:834:1618:ac39:6af7:e3fa:db4a)
02:47:45 × machinedgod quits (~machinedg@d50-99-47-73.abhsia.telus.net) (Ping timeout: 248 seconds)
02:50:47 × sourcetarius quits (~sourcetar@user/sourcetarius) (Quit: nyaa~)
02:56:03 × td_ quits (~td@i5387090A.versanet.de) (Ping timeout: 252 seconds)
02:56:29 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
02:57:42 td_ joins (~td@i5387093B.versanet.de)
03:00:54 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 260 seconds)
03:07:48 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 246 seconds)
03:11:59 tomboy64 joins (~tomboy64@user/tomboy64)
03:25:24 × Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 260 seconds)
03:26:09 × Square2 quits (~Square4@user/square) (Ping timeout: 276 seconds)
03:27:50 Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915)
03:44:54 × walee_ quits (~waleee@h-176-10-144-38.na.cust.bahnhof.se) (Ping timeout: 252 seconds)
03:51:30 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
03:53:57 × aforemny quits (~aforemny@2001:9e8:6cf4:df00:6f30:d808:ba6b:50ac) (Ping timeout: 248 seconds)
03:54:51 aforemny joins (~aforemny@i59F516FA.versanet.de)
03:56:33 × hgolden_ quits (~hgolden@23.162.40.110) (Ping timeout: 248 seconds)
04:03:28 elnegro joins (elnegro@r186-54-32-144.dialup.adsl.anteldata.net.uy)
04:05:48 × elnegro quits (elnegro@r186-54-32-144.dialup.adsl.anteldata.net.uy) (Client Quit)
04:22:25 hgolden joins (~hgolden@23.162.40.69)
04:22:31 × gmg quits (~user@user/gehmehgeh) (Ping timeout: 260 seconds)
04:22:33 hgolden_ joins (~hgolden@23.162.40.69)
04:22:48 Pixi joins (~Pixi@user/pixi)
04:23:14 × hgolden quits (~hgolden@23.162.40.69) (Client Quit)
04:23:14 × hgolden_ quits (~hgolden@23.162.40.69) (Client Quit)
04:23:35 hgolden joins (~hgolden@23.162.40.69)
04:25:10 × Pixi` quits (~Pixi@user/pixi) (Ping timeout: 272 seconds)
04:29:31 michalz joins (~michalz@185.246.207.218)
04:33:20 gmg joins (~user@user/gehmehgeh)
04:35:49 <haskellbridge> <Bowuigi> thirdofmay18081814goya type families can't be modeled by base system F (well, anything above basic kinds can't because they are mostly unspecified)
04:36:34 <haskellbridge> <thirdofmay18081814goya> hm i see, ty!
04:38:09 <haskellbridge> <Bowuigi> Another big one is datatypes with complex recursion, specially "codata" (streams and all that) which require some form of lazy recursion to work
04:39:02 <haskellbridge> <Bowuigi> On the same line, since system F is total you can't represent most of the useful anamorphisms (and above) without resorting to catamorphisms over natural numbers
04:41:31 <haskellbridge> <Bowuigi> On the same line (2: electric boogaloo) nontermination can't be modelled with system F
04:45:03 <haskellbridge> <Bowuigi> As for stuff that belongs to macro/multi-stage level, system F doesn't have proper mechanisms to ensure that deriving works (i.e, matches a specific pattern, like the signature of fmap) other than foralls, which fall short sadly. This also excludes any kind of efficient runtime generics like the ones you can get with row types or GHC magic
04:45:22 takuan joins (~takuan@178-116-218-225.access.telenet.be)
04:49:58 × michalz quits (~michalz@185.246.207.218) (Remote host closed the connection)
04:50:07 <haskellbridge> <Bowuigi> Finally, syntax wise it becomes uncool (but technically it can still do everything given some cleverness): system F can accomodate modules awkwardly, passing Böhm-Berarducci encoded structures holding functions exported by the module and then wiring it up like a messy analog synthesizer setup, but doesn't have most of the "syntax sugar" we are used to, like "let", "where", "case..of", "do", etc
04:52:43 michalz joins (~michalz@185.246.207.215)
04:54:59 athan joins (~athan@syn-098-153-145-140.biz.spectrum.com)
05:01:44 × weary-traveler quits (~user@user/user363627) (Remote host closed the connection)
05:09:49 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 260 seconds)
05:22:36 × gmg quits (~user@user/gehmehgeh) (Ping timeout: 260 seconds)
05:29:40 gmg joins (~user@user/gehmehgeh)
05:30:59 × jinsun quits (~jinsun@user/jinsun) (Ping timeout: 260 seconds)
05:34:16 × gmg quits (~user@user/gehmehgeh) (Ping timeout: 260 seconds)
05:41:20 gmg joins (~user@user/gehmehgeh)
05:43:35 × Pixi quits (~Pixi@user/pixi) (Quit: Leaving)
05:44:39 × vglfr quits (~vglfr@2607:fb91:834:1618:ac39:6af7:e3fa:db4a) (Read error: Connection reset by peer)
05:44:59 vglfr joins (~vglfr@c-73-163-164-68.hsd1.md.comcast.net)
06:09:30 × DragonMaus quits (~dragonmau@user/dragonmaus) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
06:10:56 DragonMaus joins (~dragonmau@user/dragonmaus)
06:27:09 oo_miguel joins (~Thunderbi@78.10.207.45)
06:31:52 sord937 joins (~sord937@gateway/tor-sasl/sord937)
06:43:41 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
06:44:57 × terrorjack4 quits (~terrorjac@2a01:4f8:c17:dc9f::) (Remote host closed the connection)
06:47:53 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 245 seconds)
06:54:00 CrunchyFlakes joins (~CrunchyFl@ip-109-42-114-20.web.vodafone.de)
06:54:39 lortabac joins (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4)
06:58:19 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
07:26:19 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Read error: Connection reset by peer)
07:39:24 misterfish joins (~misterfis@87.215.131.102)
07:55:06 merijn joins (~merijn@77.242.116.146)
07:58:09 machinedgod joins (~machinedg@d50-99-47-73.abhsia.telus.net)
08:09:14 × rvalue quits (~rvalue@user/rvalue) (Read error: Connection reset by peer)
08:09:46 rvalue joins (~rvalue@user/rvalue)
08:09:58 lortabac joins (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4)
08:12:08 × Lears quits (~Leary@user/Leary/x-0910699) (Remote host closed the connection)
08:12:31 lxsameer joins (~lxsameer@Serene/lxsameer)
08:12:34 Leary joins (~Leary@user/Leary/x-0910699)
08:16:59 × Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer)
08:19:27 chele joins (~chele@user/chele)
08:21:46 Pixi joins (~Pixi@user/pixi)
08:21:52 × tzh quits (~tzh@c-76-115-131-146.hsd1.or.comcast.net) (Quit: zzz)
08:24:27 × ft quits (~ft@p4fc2a393.dip0.t-ipconnect.de) (Quit: leaving)
08:24:53 × pointlessslippe1 quits (~pointless@212.82.82.3) (Ping timeout: 248 seconds)
08:25:48 sourcetarius joins (~sourcetar@user/sourcetarius)
08:29:03 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 276 seconds)
08:35:15 rosco joins (~rosco@175.136.158.234)
08:35:29 merijn joins (~merijn@77.242.116.146)
08:36:00 pointlessslippe1 joins (~pointless@62.106.85.17)
08:36:16 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
08:44:40 kaskal joins (~kaskal@2001:4bb8:2c3:301f:8bb3:b252:9e17:9e38)
08:45:53 × kaskal quits (~kaskal@2001:4bb8:2c3:301f:8bb3:b252:9e17:9e38) (Client Quit)
09:02:11 ubert joins (~Thunderbi@178.165.175.79.wireless.dyn.drei.com)
09:09:00 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 246 seconds)
09:10:41 × sourcetarius quits (~sourcetar@user/sourcetarius) (Quit: zzz)
09:13:26 sawilagar joins (~sawilagar@user/sawilagar)
09:15:03 ash3en joins (~Thunderbi@89.246.174.164)
09:20:57 merijn joins (~merijn@77.242.116.146)
09:25:54 × ash3en quits (~Thunderbi@89.246.174.164) (Ping timeout: 260 seconds)
09:26:04 × pointlessslippe1 quits (~pointless@62.106.85.17) (Ping timeout: 260 seconds)
09:28:40 pointlessslippe1 joins (~pointless@62.106.85.17)
09:37:41 ash3en joins (~Thunderbi@89.246.174.164)
09:40:59 __monty__ joins (~toonn@user/toonn)
09:42:13 × ash3en quits (~Thunderbi@89.246.174.164) (Ping timeout: 248 seconds)
09:42:14 × yazz quits (jarek@user/yazz) (Ping timeout: 260 seconds)
09:43:06 yazz joins (jarek@user/yazz)
09:44:55 akegalj joins (~akegalj@20-82.dsl.iskon.hr)
09:48:33 Smiles joins (uid551636@id-551636.lymington.irccloud.com)
09:56:36 × CrunchyFlakes quits (~CrunchyFl@ip-109-42-114-20.web.vodafone.de) (Read error: Connection reset by peer)
09:57:17 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 255 seconds)
09:58:57 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
09:58:57 × rosco quits (~rosco@175.136.158.234) (Quit: Lost terminal)
10:09:39 × misterfish quits (~misterfis@87.215.131.102) (Ping timeout: 260 seconds)
10:10:32 merijn joins (~merijn@77.242.116.146)
10:11:15 misterfish joins (~misterfis@178.225.40.136)
10:11:40 kuribas joins (~user@ip-188-118-57-242.reverse.destiny.be)
10:13:08 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Quit: WeeChat 4.2.2)
10:24:44 ZharMeny joins (~ZharMeny@user/ZharMeny)
10:35:59 jespada joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
10:38:06 × sawilagar quits (~sawilagar@user/sawilagar) (Remote host closed the connection)
10:38:30 sawilagar joins (~sawilagar@user/sawilagar)
10:40:21 × jespada quits (~jespada@r190-64-133-178.su-static.adinet.com.uy) (Ping timeout: 246 seconds)
10:42:34 terrorjack4 joins (~terrorjac@2a01:4f8:c17:dc9f::)
10:50:08 × yazz quits (jarek@user/yazz) (Read error: Connection reset by peer)
10:53:20 lortabac joins (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4)
10:54:49 jarek joins (jarek@user/yazz)
10:58:26 jespada joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
10:59:36 × terrorjack4 quits (~terrorjac@2a01:4f8:c17:dc9f::) (Ping timeout: 246 seconds)
11:00:56 rosco joins (~rosco@175.136.158.234)
11:03:19 × jespada quits (~jespada@r190-64-133-178.su-static.adinet.com.uy) (Ping timeout: 260 seconds)
11:11:24 × statusbot quits (~statusbot@ec2-34-198-122-184.compute-1.amazonaws.com) (Remote host closed the connection)
11:11:35 statusbot joins (~statusbot@ec2-34-198-122-184.compute-1.amazonaws.com)
11:12:22 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
11:18:04 xff0x joins (~xff0x@2405:6580:b080:900:3618:2400:ae18:e1a3)
11:19:36 jarek is now known as yazz
11:23:49 terrorjack4 joins (~terrorjac@static.48.15.202.116.clients.your-server.de)
11:32:39 rvalue- joins (~rvalue@user/rvalue)
11:32:39 × statusbot quits (~statusbot@ec2-34-198-122-184.compute-1.amazonaws.com) (Read error: Connection reset by peer)
11:32:47 statusbot6 joins (~statusbot@ec2-34-198-122-184.compute-1.amazonaws.com)
11:33:43 × rvalue quits (~rvalue@user/rvalue) (Ping timeout: 264 seconds)
11:34:15 jespada joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
11:36:35 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
11:38:21 rvalue- is now known as rvalue
11:38:57 × jespada quits (~jespada@r190-64-133-178.su-static.adinet.com.uy) (Ping timeout: 248 seconds)
11:42:34 × ski quits (~ski@217.65.136.250) (Ping timeout: 260 seconds)
11:50:30 × sord937 quits (~sord937@gateway/tor-sasl/sord937) (Remote host closed the connection)
11:50:34 × kuribas quits (~user@ip-188-118-57-242.reverse.destiny.be) (Remote host closed the connection)
11:50:51 sord937 joins (~sord937@gateway/tor-sasl/sord937)
11:55:30 × misterfish quits (~misterfis@178.225.40.136) (Ping timeout: 252 seconds)
11:55:41 Square2 joins (~Square4@user/square)
11:57:12 misterfish joins (~misterfis@87.215.131.102)
11:57:42 × nyc quits (~nyc@user/nyc) (Ping timeout: 246 seconds)
12:01:33 jespada joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
12:03:06 ash3en joins (~Thunderbi@193.32.248.193)
12:05:04 kuribas joins (~user@ip-188-118-57-242.reverse.destiny.be)
12:06:43 × jespada quits (~jespada@r190-64-133-178.su-static.adinet.com.uy) (Ping timeout: 264 seconds)
12:13:45 alexherbo2 joins (~alexherbo@2a02-8440-3119-49bf-4476-2d18-4679-c6a2.rev.sfr.net)
12:15:29 × ash3en quits (~Thunderbi@193.32.248.193) (Quit: ash3en)
12:22:06 CrunchyFlakes joins (~CrunchyFl@ip-109-42-114-20.web.vodafone.de)
12:28:10 ash3en joins (~Thunderbi@193.32.248.193)
12:33:24 jespada joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
12:38:24 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
12:46:11 × ash3en quits (~Thunderbi@193.32.248.193) (Quit: ash3en)
12:49:09 × sawilagar quits (~sawilagar@user/sawilagar) (Remote host closed the connection)
12:49:32 sawilagar joins (~sawilagar@user/sawilagar)
12:56:01 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
13:00:09 × Leary quits (~Leary@user/Leary/x-0910699) (Remote host closed the connection)
13:01:00 Leary joins (~Leary@user/Leary/x-0910699)
13:03:32 weary-traveler joins (~user@user/user363627)
13:04:00 × myxos quits (~myxos@syn-065-028-251-121.res.spectrum.com) (Ping timeout: 276 seconds)
13:07:27 <[exa]> hey all, is there any nice functional algorithm for a random generator that produces a sequence of length (n1+n2+n3+n4+...) with numbers 1,2,3,4,..., each respectively occuring exactly n1,n2,n3,... times? Problem: there isn't too many buckets (individual `n`'s), but the total sum of `n`s is galactic-scale (I won't ever hopefully fit a "permutation" into the memory)
13:09:57 <[exa]> currently I guess I'll just keep a list of how many of each buckets needs to get generated and split the random generated number from (1..sum ns) into categories. Better ideas welcome. For more buckets I'd go for some kind of prefix-sum tree but since there's gonna be like 5 of them max, I don't care.
13:14:48 <[exa]> Other question: I've got very nice brackety functions that safely open & close a resource and leave you to do something, such as `withFile "foo.txt" $ \f -> do ....`. Is there some kind of a monad combinator that would transform this to `withFiles ["foo1.txt", ...] $ \[f1, ...] -> do ...` ?
13:18:20 <[exa]> (in short I have say `(a -> (b -> IO c) -> IO c)` and want to construct `[a] -> ([b] -> IO c) -> IO c` from it)
13:20:10 <merijn> [exa]: hmm, I don't quite understand your formulation of the random number generator?
13:21:31 <merijn> So you have a N numbers and for each of those numbers you want that number of duplicate values?
13:22:21 <merijn> [exa]: It sounds like you could *maybe* use a trick I learned, but I'm not quite sure it fits your actual problem description
13:23:03 <merijn> [exa]: As for your bracket question, if you google `ContT` and bracket you can find some nice tricks
13:24:06 <[exa]> merijn: other view, basically I have a sequence of numbers [1..gazillion] and want to split it into disjunct sequences of given sizes. The gazillion is too big, so loading it to memory and "just mixing" is not an option.
13:24:13 <[exa]> re the bracket, thanks a lot, will google
13:24:25 <[exa]> (it really looked like Cont but I'm not good with Cont. :D)
13:25:32 <merijn> The SO answer I remember for that trick appears gone, so not sure you can find it again
13:26:04 <merijn> [exa]: ok, so your problem is you want to sample N random, non-repeating numbers from the space 1..gazillion?
13:28:02 <[exa]> no.... say you have [1,2,3,4,5] as input (it's always 1 to something for simplification). Then I get [3,2] as bucket sizes. Valid answers then include say [[1,2,3],[4,5]] and [[1,2,4],[3,5]] and [[1,3,4],[2,5]] etc.
13:29:41 <merijn> I mean, that looks like what I said, except you're wanting M sequences of random, non-repeating numbers from 1..gazillion :p
13:29:51 <[exa]> problem: the input is going to be too huge to remember any of the data as a whole set, so I need to output the things iteratively; e.g. in the second example the generator would basically tell me "first input goes to bucket 1, next into bucket 1, next into bucket 2, next into bucket 1, next into bucket 2, end"
13:30:16 <[exa]> yeah that would be it
13:30:26 <merijn> Is the input gonna be 1 through N, though? Or not
13:30:36 <[exa]> isomorphic to that, yes
13:31:13 <[exa]> basically I've got a few huge data streams and need to mix them fairly
13:31:23 <[exa]> might have started from this description, right. ^
13:31:53 <merijn> Ok, by what definition of fair? :p
13:33:40 <[exa]> basically if one of the buckets is shorter, it shouldn't affect its occurence distribution in the mixed stream
13:34:09 <merijn> So, basically the problem I had was: Given the range 0..N (where N is **large**) select K random, non-repeating numbers from within 0..N. So I know a solution to that, I'm just not sure that helps you :)
13:34:19 <[exa]> (i.e. if you would output just unweighted random bucket IDs and remove buckets that ran out of space, shorter buckets would be filled/emptied right in the beginning.
13:35:10 <[exa]> for the K you use the knuth shuffly trick no?
13:35:48 × rosco quits (~rosco@175.136.158.234) (Quit: Lost terminal)
13:35:51 <merijn> I'm assuming that by Knuth you mean the Fisher-Yates shuffle, yeah.
13:36:07 <merijn> Or rather a sparse partial version of it
13:36:37 <[exa]> yes, just remembering the <=K things that were taken out
13:36:51 <[exa]> not very useful here because K gonna get yuge
13:38:51 <merijn> [exa]: But your problem has multiple streams of input that should be redistributed across N buckets?
13:40:10 <Leary> :t \f -> runContT . traverse (ContT . f)
13:40:12 <lambdabot> forall k (t :: * -> *) a b (m :: k -> *) (r :: k). Traversable t => (a -> (b -> m r) -> m r) -> t a -> (t b -> m r) -> m r
13:44:27 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 246 seconds)
13:46:00 <[exa]> Leary: oh wow, nice, thanks a lot!
13:48:17 <Leary> [exa]: NP. Re the number generation, if I've understood correctly, then a streaming approach is to maintain an array of weights associated with an array of buckets, then generate bucket indices in accordance with those weights, decrementing the associated weight each time its bucket is selected.
13:48:48 <[exa]> yap
13:49:00 merijn joins (~merijn@77.242.116.146)
13:51:37 Sgeo joins (~Sgeo@user/sgeo)
13:54:40 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
14:04:53 × alexherbo2 quits (~alexherbo@2a02-8440-3119-49bf-4476-2d18-4679-c6a2.rev.sfr.net) (Remote host closed the connection)
14:06:04 alexherbo2 joins (~alexherbo@2a02-8440-3119-49bf-8129-3e46-d40e-c0b2.rev.sfr.net)
14:07:36 ash3en joins (~Thunderbi@193.32.248.193)
14:09:46 × alexherbo2 quits (~alexherbo@2a02-8440-3119-49bf-8129-3e46-d40e-c0b2.rev.sfr.net) (Remote host closed the connection)
14:10:10 alexherbo2 joins (~alexherbo@2a02-8440-3119-49bf-edf4-bd4a-ca0d-4115.rev.sfr.net)
14:11:45 × ash3en quits (~Thunderbi@193.32.248.193) (Ping timeout: 246 seconds)
14:13:36 × alexherbo2 quits (~alexherbo@2a02-8440-3119-49bf-edf4-bd4a-ca0d-4115.rev.sfr.net) (Remote host closed the connection)
14:22:10 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
14:29:17 ash3en joins (~Thunderbi@193.32.248.193)
14:30:39 × jespada quits (~jespada@r190-64-133-178.su-static.adinet.com.uy) (Ping timeout: 246 seconds)
14:30:52 jespada_ joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
14:33:07 × lxsameer quits (~lxsameer@Serene/lxsameer) (Ping timeout: 264 seconds)
14:34:04 × ash3en quits (~Thunderbi@193.32.248.193) (Ping timeout: 260 seconds)
14:34:14 jespada joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
14:35:12 × jespada_ quits (~jespada@r190-64-133-178.su-static.adinet.com.uy) (Ping timeout: 246 seconds)
14:43:29 × misterfish quits (~misterfis@87.215.131.102) (Ping timeout: 255 seconds)
14:48:03 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Quit: WeeChat 4.2.2)
15:00:11 spew joins (~spew@201.141.99.170)
15:05:56 ash3en joins (~Thunderbi@193.32.248.193)
15:13:17 × ash3en quits (~Thunderbi@193.32.248.193) (Quit: ash3en)
15:20:09 ash3en joins (~Thunderbi@193.32.248.193)
15:20:44 × sawilagar quits (~sawilagar@user/sawilagar) (Ping timeout: 244 seconds)
15:23:56 Alleria joins (~Alleria@user/alleria)
15:24:00 Pixi` joins (~Pixi@user/pixi)
15:24:22 alexherbo2 joins (~alexherbo@2a02-8440-3402-f1ef-996e-3533-9fa6-2db1.rev.sfr.net)
15:24:53 × Pixi quits (~Pixi@user/pixi) (Ping timeout: 255 seconds)
15:32:14 × athan quits (~athan@syn-098-153-145-140.biz.spectrum.com) (Quit: Konversation terminated!)
15:38:44 × ash3en quits (~Thunderbi@193.32.248.193) (Quit: ash3en)
15:56:16 × chele quits (~chele@user/chele) (Remote host closed the connection)
15:57:07 tzh joins (~tzh@c-76-115-131-146.hsd1.or.comcast.net)
15:58:22 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
16:11:31 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 264 seconds)
16:12:20 × kuribas quits (~user@ip-188-118-57-242.reverse.destiny.be) (Quit: ERC (IRC client for Emacs 27.1))
16:14:27 kaskal joins (~kaskal@2001:4bb8:2c3:301f:e6a5:a01d:d360:9b28)
16:16:08 × kaskal quits (~kaskal@2001:4bb8:2c3:301f:e6a5:a01d:d360:9b28) (Client Quit)
16:17:21 kaskal joins (~kaskal@2001:4bb8:2c3:301f:344f:f795:68cb:7518)
16:17:39 × Smiles quits (uid551636@id-551636.lymington.irccloud.com) (Quit: Connection closed for inactivity)
16:18:10 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
16:27:52 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
16:29:33 waleee joins (~waleee@h-176-10-144-38.NA.cust.bahnhof.se)
16:32:19 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 260 seconds)
16:39:54 econo_ joins (uid147250@id-147250.tinside.irccloud.com)
16:52:38 jinsun joins (~jinsun@user/jinsun)
16:59:01 × aforemny quits (~aforemny@i59F516FA.versanet.de) (Ping timeout: 248 seconds)
16:59:28 aforemny joins (~aforemny@2001:9e8:6cdb:2500:97cb:a459:61c8:d3a)
17:01:18 × hammond quits (proscan@gateway04.insomnia247.nl) (Ping timeout: 252 seconds)
17:03:52 × youthlic quits (~Thunderbi@user/youthlic) (Quit: youthlic)
17:03:57 × aforemny quits (~aforemny@2001:9e8:6cdb:2500:97cb:a459:61c8:d3a) (Ping timeout: 246 seconds)
17:04:01 aforemny_ joins (~aforemny@i59F516FC.versanet.de)
17:04:59 × jespada quits (~jespada@r190-64-133-178.su-static.adinet.com.uy) (Quit: My Mac has gone to sleep. ZZZzzz…)
17:06:05 jespada joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
17:06:20 × alexherbo2 quits (~alexherbo@2a02-8440-3402-f1ef-996e-3533-9fa6-2db1.rev.sfr.net) (Remote host closed the connection)
17:07:29 × vglfr quits (~vglfr@c-73-163-164-68.hsd1.md.comcast.net) (Ping timeout: 248 seconds)
17:08:13 vglfr joins (~vglfr@2607:fb91:834:1618:ac39:6af7:e3fa:db4a)
17:11:36 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
17:18:02 ft joins (~ft@p4fc2a393.dip0.t-ipconnect.de)
17:22:25 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
17:26:38 sourcetarius joins (~sourcetar@user/sourcetarius)
17:29:58 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
17:30:39 × pavonia quits (~user@user/siracusa) (Quit: Bye!)
17:33:12 hammond joins (proscan@gateway04.insomnia247.nl)
17:34:55 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 264 seconds)
17:39:59 misterfish joins (~misterfis@84.53.85.146)
17:42:23 sawilagar joins (~sawilagar@user/sawilagar)
17:45:41 ash3en joins (~Thunderbi@2a01:c23:9425:d300:a59d:7e6e:37ec:ac7f)
17:45:46 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
17:46:24 × dsrt^ quits (~dsrt@c-98-242-74-66.hsd1.ga.comcast.net) (Ping timeout: 252 seconds)
17:50:17 × ash3en quits (~Thunderbi@2a01:c23:9425:d300:a59d:7e6e:37ec:ac7f) (Remote host closed the connection)
17:50:41 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 255 seconds)
17:56:41 ash3en joins (~Thunderbi@2a01:c23:9425:d300:a59d:7e6e:37ec:ac7f)
18:01:35 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
18:01:47 × rvalue quits (~rvalue@user/rvalue) (Ping timeout: 252 seconds)
18:05:09 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
18:06:53 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 265 seconds)
18:08:36 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
18:09:07 × misterfish quits (~misterfis@84.53.85.146) (Ping timeout: 264 seconds)
18:11:30 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 246 seconds)
18:12:58 rvalue joins (~rvalue@user/rvalue)
18:13:32 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds)
18:14:58 <[exa]> hm, is there a library with a mmap(2) equivalent that works over a file descriptor or handle instead of a ("unopened") file path?
18:15:59 × CrunchyFlakes quits (~CrunchyFl@ip-109-42-114-20.web.vodafone.de) (Read error: Connection reset by peer)
18:20:05 <[exa]> ah wait it's in shared-memory. initial google failed.
18:24:23 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
18:29:09 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 248 seconds)
18:32:53 × akegalj quits (~akegalj@20-82.dsl.iskon.hr) (Quit: leaving)
18:36:05 × Feuermagier quits (~Feuermagi@user/feuermagier) (Quit: Leaving)
18:36:21 × machinedgod quits (~machinedg@d50-99-47-73.abhsia.telus.net) (Ping timeout: 246 seconds)
18:40:02 AlexNoo_ is now known as AlexNoo
18:40:11 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
18:41:53 Inst joins (~Inst@user/Inst)
18:42:15 yazz parts (jarek@user/yazz) ()
18:45:06 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 246 seconds)
18:51:48 × weary-traveler quits (~user@user/user363627) (Remote host closed the connection)
18:53:28 × AlexZenon quits (~alzenon@178.34.150.250) (Ping timeout: 272 seconds)
18:55:58 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
18:58:12 AlexZenon joins (~alzenon@178.34.150.250)
19:01:04 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 260 seconds)
19:03:02 × jespada quits (~jespada@r190-64-133-178.su-static.adinet.com.uy) (Quit: My Mac has gone to sleep. ZZZzzz…)
19:03:32 jespada joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
19:09:32 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
19:14:24 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds)
19:16:35 <[exa]> ...ok so, how probable is it that I test the above random generator on a sequence of 20 items and it by complete chance outputs a sorted, super-biased-looking sequence, sending me into half an hour of debugging before I get low enough to just re-run it and see actual randomness?
19:18:20 × Alleria quits (~Alleria@user/alleria) (Remote host closed the connection)
19:18:26 <darkling> Naively, about 1/(20!)?
19:19:07 <[exa]> spoiler: from here it looked like p=1.0
19:19:52 <EvanR> when you gaze into actual randomness, actual randomness gazes back
19:20:23 <[exa]> memorable ^
19:20:35 AlexNoo_ joins (~AlexNoo@5.139.233.35)
19:20:41 <EvanR> also every ordering of 20 items is equally likely
19:20:49 <EvanR> presumably
19:21:09 <[exa]> yeah
19:21:25 <EvanR> how long do you have to sit and watch a list of length 2 get shuffled until you see actual randomness
19:22:04 × AlexZenon quits (~alzenon@178.34.150.250) (Ping timeout: 260 seconds)
19:23:21 AlexZenon joins (~alzenon@5.139.233.35)
19:23:49 × AlexNoo quits (~AlexNoo@178.34.150.250) (Ping timeout: 260 seconds)
19:24:03 AlexNoo_ is now known as AlexNoo
19:25:15 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
19:25:27 × ec quits (~ec@gateway/tor-sasl/ec) (Remote host closed the connection)
19:25:55 ec joins (~ec@gateway/tor-sasl/ec)
19:27:57 darkling breaks out the printed book of random numbers.
19:28:06 × sord937 quits (~sord937@gateway/tor-sasl/sord937) (Quit: sord937)
19:29:06 <EvanR> did xkcd write that?
19:30:14 × vglfr quits (~vglfr@2607:fb91:834:1618:ac39:6af7:e3fa:db4a) (Ping timeout: 260 seconds)
19:30:43 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 264 seconds)
19:32:02 <darkling> No, they were an actual thing, back in the '60s or so.
19:32:36 <darkling> https://www.amazon.com/Million-Random-Digits-Normal-Deviates/dp/0833030477
19:32:38 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
19:32:50 <darkling> (Although that looks like it's a reprint from this millennium)
19:34:15 misterfish joins (~misterfis@84.53.85.146)
19:35:26 × gmg quits (~user@user/gehmehgeh) (Ping timeout: 260 seconds)
19:37:49 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 260 seconds)
19:43:41 × jespada quits (~jespada@r190-64-133-178.su-static.adinet.com.uy) (Quit: My Mac has gone to sleep. ZZZzzz…)
19:47:45 × misterfish quits (~misterfis@84.53.85.146) (Ping timeout: 246 seconds)
19:48:22 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
19:48:33 jespada joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
19:48:39 codaraxis joins (~codaraxis@user/codaraxis)
19:51:17 × ash3en quits (~Thunderbi@2a01:c23:9425:d300:a59d:7e6e:37ec:ac7f) (Ping timeout: 265 seconds)
19:51:49 × jespada quits (~jespada@r190-64-133-178.su-static.adinet.com.uy) (Client Quit)
19:53:30 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 276 seconds)
19:54:30 machinedgod joins (~machinedg@d50-99-47-73.abhsia.telus.net)
19:58:02 vglfr joins (~vglfr@2601:14d:4e01:1370:aa26:2342:9c12:cd31)
20:02:06 × sourcetarius quits (~sourcetar@user/sourcetarius) (Ping timeout: 246 seconds)
20:04:09 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
20:08:45 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 246 seconds)
20:09:53 <[exa]> darkling: they'd never sell this publicly if they could estimate the meme value in late 2020s
20:19:56 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
20:24:51 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 246 seconds)
20:26:07 × spew quits (~spew@201.141.99.170) (Read error: Connection reset by peer)
20:31:25 spew joins (~spew@201.141.99.170)
20:35:43 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
20:39:13 misterfish joins (~misterfis@84.53.85.146)
20:39:41 myxos joins (~myxos@syn-065-028-251-121.res.spectrum.com)
20:40:49 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 260 seconds)
20:45:04 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
20:45:04 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
20:48:22 × michalz quits (~michalz@185.246.207.215) (Remote host closed the connection)
20:51:05 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
20:53:04 × misterfish quits (~misterfis@84.53.85.146) (Ping timeout: 260 seconds)
21:00:31 × Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer)
21:00:32 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Remote host closed the connection)
21:00:45 Sgeo joins (~Sgeo@user/sgeo)
21:00:51 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
21:01:31 × Luj9 quits (~Luj@2a01:e0a:de4:a0e1:be24:11ff:febc:b5b5) (Quit: The Lounge - https://thelounge.chat)
21:02:28 Luj9 joins (~Luj@2a01:e0a:de4:a0e1:be24:11ff:febc:b5b5)
21:07:18 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
21:12:06 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 246 seconds)
21:12:23 × takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection)
21:13:30 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 246 seconds)
21:13:34 × Luj9 quits (~Luj@2a01:e0a:de4:a0e1:be24:11ff:febc:b5b5) (Quit: The Lounge - https://thelounge.chat)
21:14:10 Luj9 joins (~Luj@2a01:e0a:de4:a0e1:be24:11ff:febc:b5b5)
21:18:55 × Luj9 quits (~Luj@2a01:e0a:de4:a0e1:be24:11ff:febc:b5b5) (Client Quit)
21:19:30 Luj9 joins (~Luj@2a01:e0a:de4:a0e1:be24:11ff:febc:b5b5)
21:22:15 × __monty__ quits (~toonn@user/toonn) (Quit: leaving)
21:23:04 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
21:28:02 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 255 seconds)
21:29:32 CrunchyFlakes joins (~CrunchyFl@ip-109-42-114-20.web.vodafone.de)
21:30:01 × Luj9 quits (~Luj@2a01:e0a:de4:a0e1:be24:11ff:febc:b5b5) (Quit: The Lounge - https://thelounge.chat)
21:30:40 Luj9 joins (~Luj@2a01:e0a:de4:a0e1:be24:11ff:febc:b5b5)
21:31:52 × spew quits (~spew@201.141.99.170) (Read error: Connection reset by peer)
21:34:00 × glguy quits (glguy@libera/staff/glguy) (Remote host closed the connection)
21:35:38 × sawilagar quits (~sawilagar@user/sawilagar) (Remote host closed the connection)
21:36:12 sawilagar joins (~sawilagar@user/sawilagar)
21:37:15 spew joins (~spew@201.141.99.170)
21:37:49 glguy joins (glguy@libera/staff/glguy)
21:38:52 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
21:39:27 × spew quits (~spew@201.141.99.170) (Read error: Connection reset by peer)
21:40:45 × machinedgod quits (~machinedg@d50-99-47-73.abhsia.telus.net) (Ping timeout: 276 seconds)
21:42:20 × sawilagar quits (~sawilagar@user/sawilagar) (Remote host closed the connection)
21:42:49 sawilagar joins (~sawilagar@user/sawilagar)
21:43:45 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 248 seconds)
21:44:59 random-jellyfish joins (~random-je@user/random-jellyfish)
21:45:37 <random-jellyfish> :t (.) . (.)
21:45:38 <lambdabot> (b -> c) -> (a1 -> a2 -> b) -> a1 -> a2 -> c
21:46:01 <random-jellyfish> How is it possible to compose the composition operator with itself?
21:46:08 <random-jellyfish> :t (.)
21:46:09 <lambdabot> (b -> c) -> (a -> b) -> a -> c
21:46:29 <random-jellyfish> it returns c and takes (b->c) as argument
21:46:38 Unicorn_Princess joins (~Unicorn_P@user/Unicorn-Princess/x-3540542)
21:46:40 <random-jellyfish> those types don't match
21:46:48 <mauke> :t flip id
21:46:49 <lambdabot> b -> (b -> c) -> c
21:46:54 <mauke> why can I flip id?
21:47:01 <c_wraith> no, it's takes a (b -> c) and returns an ((a ->b) -> a -> c)
21:47:25 <c_wraith> wow, my grammar went on vacation there or something
21:47:39 <random-jellyfish> c_wraith okay fair, but do those types match?
21:47:43 <geekosaur> remember unification. (rename the tyvars in the three uses of (.) and unify them)
21:48:06 <monochrom> @type flip
21:48:07 <lambdabot> (a -> b -> c) -> b -> a -> c
21:49:13 random-jellyfish is confused and dizzy
21:49:39 <monochrom> When you unify that with id's "t -> t", t and a both become b->c. IOW you're looking at id :: (b->c) -> (b->c), i.e., ($).
21:50:16 spew joins (~spew@201.141.99.170)
21:50:43 <geekosaur> the key point is that each use of (.) has its _own_ a, b, and c. they are only related by usage, which is determined by unification. this is why I advised renaming the type variables in each use
21:50:57 <monochrom> (.) . (.) is a really good exercise in type inference. Let me put it bluntly: Following the type inference algorithm mechanically, "blindly", "let the symbols do the work", and suppressing your flawed intuition.
21:51:57 <monochrom> @type id id id id
21:51:58 <lambdabot> a -> a
21:52:12 Tuplanolla joins (~Tuplanoll@91-159-69-59.elisa-laajakaista.fi)
21:52:15 <monochrom> @quote monochrom 17
21:52:15 <lambdabot> monochrom says: I am 17-ary, going on 18-ary, I can take curry of you
21:55:59 <int-e> the full type of the outermost . is (((a2 -> b) -> a2 -> c) -> (a1 -> a2 -> b) -> a1 -> a2 -> c) -> ((b -> c) -> (a2 -> b) -> a2 -> c) -> (b -> c) -> (a1 -> a2 -> b) -> a1 -> a2 -> c
21:56:04 <int-e> such beauty.
21:56:41 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
21:57:10 <monochrom> This is why unification is exponential-time. >:)
21:57:32 × spew quits (~spew@201.141.99.170) (Read error: Connection reset by peer)
21:57:45 pavonia joins (~user@user/siracusa)
21:58:15 <int-e> id id id id never have guessed
21:59:52 <int-e> If you maintain sharing, unification is almost linear time though.
22:10:26 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
22:12:35 × CrunchyFlakes quits (~CrunchyFl@ip-109-42-114-20.web.vodafone.de) (Read error: Connection reset by peer)
22:15:10 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds)
22:18:38 weary-traveler joins (~user@user/user363627)
22:19:55 × Square2 quits (~Square4@user/square) (Ping timeout: 264 seconds)
22:20:33 Fooo joins (~Square@user/square)
22:21:15 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
22:23:13 <haskellbridge> <thirdofmay18081814goya> Bowuigi: thanks a lot for the extensive explanation!! i'll be referring to this a lot
22:26:12 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
22:27:35 <haskellbridge> <magic_rb> Today during a course we were tasked to implement some very basic haskell functions, namely "equalFour" which takes 4 arguments and returns True if none of them equal and "factorial" which is self explanatory. "equalFour" can be done just be hardcoding the expression or by using a foldl to implement "equalN". And i wondered if the general fold based version would be optimized away or if it even could be...
22:27:40 <haskellbridge> ... reasonably optimized away
22:30:19 × guygastineau quits (~guygastin@137.184.131.156) (Quit: ZNC - https://znc.in)
22:30:39 RMSBach joins (~guygastin@137.184.131.156)
22:30:55 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds)
22:37:22 troydm joins (~troydm@user/troydm)
22:41:59 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
22:43:26 <Leary> Bowuigi, thirdofmay18081814goya: System F /can/ represent both data and codata as the least and greatest fixpoints of functors respectively. You just can't treat one like the other without paying unreasonable penalties.
22:43:33 × acidjnk_new quits (~acidjnk@p200300d6e72cfb806d1b8dd9c0ab8f32.dip0.t-ipconnect.de) (Ping timeout: 248 seconds)
22:46:23 × Luj9 quits (~Luj@2a01:e0a:de4:a0e1:be24:11ff:febc:b5b5) (Quit: The Lounge - https://thelounge.chat)
22:46:37 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 244 seconds)
22:47:00 Luj9 joins (~Luj@2a01:e0a:de4:a0e1:be24:11ff:febc:b5b5)
22:48:50 justsomeguy joins (~justsomeg@user/justsomeguy)
22:50:22 × malte quits (~malte@mal.tc) (Remote host closed the connection)
22:51:37 malte joins (~malte@mal.tc)
22:51:49 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 252 seconds)
22:57:03 misterfish joins (~misterfis@84.53.85.146)
22:57:46 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
23:02:42 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 246 seconds)
23:06:35 <Axman6> magic_rb: generally, recursive functions don't get optimised away easily. the compiler needs to have some way to stop inlining, but when lists can be infinite its hard to know when. it might be possible if you explicitly used build/foldr fusion though.
23:07:46 <davean> Axman6: I mean an obvious counter example is tail recursion.
23:08:21 <davean> Certain recursive cases are trivially optimized away
23:09:29 <Axman6> sure, but i'm not sure what mechanism would turn f a b c d = foldr g z [a,b,c,d] into the expansion of foldr at compile time.
23:09:48 × vglfr quits (~vglfr@2601:14d:4e01:1370:aa26:2342:9c12:cd31) (Ping timeout: 276 seconds)
23:10:27 vglfr joins (~vglfr@c-73-163-164-68.hsd1.md.comcast.net)
23:11:03 <davean> well it knows for sure the list is finite in that case.
23:11:06 <c_wraith> I'm pretty sure GHC doesn't have a pass that does that, but it certainly *could* treat fixed-length list literals specially for optimization purposes. I'm just not sure it'd be worth the implementation cost.
23:12:08 <davean> One could even add a RULE for that if one wanted it to work right now for sure.
23:12:28 <c_wraith> It's possible a foldr/build would do something useful there, though, as that would erase the recursion entirely and GHC would just see it as a few function applications.
23:12:29 <davean> its fixed enough I'd have to look at what the optimizer did, it can handle some cases like that from pure inlining.
23:12:39 <davean> c_wraith: right
23:13:33 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
23:13:38 <davean> This is also the sort of thing that tends not to be stable across GHC versions
23:13:49 <Axman6> if the literal {a,b,c,d} turns into build (\(*) z -> a * b * c * d * z) then it might get optimised away
23:14:13 <c_wraith> do literals get compiled like that?
23:14:43 <Axman6> not sure
23:14:47 <monochrom> "only one way to find out" :)
23:14:55 × sawilagar quits (~sawilagar@user/sawilagar) (Ping timeout: 252 seconds)
23:15:18 <Axman6> {} -> []
23:15:52 <davean> So I will repeat that IME this sort of thing is very unstable across GHC versions
23:17:04 <monochrom> That's fair.
23:18:35 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds)
23:18:50 <davean> Optimizations are great, but they're there to clean up your average code and so should target the best average improvements. Thus they're prone to tunning, and changes. Core peroformance critical code is best done directly.
23:19:31 <c_wraith> My general philosophy is to write the code I want to run. Not some other code that I hope the compiler magically fixes for me. :)
23:19:49 × oo_miguel quits (~Thunderbi@78.10.207.45) (Ping timeout: 248 seconds)
23:19:56 jespada joins (~jespada@r190-64-133-178.su-static.adinet.com.uy)
23:20:04 <davean> c_wraith: right, for at least core stuff. I'm happy when I have a lot of code saying "it'll do a decent job on cleaning up this code that runs only a few times and isn't core"
23:20:12 <davean> It should never be terrible!
23:20:26 <c_wraith> I mean, in that case that's the code I want to run. Something simple where performance isn't critical
23:20:31 <davean> but if someone wants to abstractly think about some business logic, I'm happy to expect it to be generally improved
23:21:00 <davean> Just I better not care about any specific improvements
23:24:52 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
23:27:21 machinedgod joins (~machinedg@d50-99-47-73.abhsia.telus.net)
23:29:07 acidjnk_new joins (~acidjnk@p200300d6e72cfb5469ca77b0637d5192.dip0.t-ipconnect.de)
23:29:21 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
23:30:20 × bliminse quits (~bliminse@user/bliminse) (Ping timeout: 252 seconds)
23:34:22 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds)
23:36:13 × ZharMeny quits (~ZharMeny@user/ZharMeny) (Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.4))
23:42:25 bliminse joins (~bliminse@user/bliminse)
23:45:08 merijn joins (~merijn@204-220-045-062.dynamic.caiway.nl)
23:50:45 × merijn quits (~merijn@204-220-045-062.dynamic.caiway.nl) (Ping timeout: 276 seconds)
23:51:47 × justsomeguy quits (~justsomeg@user/justsomeguy) (Quit: WeeChat 3.6)
23:54:30 × misterfish quits (~misterfis@84.53.85.146) (Ping timeout: 246 seconds)
23:58:11 × ystael quits (~ystael@user/ystael) (Ping timeout: 252 seconds)

All times are in UTC on 2024-09-03.