Logs on 2025-12-03 (liberachat/#haskell)
| 00:00:26 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection) |
| 00:00:48 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 00:01:24 | ← | Anarchos parts (~Anarchos@91-161-254-16.subs.proxad.net) () |
| 00:05:44 | → | Googulator11 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 00:05:46 | × | Googulator95 quits (~Googulato@85-238-68-117.pool.digikabel.hu) (Quit: Client closed) |
| 00:06:22 | → | Tuplanolla joins (~Tuplanoll@91-152-225-194.elisa-laajakaista.fi) |
| 00:06:22 | <geekosaur> | likewise fwiw. I think I'd prefer stylish-haskell if someone held a gun to my head and forced me to use a formatter |
| 00:09:30 | <jackdk> | ormolu's choices are mostly well-argued but somehow it manages to emit the least aesthetic code I've seen. this is not just an ormulu problem, btw - it seems that each new nix language formatter discovers new frontiers in uglifying code =(. Regardless, I still use autoformatters in a lot of projects just to avoid having style discussions. If I had the time and inclination, I'd look at twiddling the knobs on fourmolu to do more of what i wanted. |
| 00:10:10 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 00:11:11 | <ski> | iqubic : <https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md> is one resource, that might be useful to check and ponder |
| 00:11:18 | <ski> | (re tabs vs. spaces, "Yet Another Tabs v. Spaces Debate - I mix tabs and spaces" by dmwit at <http://dmwit.com/tabs/> (also <https://3.bp.blogspot.com/-kX7Gs0lFG_0/V9GIDlF59cI/AAAAAAAAG9E/8OXtloszZRMwd0_NjkWGk6qYedy_0m6jgCLcB/w1200-h630-p-k-no-nu/TabsSpacesBoth+2.png>) is another opinion) |
| 00:11:20 | <EvanR> | autoformatter fans I've talked to would say if there are configuration options it's defeating the purpose (to have everyone use the same format) |
| 00:11:57 | <int-e> | but if you don't have options then you're defeating adaptation :-P |
| 00:11:59 | <ski> | i would not trust an autoformatter, without closely checking out its opinions |
| 00:12:15 | <int-e> | I meant adoptation, though both work |
| 00:12:19 | <jackdk> | EvanR: I disagree, because you can still maintain consistency within a codebase, which is where I feel it's most important. |
| 00:12:27 | <jackdk> | (with autoformatter fans, not with you) |
| 00:12:49 | <EvanR> | really |
| 00:13:11 | <EvanR> | so like project1 is somehow set up with config 1, project 2 config 2 and everyone can actually keep it straight |
| 00:13:44 | ski | indents by two spaces (including the whole module body, from the `where') |
| 00:13:44 | × | xff0x quits (~xff0x@2405:6580:b080:900:b577:52ee:470:5943) (Ping timeout: 244 seconds) |
| 00:14:23 | <iqubic> | Wait... are you serieous? |
| 00:15:24 | → | lambda_gibbon joins (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) |
| 00:15:29 | <ski> | of course |
| 00:16:04 | <ski> | (exception is if there's no `module ... where' part) |
| 00:16:54 | <geekosaur> | my response to said autoformatter fans is that as soon as there's more than one such the purpose is already defeated |
| 00:17:06 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds) |
| 00:17:09 | <jackdk> | EvanR: Yes, the configurable formatters I'm aware of can store the project config in version control next to the source. |
| 00:17:18 | <geekosaur> | and you will not convince everyone in the Haskell community to use One True Formatter |
| 00:17:47 | <haskellbridge> | <loonycyborg> if there was one true way then compiler would enforce it :P |
| 00:18:09 | <geekosaur> | (case in point, brittany's origins — and its demise) |
| 00:18:27 | <haskellbridge> | <loonycyborg> I think it emits warning if you stick "\t" somewhere already |
| 00:18:38 | <haskellbridge> | <loonycyborg> while in YAML they're illegal altogether |
| 00:18:49 | × | peterbecich quits (~Thunderbi@172.222.148.214) (Ping timeout: 255 seconds) |
| 00:19:57 | <ski> | i also not that seldom divide the source into pages (separated by form feeds) of size between thirtythree and sixtysix lines (c.f. "Riastradh's Lisp Style Rules" <https://mumble.net/~campbell/scheme/style.txt>) |
| 00:20:07 | × | lambda_gibbon quits (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) (Ping timeout: 264 seconds) |
| 00:20:42 | <geekosaur> | now I'm being reminded of C source code formatted with formfeeds in comments between functions, thanks |
| 00:28:13 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 00:33:29 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 265 seconds) |
| 00:35:44 | → | Googulator88 joins (~Googulato@85-238-68-117.pool.digikabel.hu) |
| 00:35:45 | × | Googulator11 quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 00:41:44 | × | CiaoSen quits (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 244 seconds) |
| 00:44:00 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 00:49:12 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds) |
| 00:52:54 | × | DetourNetworkUK quits (DetourNetw@user/DetourNetworkUK) (Read error: Connection reset by peer) |
| 00:54:12 | → | DetourNetworkUK joins (~DetourNet@user/DetourNetworkUK) |
| 00:56:20 | → | lambda_gibbon joins (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) |
| 01:01:14 | × | lambda_gibbon quits (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) (Ping timeout: 260 seconds) |
| 01:09:59 | → | xff0x joins (~xff0x@fsb6a9491c.tkyc517.ap.nuro.jp) |
| 01:13:58 | <iqubic> | I can't tell if my LSP is configured incorrectly or if weird things are happening here. |
| 01:14:25 | <iqubic> | By default, is hlint supposed to give a warning for unused function inputs? |
| 01:14:31 | <iqubic> | part1 :: String -> Int |
| 01:14:39 | <iqubic> | part1 i = undefined |
| 01:15:10 | <iqubic> | It's not telling me anything about the parameter i being unused. |
| 01:15:11 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 01:16:30 | × | acidjnk quits (~acidjnk@p200300d6e71719443da791614ae70cbb.dip0.t-ipconnect.de) (Ping timeout: 265 seconds) |
| 01:16:45 | <davean> | I'm at a loss why people care about style. It takes real work to make a style so bad it actually matters. |
| 01:18:18 | <davean> | You can do it, but I've not seen it outside of obfuscation contests. |
| 01:19:41 | → | omidmash5 joins (~omidmash@user/omidmash) |
| 01:19:52 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 246 seconds) |
| 01:21:25 | × | omidmash quits (~omidmash@user/omidmash) (Ping timeout: 244 seconds) |
| 01:21:25 | omidmash5 | is now known as omidmash |
| 01:22:28 | <probie> | davean: Broken window theory. If the style is inconsistent, it'll encourage other bad behaviours that actually have consequences |
| 01:24:45 | <davean> | That doesn't follow the structure of the broken window theory to me |
| 01:24:55 | × | X-Scale quits (~ARM@6.67.114.89.rev.vodafone.pt) (Ping timeout: 240 seconds) |
| 01:25:00 | <davean> | The same "therefor" doesn't hold or apply |
| 01:25:48 | → | X-Scale joins (~ARM@50.65.114.89.rev.vodafone.pt) |
| 01:26:37 | → | mehbark joins (~mehbark@joey.luug.ece.vt.edu) |
| 01:26:58 | × | mehbark quits (~mehbark@joey.luug.ece.vt.edu) (Changing host) |
| 01:26:58 | → | mehbark joins (~mehbark@user/mehbark) |
| 01:27:19 | × | sindu quits (~sindu@2.148.32.207.tmi.telenormobil.no) (Ping timeout: 240 seconds) |
| 01:30:43 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 01:31:56 | × | img quits (~img@user/img) (Quit: ZNC 1.10.1 - https://znc.in) |
| 01:32:46 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 01:33:00 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 01:33:15 | → | img joins (~img@user/img) |
| 01:33:28 | <davean> | "I don't like their style" is different from "this isn't maintained. The equivilence for the broken window theory would be coming across a place with gothic arches |
| 01:34:07 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection) |
| 01:35:22 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds) |
| 01:36:24 | × | divya quits (divya@140.238.251.170) (Ping timeout: 244 seconds) |
| 01:44:24 | → | lambda_gibbon joins (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) |
| 01:46:31 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 01:48:34 | × | lambda_gibbon quits (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) (Ping timeout: 246 seconds) |
| 01:52:55 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 01:55:51 | <geekosaur> | the usual argument I hear for forcing formatting in projects is they usually enforce a style that minimizes diffs |
| 02:02:04 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 02:02:08 | → | lambda_gibbon joins (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) |
| 02:04:34 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 02:06:46 | × | lambda_gibbon quits (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) (Ping timeout: 265 seconds) |
| 02:07:33 | → | peterbecich joins (~Thunderbi@172.222.148.214) |
| 02:09:38 | × | ttybitnik quits (~ttybitnik@user/wolper) (Remote host closed the connection) |
| 02:09:40 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 265 seconds) |
| 02:20:18 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 02:24:56 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 02:33:34 | × | Tuplanolla quits (~Tuplanoll@91-152-225-194.elisa-laajakaista.fi) (Quit: Leaving.) |
| 02:34:24 | → | finsternis joins (~X@23.226.237.192) |
| 02:36:05 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 02:36:56 | × | machinedgod quits (~machinedg@d75-159-126-101.abhsia.telus.net) (Ping timeout: 240 seconds) |
| 02:40:43 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 246 seconds) |
| 02:49:35 | → | wbooze joins (~wbooze@2001-4dd7-9813-0-4568-5322-9334-ddaa.ipv6dyn.netcologne.de) |
| 02:51:52 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 02:52:15 | trickard_ | is now known as trickard |
| 02:56:20 | → | AlexNoo_ joins (~AlexNoo@85.174.183.177) |
| 02:56:35 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds) |
| 02:57:50 | × | AlexZenon quits (~alzenon@85.174.183.216) (Ping timeout: 245 seconds) |
| 02:59:35 | × | AlexNoo quits (~AlexNoo@85.174.183.216) (Ping timeout: 240 seconds) |
| 03:01:57 | → | AlexZenon joins (~alzenon@85.174.183.177) |
| 03:04:41 | <EvanR> | that would be a good argument |
| 03:04:43 | <EvanR> | if it were true |
| 03:05:01 | <EvanR> | auto formatting after a code change may have collateral damage when hit with the autoformatter |
| 03:05:05 | → | humasect joins (~humasect@dyn-192-249-132-90.nexicom.net) |
| 03:07:41 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 03:08:28 | × | mesaoptimizer quits (~user@user/PapuaHardyNet) (Remote host closed the connection) |
| 03:12:08 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 03:20:27 | <geekosaur> | theoretically you only get that when initially applying formatting |
| 03:21:20 | × | vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 240 seconds) |
| 03:23:04 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 03:23:16 | → | vanishingideal joins (~vanishing@user/vanishingideal) |
| 03:25:54 | <EvanR> | with a properly designed algorithm? |
| 03:26:07 | <EvanR> | is there a no collateral damage theorem |
| 03:28:42 | × | td_ quits (~td@i53870902.versanet.de) (Ping timeout: 252 seconds) |
| 03:29:35 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 03:30:20 | → | td_ joins (~td@i5387093E.versanet.de) |
| 03:31:59 | × | peterbecich quits (~Thunderbi@172.222.148.214) (Ping timeout: 250 seconds) |
| 03:35:28 | × | humasect quits (~humasect@dyn-192-249-132-90.nexicom.net) (Remote host closed the connection) |
| 03:37:28 | → | inline__ joins (~wbooze@cgn-195-14-219-152.nc.de) |
| 03:40:30 | × | wbooze quits (~wbooze@2001-4dd7-9813-0-4568-5322-9334-ddaa.ipv6dyn.netcologne.de) (Ping timeout: 244 seconds) |
| 03:41:06 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 03:45:40 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds) |
| 03:56:50 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 04:01:34 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 255 seconds) |
| 04:07:56 | oppili- | is now known as oppili |
| 04:07:56 | × | oppili quits (~oppili@lewi-27-b2-v4wan-165682-cust505.vm4.cable.virginm.net) (Changing host) |
| 04:07:56 | → | oppili joins (~oppili@user/nerdypepper) |
| 04:11:58 | → | Square joins (~Square@user/square) |
| 04:12:37 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 04:13:54 | → | peterbecich joins (~Thunderbi@172.222.148.214) |
| 04:15:53 | → | Googulator45 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 04:15:53 | × | Googulator88 quits (~Googulato@85-238-68-117.pool.digikabel.hu) (Quit: Client closed) |
| 04:16:09 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Remote host closed the connection) |
| 04:17:49 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds) |
| 04:18:09 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 04:28:26 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 04:32:55 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 04:44:13 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 04:48:31 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 04:50:01 | <haskellbridge> | <zoil> i cant beleive i went to all the trouble of putting together an example just to discover the advice was corrupt |
| 04:52:12 | <haskellbridge> | <zoil> Leary |
| 04:52:13 | <haskellbridge> | ... long message truncated: https://kf8nh.com/_heisenbridge/media/kf8nh.com/meQNVtzNxaPzTuQoVMpGePld/Wmc2FsApiyo (7 lines) |
| 04:52:42 | <haskellbridge> | <zoil> i didnt read the bit where it was "and then you get these new constraints instead" |
| 04:52:45 | <haskellbridge> | <zoil> ... |
| 04:52:56 | <haskellbridge> | <zoil> _thats the whole point_ |
| 04:53:26 | <haskellbridge> | <zoil> it wasnt a question about "how do i refactor these dumb constraints so i can carry around a more effecient expression" |
| 04:53:36 | <haskellbridge> | <zoil> it was, whats up with having to carry around these constraints |
| 04:54:00 | <haskellbridge> | <zoil> why cant I _assert to the compiler_ that the exhaustiveness is something i have ensured I have taken care of |
| 04:54:16 | <haskellbridge> | <zoil> if i have to tell it that Bool has an Eq instance, then its fine |
| 04:54:35 | <haskellbridge> | <zoil> but if its, that the head and tail of a hetroginous container both have a recursive instance |
| 04:54:39 | <EvanR> | a type level trust me |
| 04:54:43 | <EvanR> | sounds dangerous |
| 04:54:57 | <haskellbridge> | <zoil> but we have exhaustiveness elsewhere |
| 04:55:03 | <haskellbridge> | <zoil> maybe not that the user can specify it |
| 04:55:20 | <haskellbridge> | <zoil> we have had this whole dependant types singletons debate for years |
| 04:55:25 | <haskellbridge> | <zoil> isnt this the whole point!? |
| 04:55:43 | <haskellbridge> | <zoil> these damn eta constraints or whatever they are |
| 04:56:06 | <EvanR> | every time I disable the type system in e.g. C it usually results in a segfault xD |
| 04:56:06 | <EvanR> | it's crazy |
| 04:56:06 | <EvanR> | how good humans are at messing up logic |
| 04:56:15 | <haskellbridge> | <zoil> if its an exhaustiveness issue, thats at least an expression of the problem in a way, that, at least personally, i have never heard it phrased |
| 04:56:51 | <haskellbridge> | <zoil> EvanR: sure, i dont want some unknown way to break the compiler |
| 04:56:57 | <haskellbridge> | <zoil> we wouldnt know how to give reasonable errors |
| 04:57:07 | <haskellbridge> | <zoil> "you aserted something wrong!" |
| 04:57:24 | <haskellbridge> | <zoil> but still. languages like lean have this whole business dedicated to assertion proving |
| 04:57:44 | <EvanR> | does lean let you explicitly deal with or disable exhaustiveness |
| 04:57:47 | <haskellbridge> | <zoil> its like. iv even had situations where i pick up a constraint like 1 + n ~ n + 1 |
| 04:58:15 | <haskellbridge> | <zoil> EvanR: idk how lean works. i think its more like a hackage for assertions |
| 04:58:23 | × | marinelli quits (~weechat@gateway/tor-sasl/marinelli) (Quit: marinelli) |
| 04:58:40 | <haskellbridge> | <zoil> like, there is some transistivity axiom that allows you to prove something and it does everything like that in a rigerous derived way |
| 04:58:57 | <glguy> | zoil: the thing you were asking about earlier wasn't about exhaustiveness, it's about not knowing what instance to use at runtime |
| 04:59:20 | <haskellbridge> | <zoil> there was some confusion, which iiuc, is because it requires 2 instances |
| 04:59:30 | <haskellbridge> | <zoil> iiuc thats a problem because its not exhaustive |
| 04:59:43 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 05:00:14 | <EvanR> | exhaustive sounds like something to do with a closed world assumption. type classes are open world and can never be exhaustive |
| 05:00:32 | <EvanR> | for all types there either is or not an instance |
| 05:00:49 | <haskellbridge> | <zoil> its saying (f :: [Type] -> Constraint) (xs :: [Type]) instance does not exist. and im saying "but i gave you a f [], and a f (x:xs) case, foolish compiler" |
| 05:00:49 | <EvanR> | (yet) |
| 05:01:17 | <haskellbridge> | <zoil> its exhaustive in the sum GADT cases |
| 05:01:21 | <haskellbridge> | <zoil> its not an open datatype |
| 05:01:35 | <haskellbridge> | <zoil> if it was a data family i would agree |
| 05:01:45 | <haskellbridge> | <zoil> but its not, so i have something that can be exhaustive |
| 05:02:35 | <haskellbridge> | <zoil> it seems to be like "what!? more than one instance, im confused" |
| 05:02:38 | <haskellbridge> | <zoil> which doesnt seem right at all!! |
| 05:03:07 | <haskellbridge> | <zoil> its like "where is the xs case, i only see [] and (x:xs), this is not xs" |
| 05:03:19 | × | peterbecich quits (~Thunderbi@172.222.148.214) (Ping timeout: 260 seconds) |
| 05:03:26 | <haskellbridge> | <zoil> and the user is like "but it is!! its exhaustive!!" |
| 05:04:07 | → | marinelli joins (~weechat@gateway/tor-sasl/marinelli) |
| 05:04:26 | × | marinelli quits (~weechat@gateway/tor-sasl/marinelli) (Remote host closed the connection) |
| 05:04:45 | → | marinelli joins (~weechat@gateway/tor-sasl/marinelli) |
| 05:04:56 | <haskellbridge> | <zoil> then someone said, "so just put it in one instance, and like, match the cases by a type family" |
| 05:05:19 | <haskellbridge> | <zoil> and then someone else said "but this needs a type witness, use singletons" |
| 05:05:51 | <haskellbridge> | <zoil> and then there was this KnownNonempty thing where head and tail could be given value level case matching that would bring the type into scope |
| 05:06:20 | <haskellbridge> | <zoil> and then i picked up this KnownNonempty constraint, and this still indicates the compiler is not happy that the assertion is satisfied |
| 05:06:31 | <haskellbridge> | <zoil> it says. "no. idk this instance exists, put it in a constraint" |
| 05:06:34 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 265 seconds) |
| 05:07:02 | <haskellbridge> | <zoil> because the instances for KnownNonempty have the same problem. idk if this can be solved by the same typefamily idea or something |
| 05:07:11 | <haskellbridge> | <zoil> or if its that GHC is not advanced, or what |
| 05:07:15 | <EvanR> | either you missed the simple way to do what you're doing, the only way to do it in haskell is so arcane that it's probably not worth it, or it's just impossible |
| 05:07:16 | <haskellbridge> | <zoil> so i need some expert input |
| 05:08:08 | <EvanR> | sophisticated stuff at the type level is just easily overcomplicated here |
| 05:08:39 | <haskellbridge> | <zoil> iiuc the "singletons idea" requires these exhastive instances are provided. and these have to be done in one class, and there was another idea to use type families to do this, but im totally confused. |
| 05:09:07 | <haskellbridge> | <zoil> i just want to be able to describe the situation so people can understand the issue and maybe help produce a working example |
| 05:10:11 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 05:10:21 | <haskellbridge> | <zoil> i had this example to work with so far; https://play.haskell.org/saved/GwyPOlmo |
| 05:11:06 | <EvanR> | cool |
| 05:11:34 | <haskellbridge> | <zoil> also, glguy suggested that the name singleton should not apply to the recursive KnownNE situation, but im not sure why |
| 05:11:40 | <haskellbridge> | <zoil> im not sure it matters |
| 05:12:04 | <haskellbridge> | <zoil> its like, a recursively defined case that covers many situations, as opposed to (an infinite number) of explicit assertions |
| 05:12:29 | <EvanR> | because KnownNE isn't even a type |
| 05:13:06 | <EvanR> | and you're making two instances of it, so what's "single" about that |
| 05:13:33 | <haskellbridge> | <zoil> sorry, WhichNE |
| 05:13:44 | <haskellbridge> | <zoil> data WhichNE xs where |
| 05:13:44 | <haskellbridge> | ... long message truncated: https://kf8nh.com/_heisenbridge/media/kf8nh.com/QHgkurBjvEckITCLYEHUHCfc/FL5KnP9OiZg (3 lines) |
| 05:14:09 | <haskellbridge> | <zoil> its the singletons idea of having this type witness that is matchable upon values to bring the corresponding type into scope |
| 05:14:19 | <haskellbridge> | <zoil> if thats not what a singleston is, idk, what this is |
| 05:14:43 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 246 seconds) |
| 05:15:26 | <haskellbridge> | <zoil> here was glguys paste about how to use the type family to condense the two instances into one |
| 05:15:30 | <haskellbridge> | <zoil> https://paste.tomsmeding.com/UEfrQUiN |
| 05:15:46 | <EvanR> | anyway your code compiles so |
| 05:16:02 | <haskellbridge> | <zoil> you dont understand the issue!? |
| 05:16:07 | <haskellbridge> | <zoil> its picking up these constraints! |
| 05:16:08 | <EvanR> | absolutely not |
| 05:16:28 | <haskellbridge> | <zoil> the compiler will forever ask for a constraint to an instance that exists at top level |
| 05:16:38 | <haskellbridge> | <zoil> simply because it exists in a distributed way |
| 05:17:29 | <haskellbridge> | <zoil> it would be like if i wrote a function matching the [] and (x:xs) cases in different function cases, and it was like "the function is not defined" |
| 05:17:41 | <haskellbridge> | <zoil> just because it cant tell if its exhaustive in these cases |
| 05:18:52 | <haskellbridge> | <zoil> as long as its "i insist that the KnownNE constraint is explicity specified", then its failing to appreciate the instance has been written at top level |
| 05:19:06 | <haskellbridge> | <zoil> now, if theres a "special way" of doing this, like, ensuring everything is written in just one instance |
| 05:19:12 | <haskellbridge> | <zoil> then at least there is a workaround |
| 05:19:33 | <haskellbridge> | <zoil> which should be pretty clearly indicated! since otherwise this insane behaviour from the compiler is commonly encountered |
| 05:19:42 | <haskellbridge> | <zoil> or it indicates a compiler fix is required |
| 05:20:39 | <haskellbridge> | <zoil> "compiler is nolonger blind to instances defined over several cases" |
| 05:20:59 | <haskellbridge> | <zoil> but then, i could just give the basecase instance. and then it would be like "wtf, this doesnt match" |
| 05:21:35 | <haskellbridge> | <zoil> "nonexhaustive instance encountered in this code you were trying to write on line 11" |
| 05:22:13 | <haskellbridge> | <zoil> which it _currently always says_ |
| 05:22:33 | <haskellbridge> | <zoil> except in the case where no pattern matching takes place |
| 05:23:15 | <haskellbridge> | <zoil> then it is like "i see the instance exists, i will not require the constraint is explicitly specified, i cannot forsee an instance where the instance does not exist where then i would require it as a constraint" |
| 05:25:40 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 05:25:43 | EvanR | looks at line 11 |
| 05:25:57 | <EvanR> | there's nothing there |
| 05:26:38 | <haskellbridge> | <zoil> > :-( |
| 05:27:11 | <haskellbridge> | <zoil> > :-| |
| 05:27:19 | <haskellbridge> | <zoil> ... >:-( |
| 05:28:01 | <haskellbridge> | <zoil> i dont know why this type witness idea was even suggested |
| 05:28:12 | <haskellbridge> | <zoil> there was apparently something different about show and read |
| 05:28:16 | <EvanR> | what are you trying to do |
| 05:28:33 | <haskellbridge> | <zoil> like, show could resolve the type, but read would require something like an instance version of allowambiguous types |
| 05:28:50 | <haskellbridge> | <zoil> EvanR: im sorry mate, im not enjoying you just talking past everything iv written |
| 05:29:21 | <haskellbridge> | <zoil> i think "what im trying to do" is very much inferable from the discussion so far. |
| 05:29:22 | <EvanR> | I guess you can keep spamming the channel with nonsense |
| 05:29:32 | <haskellbridge> | <zoil> THANKS! |
| 05:29:39 | <EvanR> | without being rudely interrupted |
| 05:29:48 | <haskellbridge> | <zoil> ill guess you can just keep using a time machine to write a compiler without any focus grouping from the future |
| 05:30:01 | <haskellbridge> | <zoil> im not trying to be rude |
| 05:30:15 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 05:30:28 | <haskellbridge> | <zoil> if you could maybe not just, stonewall me, and then, as soon as this is noticed, start accusing me of not talking to you in the prescribed manner |
| 05:30:41 | <haskellbridge> | <zoil> what specifically is it that you dont understand |
| 05:31:05 | <haskellbridge> | <zoil> instead of just this most vague assertion that you cannot seem to convey any degree of understanding at all of the situation described |
| 05:31:07 | <haskellbridge> | <zoil> its vexating |
| 05:31:59 | <haskellbridge> | <zoil> "its a burden of proof, i insist i dont understand the users query and by virtue of this its nonesense" |
| 05:32:18 | <haskellbridge> | <zoil> its an awful precedent and it makes our community inpenetrable and unfrinedly |
| 05:36:23 | → | michalz joins (~michalz@185.246.207.205) |
| 05:41:29 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 05:45:54 | × | Googulator45 quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 05:45:56 | → | Googulator88 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 05:46:29 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds) |
| 05:48:27 | → | takuan joins (~takuan@d8D86B9E9.access.telenet.be) |
| 05:48:55 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 05:49:08 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 05:54:08 | <probie> | +1 for could not infer what you're trying to do. There's no need to be mean about it. You're obviously frustrated by something, type families are involved, you did something with singletons but it was the wrong path(?) |
| 05:55:00 | <probie> | Since your problem seems to be at the type level, can you give an expression you want to type check, or not type check as appropriate? |
| 05:55:35 | × | Fijxu quits (~Fijxu@user/fijxu) (Quit: XD!!) |
| 05:56:10 | → | Square2 joins (~Square4@user/square) |
| 05:57:02 | → | Fijxu joins (~Fijxu@user/fijxu) |
| 05:57:16 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 05:57:41 | × | Fijxu quits (~Fijxu@user/fijxu) (Remote host closed the connection) |
| 05:59:01 | → | Fijxu joins (~Fijxu@user/fijxu) |
| 05:59:15 | × | Square quits (~Square@user/square) (Ping timeout: 240 seconds) |
| 06:02:08 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 06:02:55 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 06:05:30 | → | poscat joins (~poscat@user/poscat) |
| 06:06:26 | trickard_ | is now known as trickard |
| 06:07:08 | × | poscat0x04 quits (~poscat@user/poscat) (Ping timeout: 244 seconds) |
| 06:07:20 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 06:14:27 | <haskellbridge> | <zoil> thanks, im sorry i rage quit |
| 06:16:19 | <haskellbridge> | <zoil> so far i have this; |
| 06:16:19 | <haskellbridge> | https://play.haskell.org/saved/GwyPOlmo |
| 06:16:40 | <haskellbridge> | <zoil> er, sorry, that was the previous version, now i have this |
| 06:16:41 | <haskellbridge> | <zoil> https://play.haskell.org/saved/GJqAvv67 |
| 06:17:30 | <haskellbridge> | <zoil> its saying the injectivity condition here is not accepted |
| 06:17:30 | <haskellbridge> | <zoil> type family StatefulTransfers (xs :: Nonempty Type) i o = (c :: Constraint) | c -> xs i o where |
| 06:18:04 | <haskellbridge> | <zoil> like, i cant get the fundeps to go through the injective type family properly |
| 06:18:32 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 06:21:39 | <haskellbridge> | <zoil> so, whatever this apparent workaround was supposed to acheive, it cant |
| 06:21:57 | <haskellbridge> | <zoil> because the injective type family fails to impart the same data as the fundep |
| 06:22:24 | <haskellbridge> | <zoil> i have concluded that the compiler hates me, and i was wrong not to have rage quit. |
| 06:23:15 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 06:23:27 | <Leary> | Let's kill all the cruft so others can follow along; the core issue is this: https://play.haskell.org/saved/BeYSIaVz |
| 06:24:15 | <Leary> | There are two instances, and GHC won't let you pretend they're the same as `Read (Two b)`, because that implies you have a way to choose which instance you want to use **at runtime** from type information alone. |
| 06:26:16 | → | peterbecich joins (~Thunderbi@172.222.148.214) |
| 06:26:49 | <EvanR> | thanks |
| 06:34:02 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine) |
| 06:34:18 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 06:36:12 | → | lambda_gibbon joins (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) |
| 06:39:11 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 250 seconds) |
| 06:40:44 | × | lambda_gibbon quits (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) (Ping timeout: 260 seconds) |
| 06:42:21 | × | haritz quits (~hrtz@user/haritz) (Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in) |
| 06:45:10 | → | chenjf joins (~chenjf@68.64.178.54) |
| 06:49:19 | × | chenjf quits (~chenjf@68.64.178.54) (Client Quit) |
| 06:51:13 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 06:54:06 | × | Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
| 06:55:35 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 06:59:13 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 07:06:45 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 07:11:16 | <jackdk> | I had a similar issue the other day, and ended up with something akin to this. Then I realised I'd need to manufacture an SBoolI dictionary somehow, and I may as well use package `singletons` if I want that. So I found a way to do what I wanted with less typelevel stuff. https://www.irccloud.com/pastebin/vNHqRN0S/OneTwoSBool.hs |
| 07:11:45 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 265 seconds) |
| 07:12:16 | <jackdk> | It would still mean writing `parse :: SBoolI b => String -> Two b`; the `noConstraint` form is not possible AFAIK. |
| 07:13:46 | × | user363627 quits (~user@user/user363627) (Remote host closed the connection) |
| 07:18:37 | × | peterbecich quits (~Thunderbi@172.222.148.214) (Ping timeout: 246 seconds) |
| 07:20:28 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Ping timeout: 255 seconds) |
| 07:20:43 | → | trickard joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 07:22:29 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 07:25:12 | <glguy> | If you finish aoc tonight check out my infinite list of solutions for when you get to turn on 1, 2, 3... batteries |
| 07:26:46 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Ping timeout: 255 seconds) |
| 07:27:55 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds) |
| 07:30:59 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 07:32:46 | → | fp1 joins (~Thunderbi@130.233.53.128) |
| 07:36:52 | × | iqubic quits (~sophia@2601:602:9203:1660:dd83:8e66:bfcb:8c1e) (Remote host closed the connection) |
| 07:38:17 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 07:41:35 | × | fp1 quits (~Thunderbi@130.233.53.128) (Ping timeout: 245 seconds) |
| 07:42:09 | → | iqubic joins (~sophia@2601:602:9203:1660:661f:14db:875e:5d74) |
| 07:43:15 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 245 seconds) |
| 07:43:42 | → | lucabtz joins (~lucabtz@user/lucabtz) |
| 07:54:05 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 07:57:12 | → | tromp joins (~textual@2001:1c00:3487:1b00:a4ed:9e46:fd5d:6b4e) |
| 08:00:48 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds) |
| 08:03:36 | trickard_ | is now known as trickard |
| 08:04:03 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 08:08:03 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine) |
| 08:08:53 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 250 seconds) |
| 08:10:48 | → | Googulator63 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 08:10:48 | × | Googulator88 quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 08:16:43 | → | sord937 joins (~sord937@gateway/tor-sasl/sord937) |
| 08:19:45 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 08:20:15 | × | tessier quits (~tessier@ec2-184-72-149-67.compute-1.amazonaws.com) (Ping timeout: 240 seconds) |
| 08:20:39 | → | chele joins (~chele@user/chele) |
| 08:24:15 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 08:27:39 | → | tessier joins (~tessier@ec2-184-72-149-67.compute-1.amazonaws.com) |
| 08:30:17 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 08:30:23 | × | tromp quits (~textual@2001:1c00:3487:1b00:a4ed:9e46:fd5d:6b4e) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 08:33:42 | × | Vq quits (~vq@90-224-37-169-no600.tbcn.telia.com) (Changing host) |
| 08:33:42 | → | Vq joins (~vq@user/vq) |
| 08:33:50 | → | Lord_of_Life_ joins (~Lord@user/lord-of-life/x-2819915) |
| 08:34:03 | → | tromp joins (~textual@2001:1c00:3487:1b00:a4ed:9e46:fd5d:6b4e) |
| 08:34:14 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Read error: Connection reset by peer) |
| 08:34:32 | × | ft quits (~ft@p508db844.dip0.t-ipconnect.de) (Quit: leaving) |
| 08:34:43 | → | akegalj joins (~akegalj@78-0-210-92.adsl.net.t-com.hr) |
| 08:35:09 | Lord_of_Life_ | is now known as Lord_of_Life |
| 08:35:26 | <akegalj> | Is there a flag for ghci that saves output to a file ? IIRC there is option for this, but can't find it. |
| 08:37:00 | × | chiselfuse quits (~chiselfus@user/chiselfuse) (Ping timeout: 272 seconds) |
| 08:37:25 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Ping timeout: 255 seconds) |
| 08:37:45 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 08:38:22 | → | chiselfuse joins (~chiselfus@user/chiselfuse) |
| 08:40:45 | × | Googulator63 quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 08:40:52 | → | Googulator86 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 08:46:07 | → | fp1 joins (~Thunderbi@130.233.53.128) |
| 08:47:39 | × | gawen quits (~gawen@user/gawen) (Quit: cya) |
| 08:54:54 | × | fp1 quits (~Thunderbi@130.233.53.128) (Ping timeout: 260 seconds) |
| 08:56:52 | × | inline__ quits (~wbooze@cgn-195-14-219-152.nc.de) (Quit: Leaving) |
| 08:59:35 | → | mesaoptimizer joins (~user@user/PapuaHardyNet) |
| 09:00:37 | × | tzh quits (~tzh@c-76-115-131-146.hsd1.or.comcast.net) (Quit: zzz) |
| 09:00:47 | × | mesaoptimizer quits (~user@user/PapuaHardyNet) (Client Quit) |
| 09:01:03 | → | mesaoptimizer joins (~user@user/PapuaHardyNet) |
| 09:03:13 | <lucabtz> | is there a way to drop the last n elements of a list? |
| 09:03:38 | <lucabtz> | im composing init with itself n times, but im pretty sure it isnt a great way |
| 09:03:49 | → | gawen joins (~gawen@user/gawen) |
| 09:06:08 | <Leary> | lucabtz: There won't be a /great/ way, but `reverse . drop n . reverse` should be better than that. |
| 09:06:28 | <lucabtz> | yeah i though of that too |
| 09:07:35 | Googulator86 | is now known as Googulator |
| 09:08:50 | <lucabtz> | i think with a list of length n repeating init N times should have complexity O(n * N), while yeah reverse . drop N . reverse should scale like 2n + N ~ O(n) |
| 09:08:55 | × | X-Scale quits (~ARM@50.65.114.89.rev.vodafone.pt) (Ping timeout: 240 seconds) |
| 09:09:56 | → | merijn joins (~merijn@77.242.116.146) |
| 09:10:44 | × | Googulator quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 09:10:49 | → | Googulator93 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 09:11:44 | <Leary> | This should be moderately faster: https://play.haskell.org/saved/E1adTNLc |
| 09:14:07 | → | acidjnk joins (~acidjnk@p200300d6e71719231986af8ebf40e0fc.dip0.t-ipconnect.de) |
| 09:16:33 | × | trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 09:16:46 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 09:17:00 | <lucabtz> | yeah thats cool |
| 09:25:18 | × | trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 09:25:24 | × | tromp quits (~textual@2001:1c00:3487:1b00:a4ed:9e46:fd5d:6b4e) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 09:26:12 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 256 seconds) |
| 09:26:45 | × | Inline quits (~inlinE@2001-4dd3-7fc8-0-434a-a4b1-7362-b14b.ipv6dyn.netcologne.de) (Ping timeout: 252 seconds) |
| 09:27:42 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 09:28:41 | → | kuribas joins (~user@2a02:1808:c7:cecf:a041:fccb:9242:86e9) |
| 09:29:26 | → | hdggxin joins (~hdggxin@223.181.46.243) |
| 09:29:38 | → | merijn joins (~merijn@77.242.116.146) |
| 09:36:18 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 260 seconds) |
| 09:40:49 | × | Googulator93 quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 09:40:56 | → | Googulator93 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 09:44:00 | trickard_ | is now known as trickard |
| 09:47:35 | → | merijn joins (~merijn@77.242.116.146) |
| 09:50:02 | → | gmg joins (~user@user/gehmehgeh) |
| 09:50:24 | → | X-Scale joins (~ARM@50.65.114.89.rev.vodafone.pt) |
| 09:54:01 | <chromoblob> | i think you should first find the length, then take (l - n) where l is length |
| 10:06:16 | × | xff0x quits (~xff0x@fsb6a9491c.tkyc517.ap.nuro.jp) (Ping timeout: 246 seconds) |
| 10:06:55 | <Axman6> | > let dropEnd n xs = zipWith const xs (drop n xs) in dropEnd 3 "ABCDEFG" |
| 10:06:59 | <lambdabot> | "ABCD" |
| 10:07:13 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Ping timeout: 260 seconds) |
| 10:07:28 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 10:07:38 | <Axman6> | This has the benefit of being lazy too, it only eevaluates n elements ahead of the the output. lucabtz ^ |
| 10:07:56 | <Axman6> | zipWith const is an incredibly useful thing to know about |
| 10:08:16 | <Axman6> | > let dropEnd n xs = zipWith const xs (drop n xs) in dropEnd 3 [0..] |
| 10:08:20 | <lambdabot> | [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,2... |
| 10:08:39 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 265 seconds) |
| 10:09:45 | → | __monty__ joins (~toonn@user/toonn) |
| 10:09:59 | → | merijn joins (~merijn@77.242.116.146) |
| 10:11:32 | <lucabtz> | thank you Axman6 |
| 10:13:16 | × | Square2 quits (~Square4@user/square) (Ping timeout: 255 seconds) |
| 10:18:32 | <lucabtz> | i think Leary's way with foldr should be lazy too |
| 10:19:03 | × | hsw quits (~hsw@112-104-86-252.adsl.dynamic.seed.net.tw) (Remote host closed the connection) |
| 10:19:27 | → | hsw joins (~hsw@112-104-86-252.adsl.dynamic.seed.net.tw) |
| 10:21:30 | Googulator93 | is now known as Googulator |
| 10:22:50 | × | gawen quits (~gawen@user/gawen) (Quit: cya) |
| 10:26:56 | → | kuribas` joins (~user@ip-188-118-57-242.reverse.destiny.be) |
| 10:27:03 | → | gawen joins (~gawen@user/gawen) |
| 10:28:48 | × | kuribas quits (~user@2a02:1808:c7:cecf:a041:fccb:9242:86e9) (Ping timeout: 260 seconds) |
| 10:30:34 | → | dhil joins (~dhil@5.151.29.137) |
| 10:31:20 | → | tromp joins (~textual@2001:1c00:3487:1b00:a4ed:9e46:fd5d:6b4e) |
| 10:36:29 | × | califax quits (~califax@user/califx) (Remote host closed the connection) |
| 10:36:42 | → | califax joins (~califax@user/califx) |
| 10:40:44 | × | trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 10:40:59 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 10:43:40 | × | tromp quits (~textual@2001:1c00:3487:1b00:a4ed:9e46:fd5d:6b4e) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 10:52:20 | × | gawen quits (~gawen@user/gawen) (Quit: cya) |
| 10:56:55 | trickard_ | is now known as trickard |
| 10:56:59 | → | gawen joins (~gawen@user/gawen) |
| 11:01:07 | → | xff0x joins (~xff0x@2405:6580:b080:900:9a8d:d213:9a6f:7468) |
| 11:01:21 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Ping timeout: 250 seconds) |
| 11:04:05 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 11:04:10 | × | gawen quits (~gawen@user/gawen) (Quit: cya) |
| 11:08:20 | → | bitdex_ joins (~bitdex@gateway/tor-sasl/bitdex) |
| 11:09:05 | → | gawen joins (~gawen@user/gawen) |
| 11:09:38 | × | bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Ping timeout: 272 seconds) |
| 11:11:30 | × | gawen quits (~gawen@user/gawen) (Client Quit) |
| 11:15:20 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 245 seconds) |
| 11:16:31 | → | gawen joins (~gawen@user/gawen) |
| 11:20:51 | → | trickard__ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 11:21:16 | × | trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Ping timeout: 244 seconds) |
| 11:24:15 | → | Inline joins (~inlinE@2001-4dd3-7fc8-0-f57-6413-8f27-9a87.ipv6dyn.netcologne.de) |
| 11:27:57 | → | merijn joins (~merijn@77.242.116.146) |
| 11:32:58 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 260 seconds) |
| 11:35:29 | trickard__ | is now known as trickard |
| 11:43:07 | → | weary-traveler joins (~user@user/user363627) |
| 11:44:07 | → | merijn joins (~merijn@77.242.116.146) |
| 11:48:35 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 240 seconds) |
| 11:57:07 | <__monty__> | edwardk: Do the AI videos set the tone for future content on your YouTube? |
| 12:00:56 | → | merijn joins (~merijn@77.242.116.146) |
| 12:01:10 | <Leary> | Looks like his account got hacked? |
| 12:01:22 | <__monty__> | That's what I'm hoping. |
| 12:01:53 | <__monty__> | But maybe it's to show off the AI hardware they're working on? |
| 12:05:35 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 240 seconds) |
| 12:08:46 | × | weary-traveler quits (~user@user/user363627) (Remote host closed the connection) |
| 12:10:48 | → | merijn joins (~merijn@77.242.116.146) |
| 12:13:30 | → | lambda_gibbon joins (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) |
| 12:15:34 | × | gawen quits (~gawen@user/gawen) (Quit: cya) |
| 12:16:03 | → | CiaoSen joins (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) |
| 12:17:52 | × | lambda_gibbon quits (~lambda_gi@2603:7080:ee00:37d8:11e:138e:d914:c117) (Ping timeout: 246 seconds) |
| 12:23:21 | × | p3n quits (~p3n@2a00:19a0:3:7c:0:d9c6:7cf6:1) (Quit: ZNC 1.10.1 - https://znc.in) |
| 12:24:54 | → | p3n joins (~p3n@217.198.124.246) |
| 12:31:34 | → | Square2 joins (~Square4@user/square) |
| 12:34:14 | × | yin quits (~zero@user/zero) (Ping timeout: 260 seconds) |
| 12:46:20 | × | Pozyomka quits (~pyon@user/pyon) (Quit: WeeChat 4.8.0) |
| 12:48:41 | → | Pozyomka joins (~pyon@user/pyon) |
| 12:50:34 | × | causal quits (~eric@50.46.156.145) (Quit: WeeChat 4.6.3) |
| 13:02:44 | <lucabtz> | is there a way i can improve the Day type here https://paste.tomsmeding.com/pO7MeUTu |
| 13:03:38 | <lucabtz> | i dont like it has a lot of parameters with no names, but records dont seem to work with existential types (i can put them but i still need to pattern match it seems) |
| 13:03:55 | × | arandombit quits (~arandombi@user/arandombit) (Ping timeout: 264 seconds) |
| 13:04:43 | → | arandombit joins (~arandombi@2603:7000:4600:ffbe:28ad:499f:4e0e:de68) |
| 13:04:43 | × | arandombit quits (~arandombi@2603:7000:4600:ffbe:28ad:499f:4e0e:de68) (Changing host) |
| 13:04:43 | → | arandombit joins (~arandombi@user/arandombit) |
| 13:04:48 | → | yin joins (~zero@user/zero) |
| 13:07:29 | × | akegalj quits (~akegalj@78-0-210-92.adsl.net.t-com.hr) (Ping timeout: 260 seconds) |
| 13:09:19 | <tomsmeding> | what doesn't work about records? |
| 13:09:51 | <Leary> | lucabtz: I would still name the fields, then use `NamedFieldPuns` when pattern matching. It's just selectors that won't work. |
| 13:09:59 | <tomsmeding> | ah |
| 13:12:07 | × | CiaoSen quits (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 246 seconds) |
| 13:13:54 | <lucabtz> | yeah selectors dont work |
| 13:14:10 | <lucabtz> | sorry i wasnt very clear |
| 13:14:23 | <lucabtz> | but yeah your idea seems good, at least for documentation purpose |
| 13:17:06 | AlexNoo_ | is now known as AlexNoo |
| 13:17:45 | → | ttybitnik joins (~ttybitnik@user/wolper) |
| 13:17:55 | × | chromoblob quits (~chromoblo@user/chromob1ot1c) (Ping timeout: 240 seconds) |
| 13:18:08 | → | chromoblob joins (~chromoblo@user/chromob1ot1c) |
| 13:18:49 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 13:19:03 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 13:20:04 | → | gawen joins (~gawen@user/gawen) |
| 13:20:09 | → | weary-traveler joins (~user@user/user363627) |
| 13:23:27 | → | akegalj joins (~akegalj@141-138-27-206.dsl.iskon.hr) |
| 13:43:43 | <lucabtz> | Leary: https://paste.tomsmeding.com/fuEJWIam looks great! |
| 13:44:41 | <lucabtz> | day03 = Day "2025-3" parseInput solve1 solve2 (testInput, testOutput) |
| 13:44:51 | <lucabtz> | now it is only the construction which looks ugly |
| 13:45:46 | <lucabtz> | though i could initialize them with the brackets i guess |
| 13:48:28 | <Leary> | You can also use `NamedFieldPuns` in construction if you name your functions correspondingly. |
| 13:49:29 | <__monty__> | Is there a fold/mapAccum where you can shortcircuit the folding and return the tail unaltered? |
| 13:49:57 | <lucabtz> | yeah i realized |
| 13:50:10 | <lucabtz> | i put NamedFieldPuns on the whole cabal project now |
| 13:54:03 | <lucabtz> | actually i cant get it to work in construction |
| 13:54:35 | trickard_ | is now known as trickard |
| 13:56:19 | → | tromp joins (~textual@2001:1c00:3487:1b00:a4ed:9e46:fd5d:6b4e) |
| 14:01:44 | <lucabtz> | having colliding names does work as nicely because i need to import the record selectors for the construction to work |
| 14:02:26 | <lucabtz> | but when importing the selector it will collide with the other thing named the same |
| 14:03:40 | <Leary> | `NoFieldSelectors` might help |
| 14:04:01 | <merijn> | NoFieldSelectors is bae |
| 14:05:06 | → | divlamir_ joins (~divlamir@user/divlamir) |
| 14:05:18 | → | spew joins (~spew@user/spew) |
| 14:05:38 | × | gawen quits (~gawen@user/gawen) (Quit: cya) |
| 14:06:03 | <lucabtz> | great |
| 14:07:09 | <lucabtz> | i will try |
| 14:07:12 | <lucabtz> | thank you again |
| 14:07:16 | × | divlamir quits (~divlamir@user/divlamir) (Ping timeout: 256 seconds) |
| 14:07:17 | divlamir_ | is now known as divlamir |
| 14:08:15 | × | akegalj quits (~akegalj@141-138-27-206.dsl.iskon.hr) (Ping timeout: 240 seconds) |
| 14:09:58 | → | wbooze joins (~inline@cgn-195-14-221-120.nc.de) |
| 14:10:22 | wbooze | is now known as Guest6657 |
| 14:14:18 | × | leah2 quits (~leah@vuxu.org) (Quit: Sprechen Sie noch? Wird noch gesprochen? Ich trenne.) |
| 14:15:35 | × | chromoblob quits (~chromoblo@user/chromob1ot1c) (Read error: Connection reset by peer) |
| 14:15:53 | → | chromoblob joins (~chromoblo@user/chromob1ot1c) |
| 14:16:54 | <__monty__> | `mapAccumL` with a Maybe for the state to indicate when the map should fall back to basically `id` feels wrong. |
| 14:17:28 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
| 14:17:29 | → | leah2 joins (~leah@vuxu.org) |
| 14:17:41 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 14:21:01 | → | gawen joins (~gawen@user/gawen) |
| 14:27:59 | → | Guest35 joins (~Guest35@2607:fa49:1940:8200:c958:535b:5462:796d) |
| 14:28:29 | <kuribas`> | __monty__: sounds like you want mapAccumR |
| 14:28:32 | <kuribas`> | :t mapAccumR |
| 14:28:35 | <lambdabot> | Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b) |
| 14:29:04 | × | Guest35 quits (~Guest35@2607:fa49:1940:8200:c958:535b:5462:796d) (Client Quit) |
| 14:29:16 | <kuribas`> | err |
| 14:29:23 | <__monty__> | I don't think so. Neither direction allows "shortcutting". |
| 14:29:38 | <kuribas`> | scanr? |
| 14:30:04 | <kuribas`> | scanr over tails... |
| 14:30:15 | <__monty__> | I don't see how that relates. |
| 14:30:28 | → | Guest35 joins (~Guest35@2607:fa49:1940:8200:c958:535b:5462:796d) |
| 14:30:37 | → | Googulator68 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 14:30:44 | × | Googulator quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 14:30:44 | × | Pozyomka quits (~pyon@user/pyon) (Quit: brb) |
| 14:31:00 | <__monty__> | The output is the same structure and length as the input. I'm pushing a value down into a structure, based on a condition I either push another value down or stop pushing any values down. |
| 14:31:08 | × | Googulator68 quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Client Quit) |
| 14:31:13 | → | Googulator40 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 14:31:19 | <tomsmeding> | do you have a specific reason for wanting this to be a pre-existing combinator? |
| 14:31:59 | <__monty__> | Intellectual curiosity mostly. It seems like something that could have an elegant combinator. |
| 14:32:17 | <tomsmeding> | I don't think any of the standard L/R combinators apply here -- the L ones because they continue recursing regardless, and the R ones because the information flow is the wrong way |
| 14:32:43 | <tomsmeding> | you can implement this with a foldr in a way similar that you can build foldl using foldr |
| 14:32:56 | <tomsmeding> | but I don't think it's a pre-existing combinator, at least in base |
| 14:33:07 | × | Guest35 quits (~Guest35@2607:fa49:1940:8200:c958:535b:5462:796d) (Write error: Broken pipe) |
| 14:33:26 | <__monty__> | Yep, but foldr and mapAccumL both have to process every element of the structure, no? Since I don't want to outright drop the tail. |
| 14:33:40 | <kuribas`> | __monty__: not foldr |
| 14:33:57 | <tomsmeding> | yeah thinking about this more I'm not sure anymore that you can do this using foldr |
| 14:34:11 | <__monty__> | tomsmeding: You can implement mapAccumL using foldr. |
| 14:34:15 | <tomsmeding> | I know |
| 14:34:29 | <tomsmeding> | base's foldl is implemented using foldr |
| 14:34:46 | <tomsmeding> | but while that construction is cute, I don't think you get access to the unadulterated tail |
| 14:35:01 | <__monty__> | kuribas`: Show me a foldr that doesn't drop any values and also doesn't visit a tail of several values. |
| 14:35:58 | <__monty__> | Yeah, with foldr you can either process every element, or drop whatever's left. |
| 14:36:23 | <tomsmeding> | yes I think so |
| 14:37:20 | <sprout> | you can do a scan instead of a fold and lazily stop evaluating when you hit something |
| 14:37:26 | <__monty__> | But that's not the "shortcutting" I'm looking for. I want to recurse up to a point and at that point return the tail unprocessed. The latter is just for efficiency rather than correctness. |
| 14:37:48 | <tomsmeding> | sprout: scan doesn't give you access to the actual original tail |
| 14:37:53 | <__monty__> | sprout: Again, that leaves me with only part of the input, no? |
| 14:37:55 | → | akegalj joins (~akegalj@141-138-27-206.dsl.iskon.hr) |
| 14:37:57 | <sprout> | hmyah |
| 14:37:58 | → | Pozyomka joins (~pyon@user/pyon) |
| 14:39:45 | <sprout> | put it in a monad? I feel like parser combinators will often return the unprocessed tokens on an error, so you should be able to reuse the idiom |
| 14:40:24 | <tomsmeding> | then you just punt the problem to the implementation of that monad |
| 14:40:33 | <sprout> | yah |
| 14:45:27 | × | gawen quits (~gawen@user/gawen) (Quit: cya) |
| 14:47:39 | × | Guest6657 quits (~inline@cgn-195-14-221-120.nc.de) (Quit: Leaving) |
| 14:51:23 | → | wbooze joins (~inline@cgn-195-14-221-120.nc.de) |
| 14:59:30 | <kuribas`> | > foldr (\(x:xs) cont -> \xs2 -> if (x > 5) then (x:xs) else (x*2) : cont xs) id (tails [1..10]) [] |
| 14:59:36 | <lambdabot> | [2,4,6,8,10,6,7,8,9,10] |
| 14:59:41 | <kuribas`> | ^ __monty__ |
| 15:00:00 | <kuribas`> | obviously needs some lambdacase. |
| 15:00:45 | × | spew quits (~spew@user/spew) (Ping timeout: 245 seconds) |
| 15:01:28 | × | divlamir quits (~divlamir@user/divlamir) (Ping timeout: 244 seconds) |
| 15:01:59 | × | ttybitnik quits (~ttybitnik@user/wolper) (Quit: Fading out...) |
| 15:02:40 | × | lucabtz quits (~lucabtz@user/lucabtz) (Remote host closed the connection) |
| 15:03:03 | → | spew joins (~spew@user/spew) |
| 15:04:23 | <kuribas`> | > take 10 $ foldr (\(x:xs) cont -> \xs2 -> if (x > 5) then (x:xs) else (x*2) : cont xs) id (tails [1..]) [] |
| 15:04:26 | <lambdabot> | [2,4,6,8,10,6,7,8,9,10] |
| 15:04:39 | <kuribas`> | --proof that it doesn't visit the tail :) |
| 15:04:45 | → | amadaluzia joins (~amadaluzi@user/amadaluzia) |
| 15:05:29 | → | lucabtz joins (~lucabtz@user/lucabtz) |
| 15:05:52 | <__monty__> | Only shortcoming is if the condition is never fulfilled, needs more case analysis. |
| 15:07:06 | <__monty__> | Feels a lot like span/break and folding the fst. |
| 15:07:41 | <__monty__> | Hmm, no the span/break would need to carry state forward. |
| 15:08:38 | <kuribas`> | Actually, this doesn't use the continuation ... |
| 15:08:41 | <kuribas`> | > foldr (\(x:xs) xs2 -> if (x > 5) then (x:xs) else (x*2) : xs2) [] (tails [1..10]) |
| 15:08:44 | <lambdabot> | [2,4,6,8,10,6,7,8,9,10] |
| 15:09:08 | <kuribas`> | You can use the continuation if you need to pass some state. |
| 15:09:40 | × | wbooze quits (~inline@cgn-195-14-221-120.nc.de) (Quit: Leaving) |
| 15:10:08 | → | gawen joins (~gawen@user/gawen) |
| 15:10:27 | <__monty__> | > foldr (\(x:xs) xs2 -> if False then (x:xs) else (x*2) : xs2) [] (tails [1..10]) |
| 15:10:30 | <lambdabot> | [2,4,6,8,10,12,14,16,18,20*Exception: <interactive>:3:8-59: Non-exhaustive p... |
| 15:10:39 | × | spew quits (~spew@user/spew) (Quit: nyaa~) |
| 15:10:44 | <__monty__> | This is the missing case analysis I was referring to. |
| 15:10:56 | → | spew joins (~spew@user/spew) |
| 15:10:56 | <kuribas`> | > foldr (\(x:xs) cont s -> if (s > 7) then (x:xs) else (x*2) : cont (s+x)) (const []) (tails [1..10]) 0 |
| 15:11:00 | <__monty__> | But the idea works. |
| 15:11:00 | <lambdabot> | [2,4,6,8,5,6,7,8,9,10] |
| 15:12:22 | → | califax_ joins (~califax@user/califx) |
| 15:13:49 | → | chexum_ joins (~quassel@gateway/tor-sasl/chexum) |
| 15:14:06 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 272 seconds) |
| 15:14:06 | × | califax quits (~califax@user/califx) (Ping timeout: 272 seconds) |
| 15:14:06 | × | sord937 quits (~sord937@gateway/tor-sasl/sord937) (Ping timeout: 272 seconds) |
| 15:14:07 | califax_ | is now known as califax |
| 15:15:02 | <lucabtz> | kuribas` if there is no state can't you just use break |
| 15:15:15 | <kuribas`> | break? |
| 15:15:27 | → | sord937 joins (~sord937@gateway/tor-sasl/sord937) |
| 15:15:40 | <lucabtz> | or span |
| 15:15:59 | <kuribas`> | sure |
| 15:16:26 | × | bitdex_ quits (~bitdex@gateway/tor-sasl/bitdex) (Quit: = "") |
| 15:16:43 | <kuribas`> | > let (xs, ys) = break (> 5) [1..10] in map (*2) xs ++ ys |
| 15:16:46 | <lambdabot> | [2,4,6,8,10,6,7,8,9,10] |
| 15:16:54 | <lucabtz> | yep |
| 15:21:12 | → | aljazmc joins (~aljazmc@user/aljazmc) |
| 15:22:30 | × | st_aldini quits (~Thunderbi@2605:a601:a07c:7400:6e26:f360:f11d:472c) (Quit: st_aldini) |
| 15:22:58 | → | st_aldini joins (~Thunderbi@2605:a601:a07c:7400:6e26:f360:f11d:472c) |
| 15:26:09 | × | akegalj quits (~akegalj@141-138-27-206.dsl.iskon.hr) (Quit: leaving) |
| 15:27:23 | <__monty__> | Yes, already mentioned that. |
| 15:27:51 | <kuribas`> | > foldr (\(x:xs) xs2 -> if False then (x:xs) else (x*2) : xs2) [] (init $ tails [1..10]) -- __monty__ |
| 15:27:54 | <lambdabot> | [2,4,6,8,10,12,14,16,18,20] |
| 15:28:37 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 265 seconds) |
| 15:29:14 | × | Square2 quits (~Square4@user/square) (Ping timeout: 260 seconds) |
| 15:30:47 | → | Googulator88 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 15:31:10 | <__monty__> | Yeah, that works. |
| 15:32:44 | <__monty__> | "Foldr the init of the tails" is not quite the elegance I was hoping for but it does make foldr more useful still. |
| 15:33:02 | → | merijn joins (~merijn@77.242.116.146) |
| 15:33:59 | × | Googulator40 quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Ping timeout: 250 seconds) |
| 15:35:51 | <kuribas`> | :t tails1 |
| 15:35:54 | <lambdabot> | error: [GHC-88464] |
| 15:35:54 | <lambdabot> | Variable not in scope: tails1 |
| 15:35:54 | <lambdabot> | Suggested fix: |
| 15:38:06 | <kuribas`> | https://hackage.haskell.org/package/base-4.21.0.0/docs/Data-List.html#v:tails1 |
| 15:39:54 | × | tromp quits (~textual@2001:1c00:3487:1b00:a4ed:9e46:fd5d:6b4e) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 15:40:02 | <kuribas`> | removed apparently... |
| 15:41:05 | <__monty__> | Probably because it's partial? |
| 15:41:18 | <__monty__> | Oh, it's not. |
| 15:44:30 | <kuribas`> | ah no, it's added |
| 15:44:33 | → | lambda_gibbon joins (~lambda_gi@208.83.175.39) |
| 15:45:34 | <kuribas`> | __monty__: tbf if you really care about performance, you shouldn't use linked lists. |
| 15:46:53 | <__monty__> | I wasn't really asking about lists though. More like anything Foldable or Somethingable if folds are not a powerful enough concept to capture the behavior. |
| 15:48:12 | <Leary> | `Witherable`, probably. |
| 15:49:33 | <Leary> | Well, if you want to drop any elements. Maybe `Traversable` is enough if you don't. |
| 15:49:57 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 250 seconds) |
| 15:50:26 | <__monty__> | I'm open to suggestions for a data structure for the specific case of pushing a value into the flat structure from the front and stopping when the value being pushed is smaller than the next. Think of a row of marbles, the first marble smaller than the one pushing against it falls out. |
| 15:50:30 | <kuribas`> | __monty__: folds are isomorphic to a list |
| 15:50:38 | <kuribas`> | :t toList |
| 15:50:41 | <lambdabot> | Foldable t => t a -> [a] |
| 15:51:37 | <Leary> | __monty__: In that case, why flat? It really sounds like you want a heap or a set. |
| 15:52:16 | × | Jackneill quits (~Jackneill@178-164-177-218.pool.digikabel.hu) (Read error: Connection reset by peer) |
| 15:52:21 | <__monty__> | In my case the extra structure isn't necessary. |
| 15:52:28 | → | Jackneill joins (~Jackneill@178-164-177-218.pool.digikabel.hu) |
| 15:55:13 | → | divlamir joins (~divlamir@user/divlamir) |
| 15:56:04 | → | merijn joins (~merijn@77.242.116.146) |
| 15:56:08 | × | pavonia quits (~user@user/siracusa) (Quit: Bye!) |
| 15:58:18 | × | acidjnk quits (~acidjnk@p200300d6e71719231986af8ebf40e0fc.dip0.t-ipconnect.de) (Ping timeout: 244 seconds) |
| 16:02:28 | × | divlamir quits (~divlamir@user/divlamir) (Ping timeout: 255 seconds) |
| 16:02:51 | → | tromp joins (~textual@2001:1c00:3487:1b00:a4ed:9e46:fd5d:6b4e) |
| 16:04:39 | <tomsmeding> | __monty__: if the values have a well-defined ordering, a binary tree will give you O(log(n)) insertion instead of O(n) |
| 16:04:43 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Ping timeout: 255 seconds) |
| 16:04:56 | <tomsmeding> | but the fact that you're asking about a list suggests you have no such ordering :) |
| 16:05:43 | → | divlamir joins (~divlamir@user/divlamir) |
| 16:05:45 | → | Googulator56 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 16:05:47 | × | Googulator88 quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 16:06:01 | <tomsmeding> | (that data structure is Data.Set) |
| 16:16:21 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 16:17:58 | → | Lycurgus joins (~juan@user/Lycurgus) |
| 16:25:15 | → | acidjnk joins (~acidjnk@p200300d6e71719231986af8ebf40e0fc.dip0.t-ipconnect.de) |
| 16:28:55 | × | gawen quits (~gawen@user/gawen) (Quit: cya) |
| 16:30:19 | <tomsmeding> | can I override GHC's arity analysis to force a particular function to have lower arity than GHC would otherwise infer? |
| 16:30:50 | <tomsmeding> | I have some data that I can already compute based on only the first argument that I would like to share over multiple calls that have the same first argument, and GHC isn't doing it |
| 16:31:20 | <Lycurgus> | wo TH or nuthin i presume |
| 16:31:22 | <tomsmeding> | I can force GHC to do what I want by making the "inner function" NOINLINE (at which point the (inlined) "outer function" does the proper sharing), but that feels like a hack |
| 16:32:33 | <tomsmeding> | (I don't see how TH is relevant here) |
| 16:32:45 | <Lycurgus> | nor "nuthin"? |
| 16:32:55 | <tomsmeding> | well, presumably something is relevant here, yes |
| 16:33:28 | → | gawen joins (~gawen@user/gawen) |
| 16:33:37 | <Lycurgus> | i couild expand as a very rude name of this category of quety has occured to me but being a real person i know better |
| 16:34:05 | <Leary> | tomsmeding: Does it work if you push the latter args into lambdas and bang the shared binding? |
| 16:34:29 | × | aljazmc quits (~aljazmc@user/aljazmc) (Remote host closed the connection) |
| 16:34:35 | <Lycurgus> | *query |
| 16:34:56 | → | aljazmc joins (~aljazmc@user/aljazmc) |
| 16:34:58 | <Lycurgus> | *could |
| 16:35:27 | <tomsmeding> | Leary: doesn't seem to; they were already in a separate lambda (within a 'let' that defines the shared binding), but adding a ! doesn't seem to help |
| 16:35:50 | → | haritz joins (~hrtz@2a01:4b00:bc2e:7000:d5af:a266:ca31:5ef8) |
| 16:35:50 | × | haritz quits (~hrtz@2a01:4b00:bc2e:7000:d5af:a266:ca31:5ef8) (Changing host) |
| 16:35:50 | → | haritz joins (~hrtz@user/haritz) |
| 16:35:53 | <Leary> | `NOINLINE` it is, then. |
| 16:36:33 | <tomsmeding> | the downside is that that makes performance slightly worse if the function is only called once |
| 16:36:45 | <tomsmeding> | but I'll just have to live with that I suppose :) |
| 16:37:06 | <tomsmeding> | (it's a 2x improvement when called many times, at the cost of a 10% slowdown when called once) |
| 16:37:32 | <Leary> | Oh, you're putting that on the inner /function/? Why not on the shared value? |
| 16:37:50 | <tomsmeding> | how do you suggest I put it on the shared value? |
| 16:38:11 | <tomsmeding> | the function looks like: \sh -> let suffixes = ... in \i -> ...body... |
| 16:38:46 | <tomsmeding> | putting the (\i -> body) in a separate binding and NOINLINE-marking that binding seems to ensure that 'suffixes' is properly shared over multiple adjacent calls |
| 16:39:21 | <Leary> | `let { {-# NOINLINE suffixes #-}; suffixes = ... } in \i -> ...` |
| 16:39:58 | <tomsmeding> | doesn't work |
| 16:40:28 | <Leary> | Weird. I've used it in a `where` block. |
| 16:40:45 | × | lucabtz quits (~lucabtz@user/lucabtz) (Remote host closed the connection) |
| 16:40:45 | <tomsmeding> | I recall that it worked before, in this very function -- something broke it |
| 16:41:20 | <tomsmeding> | anyway, I'll just live with the 10% :) |
| 16:41:25 | <tomsmeding> | thanks for thinking along |
| 16:43:41 | <fgarcia> | /buffer 2 |
| 16:47:17 | × | vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 244 seconds) |
| 16:49:38 | → | sindu joins (~sindu@2.148.32.207.tmi.telenormobil.no) |
| 16:50:45 | × | aljazmc quits (~aljazmc@user/aljazmc) (Quit: Leaving) |
| 16:56:04 | → | humasect joins (~humasect@dyn-192-249-132-90.nexicom.net) |
| 17:02:45 | → | comerijn joins (~merijn@77.242.116.146) |
| 17:02:46 | trickard_ | is now known as trickard |
| 17:03:40 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 245 seconds) |
| 17:05:43 | → | Googulator55 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 17:05:51 | × | Googulator56 quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 17:07:23 | × | chele quits (~chele@user/chele) (Remote host closed the connection) |
| 17:07:31 | × | comerijn quits (~merijn@77.242.116.146) (Ping timeout: 250 seconds) |
| 17:09:15 | × | ouilemur quits (~jgmerritt@user/ouilemur) (Quit: WeeChat 4.7.2) |
| 17:09:46 | × | lambda_gibbon quits (~lambda_gi@208.83.175.39) (Ping timeout: 246 seconds) |
| 17:13:19 | → | lambda_gibbon joins (~lambda_gi@208.83.175.39) |
| 17:13:39 | × | spew quits (~spew@user/spew) (Ping timeout: 260 seconds) |
| 17:15:11 | <ski> | @hoogle (a -> [a] -> b -> b) -> b -> [a] -> b |
| 17:15:11 | <lambdabot> | No results found |
| 17:15:16 | → | spew joins (~spew@user/spew) |
| 17:17:11 | → | mikess joins (~sam@user/mikess) |
| 17:19:50 | × | Lycurgus quits (~juan@user/Lycurgus) (Quit: alsoknownas.renjuan.org ( juan@acm.org )) |
| 17:23:51 | → | vanishingideal joins (~vanishing@user/vanishingideal) |
| 17:26:23 | × | kuribas` quits (~user@ip-188-118-57-242.reverse.destiny.be) (Remote host closed the connection) |
| 17:28:16 | → | Tuplanolla joins (~Tuplanoll@91-152-225-194.elisa-laajakaista.fi) |
| 17:35:51 | × | Googulator55 quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 17:36:04 | → | Googulator55 joins (~Googulato@85-238-68-117.pool.digikabel.hu) |
| 17:39:53 | × | vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 260 seconds) |
| 17:40:25 | → | ttybitnik joins (~ttybitnik@user/wolper) |
| 17:41:49 | × | sord937 quits (~sord937@gateway/tor-sasl/sord937) (Quit: sord937) |
| 17:41:54 | → | pr1sm joins (~pr1sm@24.91.163.31) |
| 17:42:18 | → | euphores joins (~SASL_euph@user/euphores) |
| 17:47:16 | × | pr1sm quits (~pr1sm@24.91.163.31) (Remote host closed the connection) |
| 17:47:32 | × | Jackneill quits (~Jackneill@178-164-177-218.pool.digikabel.hu) (Remote host closed the connection) |
| 17:47:42 | → | Jackneill joins (~Jackneill@178-164-177-218.pool.digikabel.hu) |
| 17:56:08 | → | divlamir_ joins (~divlamir@user/divlamir) |
| 17:56:37 | × | annamalai quits (~annamalai@157.32.222.111) (Read error: Connection reset by peer) |
| 17:56:57 | → | annamalai joins (~annamalai@157.32.222.111) |
| 17:59:01 | × | divlamir quits (~divlamir@user/divlamir) (Ping timeout: 255 seconds) |
| 17:59:01 | divlamir_ | is now known as divlamir |
| 18:02:09 | → | wbooze joins (~wbooze@2001-4dd7-9813-0-5961-9b55-d1ca-8eee.ipv6dyn.netcologne.de) |
| 18:05:22 | → | Anarchos joins (~Anarchos@91-161-254-16.subs.proxad.net) |
| 18:05:46 | × | Googulator55 quits (~Googulato@85-238-68-117.pool.digikabel.hu) (Quit: Client closed) |
| 18:08:44 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 18:09:08 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 18:09:55 | × | mulk quits (~mulk@pd9514972.dip0.t-ipconnect.de) (Read error: Connection reset by peer) |
| 18:14:38 | → | tzh joins (~tzh@c-76-115-131-146.hsd1.or.comcast.net) |
| 18:18:11 | → | mulk joins (~mulk@pd9514972.dip0.t-ipconnect.de) |
| 18:23:38 | × | trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 18:23:46 | → | machinedgod joins (~machinedg@d75-159-126-101.abhsia.telus.net) |
| 18:23:52 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 18:25:53 | <__monty__> | tomsmeding: That part of the structure is necessary. Ordering of the elements is significant. |
| 18:27:33 | → | target_i joins (~target_i@user/target-i/x-6023099) |
| 18:31:25 | ← | Anarchos parts (~Anarchos@91-161-254-16.subs.proxad.net) () |
| 18:31:52 | → | ljdarj joins (~Thunderbi@user/ljdarj) |
| 18:33:59 | × | skum quits (~skum@user/skum) (Quit: WeeChat 4.7.2) |
| 18:34:22 | → | skum joins (~skum@user/skum) |
| 18:37:36 | → | ouilemur joins (~jgmerritt@user/ouilemur) |
| 18:42:46 | <haskellbridge> | <Zemyla> If f is representational and Applicative, then does that necessarily imply that liftA2 coerce a b = coerce a <*> b? |
| 18:44:24 | <tomsmeding> | well, `liftA2 f x y = f <$> x <*> y` is a law |
| 18:45:33 | <tomsmeding> | so it sounds like you're asking: if f's argument is representational, do we have `fmap coerce x = coerce x` for `x :: f (a -> b)` |
| 18:46:11 | × | euphores quits (~SASL_euph@user/euphores) (Quit: Leaving.) |
| 18:47:48 | <tomsmeding> | which sounds like it _ought_ to be true, but I don't know what to conclude that from |
| 18:48:48 | × | humasect quits (~humasect@dyn-192-249-132-90.nexicom.net) (Remote host closed the connection) |
| 18:49:01 | → | vanishingideal joins (~vanishing@user/vanishingideal) |
| 18:49:56 | → | CiaoSen joins (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) |
| 19:01:45 | → | ljdarj1 joins (~Thunderbi@user/ljdarj) |
| 19:03:15 | × | ljdarj quits (~Thunderbi@user/ljdarj) (Ping timeout: 240 seconds) |
| 19:03:15 | ljdarj1 | is now known as ljdarj |
| 19:07:28 | × | trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 19:07:41 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 19:10:19 | × | lambda_gibbon quits (~lambda_gi@208.83.175.39) (Ping timeout: 260 seconds) |
| 19:12:11 | <Leary> | Zemyla: Say we have `Functor F` with `type role F representational`. That means we have `forall a b. Coercible a b => Coercible (F a) (F b)`. `Coercible` can be modeled as an implicit `->` restricted to canonical no-ops, so (ignoring the other direction) this corresponds to a `liftCoercion :: (a -> b) -> F a -> F b` function operating on the restricted domain. |
| 19:12:24 | <Leary> | @free liftCoercion :: (a -> b) -> F a -> F b |
| 19:12:24 | <lambdabot> | g . h = k . f => $map_F g . liftCoercion h = liftCoercion k . $map_F f |
| 19:13:04 | <Leary> | Let g = k = coerce @a @b; h = f = id @a. This satisfies the precondition, giving us: fmap (coerce @a @b) . liftCoercion (coerce @a @a) = coerce @(F a) @(F b) . fmap (id @a) |
| 19:13:44 | <Leary> | Boiling down to `fmap coerce = coerce`. |
| 19:16:41 | → | Googulator joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 19:23:24 | → | ft joins (~ft@p508db844.dip0.t-ipconnect.de) |
| 19:26:10 | <haskellbridge> | <Zemyla> Okay, so it is true. |
| 19:27:39 | <yin> | @type join @((->) _) |
| 19:27:43 | <lambdabot> | Monad ((->) w) => (w -> (w -> a)) -> w -> a |
| 19:27:54 | <yin> | aren't those parenthesis redundant? |
| 19:28:07 | <yin> | the inner ones |
| 19:28:20 | <EvanR> | yes |
| 19:29:11 | <yin> | grinds my gears |
| 19:29:15 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 240 seconds) |
| 19:31:12 | <haskellbridge> | <Zemyla> I'm not sure, but I think it'd even mean that liftA2 coerce = coerce (<*>). |
| 19:34:58 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 19:35:40 | × | Googulator quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 19:35:47 | → | Googulator joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 19:44:09 | × | Googulator quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 19:44:57 | → | Googulator joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 19:47:17 | trickard_ | is now known as trickard |
| 19:55:48 | × | spew quits (~spew@user/spew) (Quit: WeeChat 4.7.2) |
| 19:58:12 | <tomsmeding> | Leary: it turns out `NOINLINE [0]` yields the desired behaviour, at least on 9.8, 9.10, 9.12 and the 9.14 RC |
| 19:58:24 | <tomsmeding> | (credit doesn't go to me though) |
| 20:07:21 | <Leary> | tomsmeding: Weird. Any idea why? |
| 20:08:03 | → | lambda_gibbon joins (~lambda_gi@208.83.175.39) |
| 20:08:13 | <tomsmeding> | perhaps if GHC inlines the whole thing in one go it fuses the two lambdas before it realises something can be lifted? |
| 20:08:15 | <tomsmeding> | I don't know |
| 20:12:15 | × | lambda_gibbon quits (~lambda_gi@208.83.175.39) (Ping timeout: 240 seconds) |
| 20:20:17 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 20:24:22 | × | sp1ff quits (~user@2601:1c2:4c00:6820::e122) (Read error: Connection reset by peer) |
| 20:25:04 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 246 seconds) |
| 20:25:29 | × | trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 20:25:43 | → | trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au) |
| 20:31:21 | → | pavonia joins (~user@user/siracusa) |
| 20:32:31 | trickard_ | is now known as trickard |
| 20:35:46 | × | Googulator quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 20:35:47 | → | Googulator33 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 20:35:55 | Googulator33 | is now known as Googulator |
| 20:36:05 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 20:37:07 | × | collide2954 quits (~collide29@user/collide2954) (Quit: The Lounge - https://thelounge.chat) |
| 20:39:45 | × | AlexNoo quits (~AlexNoo@85.174.183.177) (Read error: Connection reset by peer) |
| 20:40:12 | → | AlexNoo joins (~AlexNoo@85.174.183.177) |
| 20:40:55 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds) |
| 20:48:31 | → | euphores joins (~SASL_euph@user/euphores) |
| 20:51:52 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 20:53:21 | × | Googulator quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 20:53:40 | → | Googulator joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 20:54:43 | × | jreicher quits (~user@user/jreicher) (Quit: In transit) |
| 20:55:23 | × | sam113101 quits (~sam@modemcable200.189-202-24.mc.videotron.ca) (Read error: Connection reset by peer) |
| 20:56:58 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds) |
| 21:04:37 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 21:04:55 | × | euphores quits (~SASL_euph@user/euphores) (Ping timeout: 240 seconds) |
| 21:09:26 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds) |
| 21:18:20 | × | jrm quits (~jrm@user/jrm) (Quit: ciao) |
| 21:19:37 | → | jrm joins (~jrm@user/jrm) |
| 21:20:01 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 21:23:02 | × | jrm quits (~jrm@user/jrm) (Client Quit) |
| 21:24:13 | → | jrm joins (~jrm@user/jrm) |
| 21:24:44 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds) |
| 21:25:49 | <haskellbridge> | <lucabtz> I kinda wish + and times had their own typeclasses instead of being in Num |
| 21:28:36 | <EvanR> | truth |
| 21:29:06 | <Rembane> | Hard agree |
| 21:29:31 | <EvanR> | lots of stuff has only + or * not both |
| 21:29:58 | → | sam113101 joins (~sam@modemcable200.189-202-24.mc.videotron.ca) |
| 21:30:15 | <EvanR> | then negative starts to make it weird |
| 21:30:50 | <monochrom> | It's OK, a subclass of + that adds -, a subclass of * that adds / |
| 21:31:13 | <tomsmeding> | also fromInteger separately please |
| 21:31:29 | <tomsmeding> | matrices can be Num just fine except that fromInteger makes no sense (what size to return?) |
| 21:31:42 | <Rembane> | Six, seven! |
| 21:31:53 | <tomsmeding> | a six-by-seven matrix, it has been decided |
| 21:32:13 | <haskellbridge> | <lucabtz> Yeah there should be Additive with just + and Multiplicative with just *, no inverses either I think |
| 21:33:10 | <tomsmeding> | it would be most flexible if it was all split out, yes, though then you do get that you have to give 6 instance declarations to get anywhere for a number-like thing |
| 21:33:31 | <Leary> | The good reason to separate `fromInteger` is to allow literals when you don't have a ring. When you do, you always have a unique homomorphism from `Integer`, so `fromInteger` makes as much sense as your `Num` instance. |
| 21:34:10 | <haskellbridge> | <lucabtz> tomsmeding that could be fixed by having an alias for a set of constraints |
| 21:34:12 | <tomsmeding> | Leary: do matrices form a ring? |
| 21:34:52 | <haskellbridge> | <lucabtz> Num would become something like AdditiveGroup & MultiplicativeGroup & FromInteger etc. |
| 21:34:58 | <tomsmeding> | lucabtz: I was talking about the declarations rather than the user side. But yes, the user side is even worse -- fortunately mostly addressed by synonyms, as you say |
| 21:35:38 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 21:35:49 | <tomsmeding> | Leary: my answer would be: no, it's some kind of indexed ring. It's morally a ring, kind of, but it isn't in the strict sense, and bye goes your unique fromInteger |
| 21:36:14 | <tomsmeding> | (there's probably a way to make precise exactly what it is) |
| 21:36:17 | <monochrom> | I would do this. Semigroup takes one more type param, it specifies the operator. Likewise for Monoid and Group. Then you just have 3 type classes, and they cover +, negate, *, recip, and, or, ... |
| 21:36:32 | <tomsmeding> | monochrom: how does that help? |
| 21:36:47 | <tomsmeding> | I guess it floods the namespace less |
| 21:37:00 | <tomsmeding> | you need exactly the same number of instance declarations and constraints, though |
| 21:37:13 | <haskellbridge> | <lucabtz> Yeah it's the same as I'm saying where Additive = Monoid + |
| 21:37:15 | <monochrom> | "instance Semigroup Sum Int", "instance Semigroup Product Int". |
| 21:37:26 | <haskellbridge> | <lucabtz> And AdditiveGroup = Group + |
| 21:37:47 | <tomsmeding> | monochrom: where the first parameter is a phantom parameter? |
| 21:37:57 | <Leary> | tomsmeding: Square matrices of a /given dimension/ will be. If that dimension is in your type, fine. If it isn't, your other operations are screwed too. |
| 21:38:02 | <tomsmeding> | and (+) :: Semigroup Sum a => a -> a -> a |
| 21:38:25 | <tomsmeding> | Leary: well, the other operations are partial. |
| 21:38:27 | <monochrom> | Yeah, a phantom type that specifies the binary operator. |
| 21:38:40 | <tomsmeding> | I can't even suffice with a partial fromInteger -- well, one that is defined as `error` is possible, yes |
| 21:38:50 | <haskellbridge> | <lucabtz> What if you want a Monoid neither of those? |
| 21:38:51 | <Leary> | tomsmeding: Yep, hence "makes as much sense as your `Num`." |
| 21:38:58 | <tomsmeding> | less! |
| 21:39:28 | <tomsmeding> | I'd say an untyped matrix type with (+) and (*) makes some amount of sense, even if the operations are necessarily partial. I have not even a partial definition to give for fromInteger |
| 21:39:58 | <tomsmeding> | (yes, if the dimensions are in the type all is fine) |
| 21:40:11 | → | ljdarj1 joins (~Thunderbi@user/ljdarj) |
| 21:40:27 | × | ljdarj quits (~Thunderbi@user/ljdarj) (Ping timeout: 252 seconds) |
| 21:40:27 | ljdarj1 | is now known as ljdarj |
| 21:40:32 | × | dhil quits (~dhil@5.151.29.137) (Ping timeout: 240 seconds) |
| 21:40:47 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 265 seconds) |
| 21:42:09 | × | takuan quits (~takuan@d8D86B9E9.access.telenet.be) (Remote host closed the connection) |
| 21:42:25 | <tomsmeding> | https://hackage.haskell.org/package/hmatrix-0.20.2/docs/src/Numeric.Matrix.html#line-48 |
| 21:42:36 | <tomsmeding> | this instance returns a 1x1 matrix in fromInteger, which is about the best you can do |
| 21:43:25 | <tomsmeding> | (which is ameliorated by binary operations auto-broadcasting their operands when one of their dimensions has size 1) |
| 21:43:44 | <EvanR> | tomsmeding, a zero by zero matrix |
| 21:43:57 | <tomsmeding> | that makes only slightly less sense than a 1x1 matrix |
| 21:44:45 | <EvanR> | it's the first choice in the list |
| 21:44:51 | <EvanR> | xD |
| 21:47:38 | <EvanR> | to simplify the "untyped matrix" thing, make it an infinite grid with cell 0 0 at the center |
| 21:47:57 | <EvanR> | compute the answers lazily, fits any finite use case |
| 21:48:39 | <EvanR> | now it's not partial and fails on you just like untyped languages |
| 21:48:54 | <EvanR> | by producing nonsense when you mess up |
| 21:49:12 | <EvanR> | also answers what fromInteger does |
| 21:51:27 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 21:56:07 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 21:56:21 | <haskellbridge> | <lucabtz> https://paste.tomsmeding.com/2X4DbihK |
| 21:56:26 | <haskellbridge> | <lucabtz> would this work |
| 21:56:57 | <haskellbridge> | <lucabtz> Doesn't use phantom types, but still connects Monoid to Additive and Multiplicative |
| 21:57:23 | <EvanR> | one :: 0 |
| 21:57:41 | → | lambda_gibbon joins (~lambda_gi@208.83.175.39) |
| 21:57:43 | <haskellbridge> | <lucabtz> I'm typing from the phone :p |
| 21:57:46 | <EvanR> | but this class basically mirrors the idris version of Num |
| 21:57:54 | <EvanR> | seems to work for them |
| 21:59:49 | <Leary> | lucabtz: You might be interested in these, which I wrote forever ago: https://paste.tomsmeding.com/eQbuVoyR |
| 22:01:25 | × | weary-traveler quits (~user@user/user363627) (Remote host closed the connection) |
| 22:02:24 | × | lambda_gibbon quits (~lambda_gi@208.83.175.39) (Ping timeout: 260 seconds) |
| 22:04:01 | → | lambda_gibbon joins (~lambda_gi@208.83.175.39) |
| 22:05:19 | × | X-Scale quits (~ARM@50.65.114.89.rev.vodafone.pt) (Ping timeout: 240 seconds) |
| 22:05:34 | × | Googulator quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 22:05:39 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 22:05:44 | → | Googulator joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 22:09:16 | <haskellbridge> | <lucabtz> Leary yeah looks great |
| 22:10:33 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds) |
| 22:17:34 | <monochrom> | :) |
| 22:21:28 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 22:22:27 | ZLima12_ | is now known as ZLima12 |
| 22:23:00 | <haskellbridge> | <lucabtz> Maybe in + I would require commutative too though |
| 22:24:15 | <Leary> | Yeah, it originally did, that's why it follows the class dec. I removed it for some reason, lost to time. |
| 22:25:44 | → | jreicher joins (~user@user/jreicher) |
| 22:26:07 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 22:27:07 | <haskellbridge> | <lucabtz> Additive and Multiplicative are just newtype wrappers? |
| 22:33:35 | <EvanR> | + is required to be commutative and * is not. Good, so floating point can play xD |
| 22:34:06 | <EvanR> | (actually is * commutative) |
| 22:35:47 | × | Googulator quits (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed) |
| 22:35:49 | → | Googulator90 joins (~Googulato@2a01-036d-0106-479c-d9ec-010d-f188-ffcb.pool6.digikabel.hu) |
| 22:37:14 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 22:38:25 | <monochrom> | Sum and Product are the newtype wrappers. |
| 22:41:08 | <Leary> | lucabtz: Yeah. |
| 22:41:43 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 22:41:48 | <Leary> | I wanted adjectives, so I didn't reuse `Sum` and `Product`. |
| 22:44:33 | × | target_i quits (~target_i@user/target-i/x-6023099) (Quit: leaving) |
| 22:45:31 | × | michalz quits (~michalz@185.246.207.205) (Remote host closed the connection) |
| 22:46:23 | <monochrom> | Summative, Productive >:) |
| 22:49:36 | Googulator90 | is now known as Googulator |
| 22:53:00 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 22:58:58 | <TMA> | due to the vagaries of the English language/of English, nearly every word can be a noun, a verb and an adjective simultaneously. For some words there are some preferences to using certain alternatives in certain functions. Those are the vestiges of the past, when the current rules in the rule book did not rule. |
| 22:59:54 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds) |
| 23:03:55 | <haskellbridge> | <lucabtz> Leary maybe your way is better than an Additive typeclass as I was doing |
| 23:06:14 | × | oats quits (~oats@user/oats) (Read error: Connection reset by peer) |
| 23:06:29 | → | oats joins (~oats@user/oats) |
| 23:06:39 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 23:11:15 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 23:12:37 | → | emmanuelux joins (~emmanuelu@user/emmanuelux) |
| 23:14:10 | <EvanR> | TMA, due to buffy the vampire slayer, anything can be anythinged |
| 23:22:01 | → | Sgeo joins (~Sgeo@user/sgeo) |
| 23:22:15 | × | lambda_gibbon quits (~lambda_gi@208.83.175.39) (Ping timeout: 240 seconds) |
| 23:22:25 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 23:23:30 | <geekosaur> | due to pretty much any native English speaker 🙂 |
| 23:23:41 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine) |
| 23:23:51 | × | tromp quits (~textual@2001:1c00:3487:1b00:a4ed:9e46:fd5d:6b4e) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 23:25:36 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 23:27:25 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 245 seconds) |
| 23:28:07 | × | sindu quits (~sindu@2.148.32.207.tmi.telenormobil.no) (Ping timeout: 240 seconds) |
| 23:30:40 | <EvanR> | the word museum in washington DC is pretty cool |
| 23:31:02 | <EvanR> | all about language learning language, inventing new words, and not just english |
| 23:38:12 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 23:42:55 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds) |
| 23:46:16 | → | Lycurgus joins (~juan@user/Lycurgus) |
| 23:47:15 | → | peterbecich joins (~Thunderbi@172.222.148.214) |
| 23:53:40 | × | peterbecich quits (~Thunderbi@172.222.148.214) (Ping timeout: 246 seconds) |
| 23:54:00 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 23:58:28 | × | CiaoSen quits (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 260 seconds) |
| 23:59:07 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds) |
All times are in UTC on 2025-12-03.