Logs: liberachat/#haskell
| 2021-08-18 15:35:11 | <c_wraith> | kuribas: a quick check of the source says it's using foldl' |
| 2021-08-18 15:35:20 | <c_wraith> | kuribas: which is the bad case for (++) |
| 2021-08-18 15:36:10 | <kuribas> | c_wraith: dependends on the direction they apply it? |
| 2021-08-18 15:36:48 | <kuribas> | fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"a")] == fromList [(3, "ab"), (5, "aba")] |
| 2021-08-18 15:36:52 | <kuribas> | (from the docs) |
| 2021-08-18 15:37:15 | <kuribas> | that looks like prepending... |
| 2021-08-18 15:38:15 | <c_wraith> | oh, weird. that isn't the order I would expect the arguments at all |
| 2021-08-18 15:38:21 | <kuribas> | Ah in insertWith: If the key does exist, the function will insert the pair (key, f new_value old_value). |
| 2021-08-18 15:40:21 | <c_wraith> | well, I guess that makes fromListWith (++) efficient. But also not at all the operation I'd expect it to be |
| 2021-08-18 15:41:06 | <kuribas> | what do you expect then? |
| 2021-08-18 15:41:17 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 245 seconds) |
| 2021-08-18 15:43:40 | × | Vajb quits (~Vajb@hag-jnsbng11-58c3ab-85.dhcp.inet.fi) (Read error: Connection reset by peer) |
| 2021-08-18 15:44:21 | → | Vajb joins (~Vajb@hag-jnsbng11-58c3ab-85.dhcp.inet.fi) |
| 2021-08-18 15:46:08 | <dminuoso> | gambpang: the latter is refactorable, the former not. |
| 2021-08-18 15:46:10 | × | nate1 quits (~nate@2600:1010:b02a:2679:7ca9:9738:1435:e8d1) (Ping timeout: 240 seconds) |
| 2021-08-18 15:46:19 | <dminuoso> | Or rather "easily refactorable" |
| 2021-08-18 15:47:45 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 248 seconds) |
| 2021-08-18 15:48:30 | × | ec quits (~ec@gateway/tor-sasl/ec) (Ping timeout: 244 seconds) |
| 2021-08-18 15:51:15 | → | qbt joins (~edun@user/edun) |
| 2021-08-18 15:52:10 | × | ubert quits (~Thunderbi@178.115.35.155.wireless.dyn.drei.com) (Ping timeout: 240 seconds) |
| 2021-08-18 15:52:13 | <c_wraith> | kuribas: I'd expect it to apply the function to the args in the opposite order such that fromListWith f [(1,a),(1,b),(1,c)] === fromList [(1, (a `f` b) `f' c)] |
| 2021-08-18 15:52:32 | <c_wraith> | err. `f` the second time, too. |
| 2021-08-18 15:53:10 | × | cheater quits (~Username@user/cheater) (Ping timeout: 240 seconds) |
| 2021-08-18 15:53:14 | × | haykam quits (~haykam@static.100.2.21.65.clients.your-server.de) (Remote host closed the connection) |
| 2021-08-18 15:53:27 | → | haykam joins (~haykam@static.100.2.21.65.clients.your-server.de) |
| 2021-08-18 15:57:00 | → | cheater joins (~Username@user/cheater) |
| 2021-08-18 15:57:36 | × | slack1256 quits (~slack1256@191.125.227.92) (Remote host closed the connection) |
| 2021-08-18 15:57:42 | → | pavonia joins (~user@user/siracusa) |
| 2021-08-18 15:58:56 | → | eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-08-18 16:00:36 | → | raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
| 2021-08-18 16:01:34 | → | Cajun joins (~Cajun@user/cajun) |
| 2021-08-18 16:02:36 | → | lbseale joins (~lbseale@user/ep1ctetus) |
| 2021-08-18 16:03:10 | × | aguapesada quits (~aguapesad@2804:14c:8793:8e2f:a406:863b:f810:2d4c) (Quit: CoreIRC for Android - www.coreirc.com) |
| 2021-08-18 16:04:21 | → | ec joins (~ec@gateway/tor-sasl/ec) |
| 2021-08-18 16:07:35 | <kuribas> | c_wraith: seems they optimized for (++) then :) |
| 2021-08-18 16:08:43 | → | burnsidesLlama joins (~burnsides@dhcp168-023.wadham.ox.ac.uk) |
| 2021-08-18 16:09:35 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-08-18 16:12:44 | → | favonia joins (~favonia@user/favonia) |
| 2021-08-18 16:13:22 | × | burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Ping timeout: 252 seconds) |
| 2021-08-18 16:15:01 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 252 seconds) |
| 2021-08-18 16:16:07 | × | drd quits (~drd@93-39-151-19.ip76.fastwebnet.it) (Ping timeout: 252 seconds) |
| 2021-08-18 16:16:25 | → | benin0369321 joins (~benin@183.82.178.142) |
| 2021-08-18 16:19:09 | × | Vajb quits (~Vajb@hag-jnsbng11-58c3ab-85.dhcp.inet.fi) (Remote host closed the connection) |
| 2021-08-18 16:19:58 | × | benin036932 quits (~benin@183.82.178.142) (Ping timeout: 268 seconds) |
| 2021-08-18 16:19:59 | benin0369321 | is now known as benin036932 |
| 2021-08-18 16:20:19 | → | Vajb joins (~Vajb@hag-jnsbng11-58c3ab-85.dhcp.inet.fi) |
| 2021-08-18 16:22:58 | → | Atum_ joins (~IRC@user/atum/x-2392232) |
| 2021-08-18 16:24:44 | → | drd joins (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4) |
| 2021-08-18 16:26:48 | → | econo joins (uid147250@user/econo) |
| 2021-08-18 16:36:07 | <dminuoso> | gambpang: To elaborate on what I said earlier, writing `f . g . h $ x` or `(f . g . h) x` allows for mechanical refactoring since you can just take the composition and float it into a binding, e.g. let q = f . g . h in q x. |
| 2021-08-18 16:38:34 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2021-08-18 16:39:09 | × | kuribas quits (~user@ip-188-118-57-242.reverse.destiny.be) (Quit: ERC (IRC client for Emacs 26.3)) |
| 2021-08-18 16:40:21 | → | burnsidesLlama joins (~burnsides@dhcp168-023.wadham.ox.ac.uk) |
| 2021-08-18 16:44:17 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-08-18 16:50:41 | × | burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Ping timeout: 248 seconds) |
| 2021-08-18 16:52:00 | → | eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-08-18 16:52:04 | → | ubert joins (~Thunderbi@178.115.48.151.wireless.dyn.drei.com) |
| 2021-08-18 17:02:13 | × | Lycurgus quits (~juan@cpe-45-46-140-49.buffalo.res.rr.com) (Quit: Exeunt) |
| 2021-08-18 17:02:18 | → | justsomeguy joins (~justsomeg@user/justsomeguy) |
| 2021-08-18 17:04:50 | → | mjs2600 joins (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) |
| 2021-08-18 17:05:16 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Read error: Connection reset by peer) |
| 2021-08-18 17:07:57 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 2021-08-18 17:08:22 | × | justsomeguy quits (~justsomeg@user/justsomeguy) (Ping timeout: 245 seconds) |
| 2021-08-18 17:08:27 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Read error: Connection reset by peer) |
| 2021-08-18 17:10:12 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 2021-08-18 17:10:28 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Read error: Connection reset by peer) |
| 2021-08-18 17:12:54 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 2021-08-18 17:13:45 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Read error: Connection reset by peer) |
| 2021-08-18 17:15:20 | simon1 | is now known as sim590 |
| 2021-08-18 17:15:56 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 2021-08-18 17:16:11 | ← | jakalx parts (~jakalx@base.jakalx.net) () |
| 2021-08-18 17:16:18 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2021-08-18 17:16:22 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Read error: Connection reset by peer) |
| 2021-08-18 17:18:16 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 252 seconds) |
| 2021-08-18 17:18:49 | × | chomwitt quits (~chomwitt@ppp-94-67-193-240.home.otenet.gr) (Ping timeout: 252 seconds) |
| 2021-08-18 17:20:05 | → | eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-08-18 17:20:13 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 2021-08-18 17:24:39 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-08-18 17:31:12 | → | fef joins (~thedawn@user/thedawn) |
| 2021-08-18 17:34:22 | × | fresheyeball quits (~fresheyeb@c-71-237-105-37.hsd1.co.comcast.net) (Quit: WeeChat 2.9) |
| 2021-08-18 17:40:02 | × | drd quits (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4) (Ping timeout: 245 seconds) |
| 2021-08-18 17:40:07 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2021-08-18 17:41:10 | <gambpang> | dminuoso: Yeah, that's a point in favor for sure. Is it likely that the two variants wind up producing the ~same core/machine code? |
| 2021-08-18 17:41:46 | → | eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-08-18 17:42:06 | <dminuoso> | Im not confident enough to answer this. |
| 2021-08-18 17:43:25 | <dminuoso> | But honestly, that line of thought smells like premature optimization. |
| 2021-08-18 17:43:37 | <dminuoso> | I'd worry about writing expressive, readable and maintainable code first. |
| 2021-08-18 17:44:13 | <Drew[m]1> | I would be shocked if `let q = f . g . h in q x` did not inline to `(f . g . h) x` |
| 2021-08-18 17:44:36 | <dminuoso> | Drew[m]1: I presume they meant ($) vs (.) |
| 2021-08-18 17:45:03 | → | Pickchea joins (~private@user/pickchea) |
| 2021-08-18 17:45:04 | <dminuoso> | I know GHC has some hacks in place for ($), and if memory serves right ($) actually gets completely elided in the intermediate representation to make runST work. |
| 2021-08-18 17:45:27 | <dminuoso> | But Im not confident to make a claim here. |
| 2021-08-18 17:46:01 | <Drew[m]1> | {-# INLINE (.) #-} |
| 2021-08-18 17:46:01 | <Drew[m]1> | (.) f g = \x -> f (g x) |
| 2021-08-18 17:46:21 | <Drew[m]1> | Oops that was meant to be on seperate lines |
| 2021-08-18 17:46:23 | → | chomwitt joins (~chomwitt@ppp-94-67-193-240.home.otenet.gr) |
| 2021-08-18 17:46:47 | <dminuoso> | And then we begin to have discussions about how the inliner works.. |
| 2021-08-18 17:46:55 | <dminuoso> | Or rather the simplifier |
| 2021-08-18 17:46:58 | <monochrom> | I cite premature optimization too. If this is in a hotspot, read core and asm code, and/or benchmark. If this is not in a hotspot, why are you worrying. |
| 2021-08-18 17:47:00 | <Drew[m]1> | Yeah |
All times are in UTC.