Home liberachat/#haskell: Logs Calendar

Logs on 2024-05-16 (liberachat/#haskell)

00:11:59 × troydm quits (~troydm@user/troydm) (Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset)
00:40:05 × cawfee quits (~root@2406:3003:2077:1c50::babe) (Ping timeout: 256 seconds)
00:41:39 × visilii quits (~visilii@188.254.110.43) (Read error: Connection reset by peer)
00:42:14 visilii joins (~visilii@217.107.125.158)
00:48:36 <Axman6> IORef + atomicModifyIORef['] is actually a very useful tool for concurrent programs which also has quite good performance
00:50:29 <Axman6> Hmm, I shoudl check timestamps before replying to discussions from last night =)
00:52:39 × machinedgod quits (~machinedg@d173-183-246-216.abhsia.telus.net) (Ping timeout: 255 seconds)
00:59:31 yin_ joins (~yin@user/zero)
01:09:02 × otto_s quits (~user@p5de2fa8d.dip0.t-ipconnect.de) (Ping timeout: 256 seconds)
01:10:55 otto_s joins (~user@p4ff27827.dip0.t-ipconnect.de)
01:17:32 × y04nn quits (~username@2a03:1b20:8:f011::e10d) (Ping timeout: 260 seconds)
01:21:33 philopsos joins (~caecilius@pool-71-183-97-38.nycmny.fios.verizon.net)
01:25:29 × xff0x quits (~xff0x@2405:6580:b080:900:8cc9:e47c:f89a:15ee) (Ping timeout: 268 seconds)
01:25:43 libertyprime joins (~libertypr@118-92-68-68.dsl.dyn.ihug.co.nz)
01:26:51 barak joins (~barak@2a0d:6fc2:68c1:7200:e61a:851b:d7b:27e8)
01:34:03 × bolivood quits (~bolivood@2a0d:6fc2:5d10:8200:a104:ac74:dd16:a7df) (Ping timeout: 256 seconds)
01:38:02 × ezzieyguywuf quits (~Unknown@user/ezzieyguywuf) (Quit: Lost terminal)
01:39:35 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
01:40:13 × libertyprime quits (~libertypr@118-92-68-68.dsl.dyn.ihug.co.nz) (Quit: leaving)
01:41:25 ezzieyguywuf joins (~Unknown@user/ezzieyguywuf)
01:47:16 bilegeek joins (~bilegeek@2600:1008:b010:1cfe:3776:17b8:1dc2:3fdf)
01:52:56 × barak quits (~barak@2a0d:6fc2:68c1:7200:e61a:851b:d7b:27e8) (Ping timeout: 268 seconds)
01:53:14 × ystael quits (~ystael@user/ystael) (Ping timeout: 256 seconds)
02:00:11 × Axman6 quits (~Axman6@user/axman6) (Server closed connection)
02:05:00 xff0x joins (~xff0x@125x103x176x34.ap125.ftth.ucom.ne.jp)
02:12:35 × td_ quits (~td@i53870936.versanet.de) (Ping timeout: 256 seconds)
02:12:42 discuss9128 joins (~discuss91@137.132.213.131)
02:14:01 td_ joins (~td@i53870936.versanet.de)
02:25:21 gorignak joins (~gorignak@user/gorignak)
02:33:36 bolivood joins (~bolivood@2a0d:6fc2:5d10:8200:7d90:75c4:66ca:204a)
02:39:59 × yin_ quits (~yin@user/zero) (Ping timeout: 252 seconds)
02:43:13 × terrorjack quits (~terrorjac@2a01:4f8:c17:87f8::) (Quit: The Lounge - https://thelounge.chat)
02:46:06 terrorjack joins (~terrorjac@2a01:4f8:c17:87f8::)
02:51:41 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 240 seconds)
03:06:59 × L29Ah quits (~L29Ah@wikipedia/L29Ah) (Ping timeout: 272 seconds)
03:14:11 raehik joins (~raehik@rdng-25-b2-v4wan-169990-cust1344.vm39.cable.virginm.net)
03:30:37 × discuss9128 quits (~discuss91@137.132.213.131) (Quit: Client closed)
03:32:48 ystael joins (~ystael@user/ystael)
03:37:30 × ystael quits (~ystael@user/ystael) (Ping timeout: 256 seconds)
03:45:21 Axman6 joins (~Axman6@user/axman6)
03:50:24 × EvanR quits (~EvanR@user/evanr) (Ping timeout: 255 seconds)
03:53:41 aforemny_ joins (~aforemny@2001:9e8:6cd4:e700:d233:e5e6:582d:855)
03:54:30 × aforemny quits (~aforemny@2001:9e8:6ced:bf00:55ed:d004:4aaa:1f0a) (Ping timeout: 256 seconds)
04:07:40 × bolivood quits (~bolivood@2a0d:6fc2:5d10:8200:7d90:75c4:66ca:204a) (Ping timeout: 268 seconds)
04:09:38 × raehik quits (~raehik@rdng-25-b2-v4wan-169990-cust1344.vm39.cable.virginm.net) (Ping timeout: 252 seconds)
04:15:30 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
04:16:20 Square joins (~Square@user/square)
04:20:06 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 255 seconds)
04:23:39 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
04:24:19 bolivood joins (~bolivood@2a0d:6fc2:5d10:8200:913:214a:315:2891)
04:32:57 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 268 seconds)
04:35:57 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
04:42:49 causal joins (~eric@50.35.88.207)
04:42:49 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 268 seconds)
04:48:44 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
04:51:13 takuan joins (~takuan@178-116-218-225.access.telenet.be)
04:56:43 × gorignak quits (~gorignak@user/gorignak) (Quit: quit)
05:00:08 × bolivood quits (~bolivood@2a0d:6fc2:5d10:8200:913:214a:315:2891) (Ping timeout: 260 seconds)
05:02:39 × philopsos quits (~caecilius@pool-71-183-97-38.nycmny.fios.verizon.net) (Remote host closed the connection)
05:03:16 philopsos joins (~caecilius@user/philopsos)
05:12:01 jjnkn joins (~jjnkn@46.150.73.222.kyiv.volia.net)
05:12:05 × philopsos quits (~caecilius@user/philopsos) (Ping timeout: 256 seconds)
05:19:31 × ChaiTRex quits (~ChaiTRex@user/chaitrex) (Remote host closed the connection)
05:19:35 philopsos1 joins (~caecilius@user/philopsos)
05:20:18 ChaiTRex joins (~ChaiTRex@user/chaitrex)
05:20:43 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 256 seconds)
05:28:47 jinsun joins (~jinsun@user/jinsun)
05:30:04 × Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer)
05:40:44 × euleritian quits (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Ping timeout: 260 seconds)
05:41:49 euleritian joins (~euleritia@dynamic-176-006-196-153.176.6.pool.telefonica.de)
06:00:42 sroso joins (~sroso@user/SrOso)
06:03:31 acidjnk joins (~acidjnk@p200300d6e714dc32b43b4fa4bda78a3a.dip0.t-ipconnect.de)
06:11:25 bolivood joins (~bolivood@2a0d:6fc2:5d10:8200:a189:af79:61c5:4ba2)
06:16:23 × superbil quits (~superbil@1-34-176-171.hinet-ip.hinet.net) (Quit: WeeChat 4.2.2)
06:19:14 internatetional joins (~nate@2001:448a:20a3:c2e5:9ba2:a48e:b934:7d97)
06:30:09 × jcarpenter2 quits (~lol@2603:3016:1e01:b940:9e16:4716:cb0d:9d39) (Read error: Connection reset by peer)
06:32:26 × califax quits (~califax@user/califx) (Remote host closed the connection)
06:36:28 × internatetional quits (~nate@2001:448a:20a3:c2e5:9ba2:a48e:b934:7d97) (Quit: WeeChat 4.2.2)
06:36:41 internatetional joins (~nate@2001:448a:20a3:c2e5:9ba2:a48e:b934:7d97)
06:44:39 fendor joins (~fendor@2a02:8388:1605:ce00:24e2:c141:1f86:a346)
06:44:51 lortabac joins (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4)
06:47:48 × m1dnight quits (~christoph@82.146.125.185) (Quit: WeeChat 4.2.2)
06:48:13 califax joins (~califax@user/califx)
06:48:29 m1dnight joins (~christoph@82.146.125.185)
06:49:24 × califax quits (~califax@user/califx) (Read error: Connection reset by peer)
06:50:36 kuribas joins (~user@2a02:1808:2:a50c:ee7a:245e:1a98:7ade)
06:51:28 califax joins (~califax@user/califx)
06:55:51 Square2 joins (~Square4@user/square)
06:58:09 × ft quits (~ft@p508db8fc.dip0.t-ipconnect.de) (Quit: leaving)
06:58:10 × Square quits (~Square@user/square) (Ping timeout: 246 seconds)
07:00:11 <tomsmeding> the memory model thing with IORefs indeed refers to the methods outside of the atomic* family
07:00:33 <tomsmeding> atomicModifyIORef is a great building block for concurrent programs, but sometimes you need more
07:00:37 kuribas` joins (~user@2a02:1808:8:dd22:98a8:ccd5:a4c3:db95)
07:01:27 <tomsmeding> in concurrency terminology, atomicModifyIORef is non-blocking, which means a certain progress guarantee for your program (as long as you don't go implementing a lock yourself using atomicModifyIORef, which is possible)
07:02:07 × kuribas quits (~user@2a02:1808:2:a50c:ee7a:245e:1a98:7ade) (Ping timeout: 255 seconds)
07:02:13 <tomsmeding> many concurrent algorithms can be written in a non-blocking way (there's even a theorem that "all" can, in some sense, iirc), but that's not always the most efficient or most understandable way
07:02:41 sord937 joins (~sord937@gateway/tor-sasl/sord937)
07:03:05 <tomsmeding> having transactions sometimes relieves you of a whole lot of trouble in designing your data structures and methods
07:06:00 × euleritian quits (~euleritia@dynamic-176-006-196-153.176.6.pool.telefonica.de) (Read error: Connection reset by peer)
07:06:18 euleritian joins (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de)
07:08:08 <Axman6> yeah definitely, and can also lead to less contention on shared values - the difference between n IORef (Map Key Value) and Map Key (IORef value) (or even IORef (Map Key (IORef Value)) might make significant performance differences.
07:08:57 × kuribas` quits (~user@2a02:1808:8:dd22:98a8:ccd5:a4c3:db95) (Ping timeout: 256 seconds)
07:09:40 <c_wraith> that last one is dangerous
07:10:14 <c_wraith> It's begging to introduce race conditions
07:11:56 × emmanuelux quits (~emmanuelu@user/emmanuelux) (Quit: au revoir)
07:13:09 <Axman6> it can be used safely, you just wrap things in a safe interface
07:15:20 <Axman6> getRefForKey outer key = do exists <- Map.lookup key <$> readIORef ref; case exists of Nothing -> do newRef <- newIORef; atomicModifyIORef ref (\old -> case Map.lookup key old of Nothing -> (Map.insert key newRef, newRef); Just race -> (old, race))
07:15:37 <c_wraith> I'm not even sure it can be used safely. If you look at the Map and determine you need to insert a new key/value pair, you can't do that from within an atomicModifyIORef
07:16:28 <Axman6> (missing `old` in the Map.insert but that should work)
07:16:46 <Axman6> oh and the Just case for the first case uses the value returned
07:17:14 <Axman6> this also assumes you never delete keys (use Maybe (IORef Value)) then)
07:17:43 <c_wraith> It also assumes you never have two threads trying to insert the same key at the same time.
07:17:53 <tomsmeding> c_wraith: I think Axman6 meant `IORef (Map Key (IORef Value))`
07:18:03 <tomsmeding> judging from the getRefForKey code
07:18:08 <Axman6> yes
07:18:10 <c_wraith> so do I
07:18:30 <tomsmeding> oh hm fair
07:18:42 <tomsmeding> time-of-check to time-of-use race condition
07:19:21 <Axman6> the code above should handle that fine, since it uses atomicModifyIORef in the update case, only one of the can put their key in
07:19:46 <tomsmeding> interesting
07:19:49 <Axman6> of the threads*
07:20:00 <Axman6> but in the case where the key exists no synchronisation is needed
07:20:20 <tomsmeding> neat
07:20:27 <tomsmeding> gets you a limited interface though, to the map
07:20:31 <tomsmeding> but if that's enough, it's nice
07:20:44 <tomsmeding> also needs a read-heavy workload
07:21:05 <Axman6> yeah - which my one use case for this particular design was =)
07:21:39 sawilagar joins (~sawilagar@user/sawilagar)
07:21:41 <Axman6> actually that's not true, since things were only read when a uses used the webservice, which no one ever did =)
07:22:17 <tomsmeding> :D
07:22:25 <tomsmeding> write-light, then
07:23:57 frumon joins (~Frumon@user/Frumon)
07:27:07 <c_wraith> Ok, it works on the assumption that the value you want to insert doesn't depend on whether there was already a key there or not (or depends trivially, with some sort of commutative operation)
07:27:45 _bo joins (~bo@198.red-83-56-252.dynamicip.rima-tde.net)
07:28:09 <tomsmeding> I that would be a requirement from the interface of getRefForKey anyway, regardless of the implementation
07:28:37 <c_wraith> You're adding extra semantics. I'm looking at the type. :P
07:29:12 <tomsmeding> I'm looking at an idealised implementation in terms of `MVar (Map Key Value)`
07:29:28 kuribas` joins (~user@ip-188-118-57-242.reverse.destiny.be)
07:29:30 <tomsmeding> and observing that this cleverer implementation does not have stronger preconditions than the MVar-based one
07:30:31 <c_wraith> in practice, an MVar-based implementation will perform way better with heavy writes.
07:30:38 <tomsmeding> of course
07:30:46 <tomsmeding> hence the "write-light" observed above
07:30:55 × bo_ quits (~bo@198.red-83-56-252.dynamicip.rima-tde.net) (Ping timeout: 256 seconds)
07:32:35 <c_wraith> and a TVar-based approach lets you write much more obviously-correct code that works under the write-light conditions.
07:33:02 <tomsmeding> with slightly more overhead
07:33:31 <tomsmeding> but true
07:36:41 × bilegeek quits (~bilegeek@2600:1008:b010:1cfe:3776:17b8:1dc2:3fdf) (Quit: Leaving)
07:42:21 oo_miguel joins (~Thunderbi@78-11-181-16.static.ip.netia.com.pl)
07:44:11 cfricke joins (~cfricke@user/cfricke)
07:46:51 <kuribas`> perhaps offtopic, but I looked at twelf, and I am surprised you need to reinvent equality (refl, cong, ...) for each datatype.
07:49:30 <kuribas`> https://twelf.org/wiki/equality/
07:56:54 machinedgod joins (~machinedg@d173-183-246-216.abhsia.telus.net)
08:02:03 × tzh quits (~tzh@c-76-115-131-146.hsd1.or.comcast.net) (Quit: zzz)
08:02:54 titibandit joins (~user@user/titibandit)
08:03:14 danza joins (~francesco@an-19-164-164.service.infuturo.it)
08:15:27 × danza quits (~francesco@an-19-164-164.service.infuturo.it) (Remote host closed the connection)
08:16:46 <ski> kuribas` : aiui, no parametric polymorphism, types only depend on values, not types; iirc, in original implementation, they had that, but they didn't include it in the reworked implementation (yet at least), because the theory for it was unclear
08:17:40 <kuribas`> ski: so types are not values then?
08:18:19 <ski> there are three levels, values, types, and kinds
08:19:01 <ski> (in LF, the Logical Framework system, that Elf is based on, and of which Twelf is an implementation of)
08:19:22 <kuribas`> Twelf is dependently typed Elf?
08:19:35 <ski> no, LF is dependently typed to begin with
08:19:44 <ski> bu there's no infinite tower of sorts
08:20:15 <ski> it's a fairly conservative/restrictive theory
08:20:24 <kuribas`> right, no type 1, type 2, ... as in idris2
08:20:54 <ski> yep
08:22:36 <ski> aiui, this is because (a) they purposely want a rather weak theory, to not assume too much, when representing object systems (logics, type systems, operational semantics, &c.); but also (b) in order to keep unification and type checking decidable
08:24:19 <ski> (they have unification of lambda terms, up to alpha-, beta-, and eta- conversion. but lambda terms are rather weak, can't compute on sum types, and no recursion. you do computation not with functions, but with predicates/relations, iow logic programming, searching for proofs/values of propositions/types)
08:25:53 <ski> (i may be missing some detail, or getting some details wrong, but that's my impression, from reading some papers about it, semi-recently .. still need to play around more in the implementation, though)
08:32:39 danse-nr3 joins (~danse-nr3@an-19-164-164.service.infuturo.it)
08:37:04 frumon parts (~Frumon@user/Frumon) (Leaving)
08:40:45 × _bo quits (~bo@198.red-83-56-252.dynamicip.rima-tde.net) (Quit: Leaving)
08:41:05 L29Ah joins (~L29Ah@wikipedia/L29Ah)
08:42:28 × philopsos1 quits (~caecilius@user/philopsos) (Ping timeout: 255 seconds)
08:45:06 chele joins (~chele@user/chele)
08:48:19 ubert joins (~Thunderbi@2a02:8109:ab8a:5a00:d028:ce6d:23c1:c5bb)
08:48:21 <int-e> You have to restrict beta for this to be decidable (unification can guess arguments of unbounded size so termination doesn't save you). https://www.cs.cmu.edu/~twelf/guide-1-4/twelf_5.html#SEC27 mentions higher-order pattern unification which IIRC doesn't have beta, and also doesn't guess the head of applications. The type checking/inference might have something a bit more fancy though.
08:51:23 <ski> yes, the unification is restricted
08:52:10 <ski> it has beta_0
08:53:52 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
08:54:09 <ski> (the rules for how it's restricted are somewhat complicated. i read the L-lambda unification paper, and also the details of which unifications are allowed in Twelf, but i don't recall the details of either that well)
08:54:54 ski idly wonders whether something like L-lambda / higher-order pattern unification, could sensibly be added to GHC
08:54:55 <int-e> Now what do I google to figure out what beta_0 is :)
08:55:10 libertyprime joins (~libertypr@118-92-68-68.dsl.dyn.ihug.co.nz)
08:55:21 <ski> basically `(\x. M) y', substituting `x' with another variable `y'
08:55:54 <ski> (well, more specifically, either with a bound variable, or with a constant. but not with a logic / meta- variable, nor with an arbitrary term)
08:56:06 <int-e> Ah, yeah supporting that makes sense to me.
08:56:44 <ski> (i think in some papers, they also allow substituting like numeric literal, (unapplied) data constructors)
08:57:47 <int-e> And I think it's a detail of the pattern unification that I forgot. Yeah I do remember support for constructors too.
08:58:45 ski read it like last month or so
08:59:40 <ski> the "unification under a mixed prefix" paper by Dale Miller is also relevant
09:00:09 <ski> .. as well as the tutorial interpreter paper for lambdaProlog (which implements that idea, amongst various other stuff)
09:02:22 <ski> (they implement in SML, using a one-level continuation-passing style. success means calling continuation deeper. failure means returning. initial continuation will print out answer substitution, and query if user wants to search for more solutions. they implement cut by throwing exception)
09:07:53 gmg joins (~user@user/gehmehgeh)
09:17:51 × bolivood quits (~bolivood@2a0d:6fc2:5d10:8200:a189:af79:61c5:4ba2) (Ping timeout: 268 seconds)
09:20:41 <kuribas`> ski: it looks like lists are parametric? https://twelf.org/wiki/lists/
09:21:37 __monty__ joins (~toonn@user/toonn)
09:21:59 × destituion quits (~destituio@2a02:2121:10b:62ca:bae7:e090:21e:1459) (Ping timeout: 256 seconds)
09:22:50 destituion joins (~destituio@85.221.111.174)
09:24:47 <ski> "Unification Under a Mixed Prefix" by Dale Miller in 1992-07-08 at <https://www.lix.polytechnique.fr/~dale/papers/jsc92.pdf>
09:24:50 <ski> "A Semi-Functional Implementation of a Higher-Order Logic Programming Language" by Conal Elliott,Frank Pfenning in 1990-02 (draft) at <http://www.cs.cmu.edu/~fp/papers/elpsml90.pdf>,<http://www.cs.cmu.edu/~fp/papers/elpsml-paper.tar.gz>
09:25:30 <ski> kuribas` : sure, it's parametric in the sense of ML functors (parameterized modules), you can assume anything you like about the element type `elem'. but `list' has type `type', not `type -> type'
09:26:22 <ski> (so `list' itself is not a parameterized type, and relations/predicates operating over it won't be parametrically polymorphic in the element type)
09:26:57 <kuribas`> ski: If if I need 5 different types of lists, I need to load the module 5 times?
09:30:50 <ski> (btw .. an LF program is basically a signature, a list of type signatures of constants (value constants and type constants) .. you can interpret this as something quite close to an ML module signature, and then you can introduce ML module functors into the picture, implementing the constants of one signature in terms of those of another. this is e.g. useful when you specify a type system using "declarative"
09:30:56 <ski> inference rules (comprising one signature), and then also specify an alternative set of "algorithmic" inference rules (avoiding ambiguity, and allowing the type signatures to be effectively be interpreted as a logic program, something the declarative version often doesn't usefully, or at least efficiently, admit) .. and then the functor tells you how to transform a derivation in the algorithmic system (which
09:31:02 <ski> proof search automatically can find for your), into a derivation in the declarative system)
09:32:15 <ski> kuribas` : or load five (copy-pasted) versions of it. or perhaps it could be possible to parameterize the whole file on `elem', but aiui, Twelf doesn't currently implement anything like that
09:33:51 barak joins (~barak@2a0d:6fc2:68c1:7200:e61a:851b:d7b:27e8)
09:34:26 × cfricke quits (~cfricke@user/cfricke) (Remote host closed the connection)
09:34:45 cfricke joins (~cfricke@user/cfricke)
09:35:22 <ski> (i guess one should clearly distinguish here between wanting to parameterize an LF program (being a signature), and wanting to parameterize a realization of that signature (which would give a functor). what i meant to say at the end above is that i've seen papers for (and source code implementing) the latter, but not the former)
09:37:44 × chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection)
09:37:44 × ec quits (~ec@gateway/tor-sasl/ec) (Remote host closed the connection)
09:38:23 chexum joins (~quassel@gateway/tor-sasl/chexum)
09:38:38 ec joins (~ec@gateway/tor-sasl/ec)
09:42:40 bolivood joins (~bolivood@2a0d:6fc2:5d10:8200:e4f7:dd84:71b6:db6)
09:46:26 × cfricke quits (~cfricke@user/cfricke) (Quit: WeeChat 4.2.2)
09:49:41 cfricke joins (~cfricke@user/cfricke)
09:52:10 × bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Ping timeout: 260 seconds)
09:53:45 bitdex joins (~bitdex@gateway/tor-sasl/bitdex)
09:56:18 × pie_ quits (~pie_bnc@user/pie/x-2818909) ()
09:56:36 pie_ joins (~pie_bnc@user/pie/x-2818909)
09:58:52 × libertyprime quits (~libertypr@118-92-68-68.dsl.dyn.ihug.co.nz) (Remote host closed the connection)
10:01:38 × danse-nr3 quits (~danse-nr3@an-19-164-164.service.infuturo.it) (Ping timeout: 268 seconds)
10:02:08 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Quit: WeeChat 4.2.1)
10:08:51 × xff0x quits (~xff0x@125x103x176x34.ap125.ftth.ucom.ne.jp) (Ping timeout: 255 seconds)
10:13:28 todi joins (~todi@p57803331.dip0.t-ipconnect.de)
10:20:48 × chexum quits (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection)
10:21:37 × patrl quits (~patrl@user/patrl) (Remote host closed the connection)
10:23:19 chexum joins (~quassel@gateway/tor-sasl/chexum)
10:24:05 patrl joins (~patrl@user/patrl)
10:26:29 × patrl quits (~patrl@user/patrl) (Remote host closed the connection)
10:28:55 × Square2 quits (~Square4@user/square) (Ping timeout: 260 seconds)
10:33:26 famubu joins (~julinuser@user/famubu)
10:37:33 <famubu> Hi. I had been trying to make a megaparsec parser to parse regular expression. I got atoms and concatenation working. Now I'm trying to get repetition like `r{2,4}` but couldn't finish it.
10:38:01 <famubu> This is what I have: https://bpa.st/5O4Q
10:38:31 <famubu> I wasn't sure how to add `rep` to the operator table (`optab`)
10:41:15 <famubu> Saw this (parsec): https://stackoverflow.com/questions/9020254/using-parsec-to-parse-regular-expressions
10:41:39 <famubu> where they mention it for `+`, and `*`. But still couldn't figure how to make it more general.
10:44:01 yin joins (~yin@user/zero)
10:49:06 × ubert quits (~Thunderbi@2a02:8109:ab8a:5a00:d028:ce6d:23c1:c5bb) (Remote host closed the connection)
10:49:14 <tomsmeding> famubu: `Postfix rep` doesn't work?
10:49:42 <tomsmeding> note the type of Postfix here https://hackage.haskell.org/package/parser-combinators-1.3.0/docs/Control-Monad-Combinators-Expr.html#t:Operator
10:50:46 <tomsmeding> I wonder if your :- parsing is working though; should it not parse a '-'?
10:53:57 neiluj joins (~neiluj@193.203.71.162)
10:55:45 <famubu> Symbols are single characters. So ABC should become like `A :- B :- C`. So no need to explicitly parse a hyphen. Is that what you meant?
10:56:02 <tomsmeding> ah I see
10:56:04 <tomsmeding> sure
10:56:09 <famubu> Postfix rep didn't work. Because of the extra `Integer -> Integer`.
10:56:20 <tomsmeding> (I wasn't reading carefully and assumed (:-) was for e.g. `[a-z]`
10:56:22 <tomsmeding> )
10:56:33 <famubu> Yeah.
10:56:52 <famubu> Rep constructor is like `Re a -> Integer -> Integer`
10:56:54 × rvalue quits (~rvalue@user/rvalue) (Read error: Connection reset by peer)
10:57:23 <famubu> This was the error: https://bpa.st/U6MQ
10:57:32 rvalue joins (~rvalue@user/rvalue)
10:57:40 <tomsmeding> famubu: Postfix (Rep <$ rep) is not the same as Postfix rep
10:57:43 <tomsmeding> I meant the latter
10:57:54 <tomsmeding> <$ is for if you don't care about the result of 'rep' and want it to be Rep anyway
10:57:58 <neiluj> hey! ocaml guy here! I'd like to deepen my knowledge by playing with haskell advanced features such as liquid haskell, category theory stuff. Which projects/reading material would you recommend to achieve this goal?
10:58:00 <tomsmeding> but Rep is not fully applied so that fails
10:58:03 <tomsmeding> :t (<$)
10:58:04 <lambdabot> Functor f => a -> f b -> f a
10:58:23 <tomsmeding> famubu: `rep` returns useful info here so you shouldn't use (<$)
10:59:37 <famubu> Oh.. sorry. That worked. I'm not yet that good at extracting the correct info from the types.. 😬
10:59:41 <famubu> Thanks.
11:00:01 <tomsmeding> famubu: every time you figure something like this out, you gain a little more intuition for what the types meant :)
11:00:08 <famubu> :)
11:00:14 <famubu> Yeah
11:02:20 × Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 256 seconds)
11:02:50 Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915)
11:07:27 xff0x joins (~xff0x@2405:6580:b080:900:25be:f228:ec64:b69c)
11:12:25 ubert joins (~Thunderbi@2a02:8109:ab8a:5a00:c695:1779:f1ed:a0d3)
11:18:09 × sroso quits (~sroso@user/SrOso) (Quit: Leaving :))
11:21:56 patrl joins (~patrl@user/patrl)
11:26:21 × patrl quits (~patrl@user/patrl) (Remote host closed the connection)
11:28:44 patrl joins (~patrl@user/patrl)
11:32:53 × koz quits (~koz@121.99.240.58) (Ping timeout: 256 seconds)
11:33:27 × Maxdamantus quits (~Maxdamant@user/maxdamantus) (Ping timeout: 256 seconds)
11:34:09 × cfricke quits (~cfricke@user/cfricke) (Quit: WeeChat 4.2.2)
11:34:35 koz joins (~koz@121.99.240.58)
11:35:46 bolivood1 joins (~bolivood@2a0d:6fc2:5d10:8200:11e8:e299:e23d:e488)
11:37:37 Maxdamantus joins (~Maxdamant@user/maxdamantus)
11:37:59 × bolivood quits (~bolivood@2a0d:6fc2:5d10:8200:e4f7:dd84:71b6:db6) (Ping timeout: 256 seconds)
11:39:43 danse-nr3 joins (~danse-nr3@an-19-164-164.service.infuturo.it)
11:41:02 × L29Ah quits (~L29Ah@wikipedia/L29Ah) (Read error: Connection reset by peer)
11:44:38 L29Ah joins (~L29Ah@wikipedia/L29Ah)
11:47:31 × xdminsy quits (~xdminsy@117.147.70.240) (Quit: Konversation terminated!)
11:47:54 xdminsy joins (~xdminsy@117.147.70.240)
11:57:11 lortabac joins (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4)
12:04:03 × neiluj quits (~neiluj@193.203.71.162) (Ping timeout: 255 seconds)
12:05:29 neiluj joins (~neiluj@193.203.71.162)
12:05:59 × danse-nr3 quits (~danse-nr3@an-19-164-164.service.infuturo.it) (Read error: Connection reset by peer)
12:06:15 danse-nr3 joins (~danse-nr3@151.43.160.43)
12:19:47 × ezzieyguywuf quits (~Unknown@user/ezzieyguywuf) (Ping timeout: 264 seconds)
12:20:23 ezzieyguywuf joins (~Unknown@user/ezzieyguywuf)
12:30:52 × danse-nr3 quits (~danse-nr3@151.43.160.43) (Read error: Connection reset by peer)
12:31:07 cfricke joins (~cfricke@user/cfricke)
12:31:09 danse-nr3 joins (~danse-nr3@151.43.160.43)
12:36:38 Square2 joins (~Square4@user/square)
12:39:14 × destituion quits (~destituio@85.221.111.174) (Ping timeout: 256 seconds)
12:41:58 × bolivood1 quits (~bolivood@2a0d:6fc2:5d10:8200:11e8:e299:e23d:e488) (Ping timeout: 268 seconds)
12:42:27 destituion joins (~destituio@2a02:2121:10b:62ca:10a5:f759:7fb5:9fb1)
12:46:05 × bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Quit: = "")
12:47:13 × __monty__ quits (~toonn@user/toonn) (Ping timeout: 268 seconds)
12:55:11 × neiluj quits (~neiluj@193.203.71.162) (Ping timeout: 264 seconds)
13:06:47 neiluj joins (~neiluj@193.203.71.162)
13:11:23 × neiluj quits (~neiluj@193.203.71.162) (Ping timeout: 252 seconds)
13:17:14 neiluj joins (~neiluj@193.203.71.162)
13:19:12 bolivood1 joins (~bolivood@2a0d:6fc2:5d10:8200:95cf:c099:dbf9:bb2d)
13:19:45 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
13:34:36 ystael joins (~ystael@user/ystael)
13:41:57 yin is now known as zzz
13:42:22 __monty__ joins (~toonn@user/toonn)
13:51:43 × random-jellyfish quits (~developer@user/random-jellyfish) (Ping timeout: 256 seconds)
13:56:22 Sgeo joins (~Sgeo@user/sgeo)
13:59:45 neiluj_ joins (~neiluj@193.203.71.162)
14:00:47 <Athas> tomsmeding: does Accelerate work with CUDA 12?
14:02:08 tromp joins (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl)
14:02:32 × neiluj quits (~neiluj@193.203.71.162) (Ping timeout: 252 seconds)
14:05:27 × neiluj_ quits (~neiluj@193.203.71.162) (Ping timeout: 256 seconds)
14:05:50 × bolivood1 quits (~bolivood@2a0d:6fc2:5d10:8200:95cf:c099:dbf9:bb2d) (Ping timeout: 268 seconds)
14:06:17 × euleritian quits (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Ping timeout: 272 seconds)
14:10:51 <tomsmeding> Athas: no, <=11
14:11:17 <tomsmeding> Indirectly blocked on https://github.com/visq/language-c/pull/94
14:11:25 <Athas> That'll be an issue.
14:11:49 <tomsmeding> I think with sufficient hackery you can take that PR and build with that
14:12:13 <tomsmeding> The problem is that language-c is a dep of c2hs which is a *build-dependency* of cuda, which is a dep of accelerate
14:12:32 <tomsmeding> And a simple source-repository-package in cabal.project doesn't override build deps
14:12:43 <Athas> I hope the Accelerate/CFAL team will do that, because otherwise it will not run on the benchmarking machine.
14:12:59 <tomsmeding> I think I managed to override it at some point with sufficient vendoring
14:13:00 <tomsmeding> Ah
14:13:13 <tomsmeding> We'll have a look, but might take a few days
14:17:35 EvanR joins (~EvanR@user/evanr)
14:23:44 × billchenchina- quits (~billchenc@103.152.35.21) (Remote host closed the connection)
14:24:12 billchenchina joins (~billchenc@2a0d:2580:ff0c:1:e3c9:c52b:a429:5bfe)
14:24:54 × billchenchina quits (~billchenc@2a0d:2580:ff0c:1:e3c9:c52b:a429:5bfe) (Max SendQ exceeded)
14:25:18 billchenchina joins (~billchenc@103.152.35.21)
14:26:49 × califax quits (~califax@user/califx) (Remote host closed the connection)
14:29:55 neiluj joins (~neiluj@193.203.71.162)
14:31:08 califax joins (~califax@user/califx)
14:35:06 raehik joins (~raehik@rdng-25-b2-v4wan-169990-cust1344.vm39.cable.virginm.net)
14:38:14 × billchenchina quits (~billchenc@103.152.35.21) (Remote host closed the connection)
14:38:47 × tromp quits (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Read error: Connection reset by peer)
14:38:56 billchenchina joins (~billchenc@103.152.35.21)
14:41:00 waleee joins (~waleee@h-176-10-144-38.NA.cust.bahnhof.se)
14:43:45 × califax quits (~califax@user/califx) (Remote host closed the connection)
14:47:18 × Square2 quits (~Square4@user/square) (Ping timeout: 256 seconds)
14:48:17 califax joins (~califax@user/califx)
14:49:51 × califax quits (~califax@user/califx) (Remote host closed the connection)
14:51:27 random-jellyfish joins (~developer@2a02:2f04:11e:c600:4e7a:622:23f0:da46)
14:51:27 × random-jellyfish quits (~developer@2a02:2f04:11e:c600:4e7a:622:23f0:da46) (Changing host)
14:51:27 random-jellyfish joins (~developer@user/random-jellyfish)
14:51:52 califax joins (~califax@user/califx)
14:56:41 Square2 joins (~Square4@user/square)
15:02:33 × neiluj quits (~neiluj@193.203.71.162) (Ping timeout: 256 seconds)
15:03:23 ocra8 joins (ocra8@user/ocra8)
15:04:30 Guest13 joins (~Guest13@cpc93370-hers8-2-0-cust590.6-3.cable.virginm.net)
15:05:25 × zzz quits (~yin@user/zero) (Ping timeout: 255 seconds)
15:08:23 × califax quits (~califax@user/califx) (Remote host closed the connection)
15:10:16 califax joins (~califax@user/califx)
15:14:18 × chele quits (~chele@user/chele) (Remote host closed the connection)
15:15:01 × califax quits (~califax@user/califx) (Remote host closed the connection)
15:18:28 × Square2 quits (~Square4@user/square) (Ping timeout: 260 seconds)
15:18:33 neiluj joins (~neiluj@193.203.71.162)
15:18:48 califax joins (~califax@user/califx)
15:21:36 × waleee quits (~waleee@h-176-10-144-38.NA.cust.bahnhof.se) (Ping timeout: 255 seconds)
15:23:23 <Guest13> hi, how can I memoize recursive calls that aren't simple like the fibonacci. I see on the wiki for memoization there is an example memo_fib= (map fib [1..] !!), but the problem I am trying to solve has the recursive calls in an order I don't necessarily know
15:24:21 <Guest13> it is the sort of problem where I would want to have a map to store previous calls
15:28:48 <ski> so use a map ?
15:29:08 <ski> .. or how large is your domain ?
15:30:46 <ski> (oh, and jfyi, that `memo_fib' still uses `fib' (but not `memo_fib') for each individual call, so not reusing the list resulting from the `map' as a cache)
15:32:32 <ski> anyway, if you already know from the start (perhaps from the initial parameters) how large domain you need for the recursive calls corresponding to subproblems of that initial problem, you can allocate a map (recursively defined) that has an association mapping each element of your domain to the corresponding result value (lazily computed)
15:33:37 <ski> .. but if your domain is large, the map would also be large. sometimes you can allocate the association structure itself, lazily, incrementally (like the infinite linked list above)
15:36:42 zzz joins (~yin@user/zero)
15:37:26 <Guest13> I understand to use a map but I don't know how I would implement it
15:38:01 <Guest13> I can't think about it functionally very well, I am thinking that each time it does a call it updates an internal "state"
15:38:24 <Guest13> ie adds to the map, or checks the map
15:38:50 <Guest13> I've seen the rec keyword but this is also something I am unsure about
15:40:41 <ski> there is no state, adding to the map, unless you express this with state in some fashion .. and it's probably better to avoid that, if you can
15:41:02 <ski> `rec' is for something else (recursive bindings in `do')
15:42:21 <ski> @let tabulate :: Ix i => (i,i) -> (i -> e) -> Array i e; tabulate ix f = listArray ix [f i | i <- range ix]
15:42:22 <lambdabot> Defined.
15:43:49 <ski> > L.tabulate (-2,3) (\i -> i^2) -- construct an array, with each element based on its index
15:43:51 <lambdabot> array (-2,3) [(-2,4),(-1,1),(0,0),(1,1),(2,4),(3,9)]
15:46:32 <ski> > let memoFib n | n >= 0 = fibs ! n where fibs = L.tabulate (0,n) fib; fib 0 = 0; fib 1 = 1; fib n = fibs ! (n - 1) + fibs ! (n - 2) in memoFib 12
15:46:33 <lambdabot> 144
15:48:01 <Guest13> the problem I have is that each recursive call is defined by [Int], Int, [Int]
15:48:12 <ski> Guest13 : can you follow that ^ example ? given a (non-negative) integer `n', it builds an array (`fibs') with `n+1' elements (indexed from `0' to `1'), with elements set by the fibonacci function (`fib') where recursive calls look up results in the array, and so will be cached (the array elements are lazily computed)
15:48:44 <ski> the array `fibs' and the function `fib' are mutually recursively defined. you can inline one into the other as
15:49:28 <ski> > let memoFib n | n >= 0 = fibs ! n where fibs = L.tabulate (0,n) (\n -> case n of 0 -> 0; 1 -> 1; n -> fibs ! (n - 1) + fibs ! (n - 2)) in memoFib 12 -- array `fibs' is (lazily) recursively defined in terms of itself
15:49:30 <lambdabot> 144
15:49:36 <Guest13> im not sure I can, the state I have is 2 arrays which im comparing to each other and an integer to denote a counter and a string
15:50:00 <Guest13> if it helps, I can explain the problem
15:50:34 <ski> are `[Int]',`Int',`[Int]' your parameter types ?
15:50:57 <ski> are you sure you have two arrays, and not two lists ?
15:51:25 <ski> when you call recursively, which parameters (may) change ?
15:51:48 <ski> explaining it may help, possibly
15:51:53 × danse-nr3 quits (~danse-nr3@151.43.160.43) (Remote host closed the connection)
15:52:17 danse-nr3 joins (~danse-nr3@151.43.160.43)
15:53:19 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Quit: WeeChat 4.2.1)
15:54:59 × Guest13 quits (~Guest13@cpc93370-hers8-2-0-cust590.6-3.cable.virginm.net) (Ping timeout: 250 seconds)
15:56:46 × jrm quits (~jrm@user/jrm) (Quit: ciao)
15:57:22 <EvanR> "use a map" could be ambiguous
15:57:41 <EvanR> the function map, the Data.Map container
15:57:43 <ski> hm, i guess
15:57:58 <EvanR> both could be used for memoizing
15:58:17 jrm joins (~jrm@user/jrm)
15:58:59 <EvanR> at least other functionalish languages are being consistent in this jargon xD
15:59:12 <EvanR> map vs map
16:00:24 <ski> hm ?
16:02:32 <EvanR> it's been a while since I didn't know jargon but I have to wonder if noobs are confused by the collision of map function and map data structure
16:02:46 <EvanR> in not just haskell
16:03:26 <dolio> I can't recall it ever being confusing.
16:04:57 × danse-nr3 quits (~danse-nr3@151.43.160.43) (Read error: Connection reset by peer)
16:04:59 <ski> i wonder about the etymology of the `map' function
16:05:21 <ski> did LISP 1.5 have `MAPCAR' ?
16:05:31 econo_ joins (uid147250@id-147250.tinside.irccloud.com)
16:06:07 <dolio> I think it goes pretty far back in lisp.
16:09:12 <dolio> The lisp 1.6 manual has it.
16:09:43 × ubert quits (~Thunderbi@2a02:8109:ab8a:5a00:c695:1779:f1ed:a0d3) (Remote host closed the connection)
16:10:30 <ski> anyway, for the data structure, surely "(finite) map" is because it's representing a "map" (or "mapping"), being a word that's basically a synonym for "function","transform", the "finite" part referring to that it has a finite domain, or that it's a partial function defined on a finite subset of the domain (sometimes representing a function with "finite support" meaning that it only maps to "nonzero" on a
16:10:37 <ski> finite subset of the domain)
16:11:01 <ski> i guess 1.5 probably does then, too
16:11:28 × kuribas` quits (~user@ip-188-118-57-242.reverse.destiny.be) (Remote host closed the connection)
16:12:07 <ski> if you think of the list as representing a subset, then the `map' function computes the (existential/direct) image of the function on that subset .. not sure why one would call this "map"
16:13:11 <dolio> Lists aren't subsets, though.
16:14:28 <c_wraith> is Int overflow behavior actually specified on overflow?
16:14:40 <ski> > [0,1,0,2,0,1,0,3] \\ [2,1,0]
16:14:42 <lambdabot> [0,0,1,0,3]
16:14:46 <c_wraith> wow, good sentence construction there.
16:14:58 Guest13 joins (~Guest13@cpc93370-hers8-2-0-cust590.6-3.cable.virginm.net)
16:15:15 <Guest13> sorry ski I had to pick my mum up from station
16:15:27 <dolio> Anyhow, 'map' doesn't just mean 'function' it's also the act of associating or carrying an input to an output by a function.
16:15:58 <Guest13> yes, [Int] [Int] int String are the parameters
16:16:11 × machinedgod quits (~machinedg@d173-183-246-216.abhsia.telus.net) (Ping timeout: 264 seconds)
16:16:20 <Guest13> or at least what I had in the recursive call
16:16:30 <dolio> And that's what 'map' does on all elements of some container.
16:16:40 <dolio> Lists in the case of old lisp.
16:16:57 <ski> i guess that's the connection, then
16:17:10 × manwithluck quits (~manwithlu@149.102.244.20) (Read error: Connection reset by peer)
16:17:11 <ski> Guest13 : and which of those are actually changing ?
16:17:19 <Guest13> all of them
16:18:02 <Guest13> I can simplify it to Int Int [Int] String
16:18:06 <ski> are you sure dynamic programming would make sense, for your problem, then ?
16:18:21 <Guest13> yes, but I am probably framing it badly
16:18:29 <ski> .. or are you just looking for caching results of calls, to avoid recomputing later ?
16:18:33 <Guest13> to make it easy I just wanted to cache results of calls
16:18:35 <Guest13> yes
16:19:47 <ski> oh, and when i asked "which of those are actually changing ?", i specifically had *recursive* calls in mind (not initial/top calls from other places)
16:20:07 <Guest13> can you explain what is the difference?
16:20:53 <Guest13> the recursive call changes all of the above, and the top call I believe will start at 0 0 [Int] String
16:21:26 <Guest13> I could frame it as Int Int Int and have [Int] and String as references
16:22:10 <ski> if only some of the parameters changed in recursive calls, then you could, within a single toplevel call, only cache for the changing parameters, thereby simplifying the datastructure needed to cache results
16:22:24 <Guest13> this would be ideal
16:22:35 × cfricke quits (~cfricke@user/cfricke) (Ping timeout: 256 seconds)
16:22:38 <Guest13> I can formulate it as Int Int Int, with constant [Int] and String
16:22:53 <ski> (for each new toplevel call, you'd generate a fresh/new cache, from scratch, whose results would only be reused for recursive calls stemming from that particular toplevel call)
16:24:25 <ski> ok, maybe it would make sense to cache in a three-dimensional array, or (if you only need sparse inputs) maybe use a `Map (Int,Int,Int) Result' or something like that (that'd still require you to know upfront which triples would be needed, which might not be ideal)
16:24:35 × raehik quits (~raehik@rdng-25-b2-v4wan-169990-cust1344.vm39.cable.virginm.net) (Ping timeout: 268 seconds)
16:24:49 <ski> (or `Map Int (Map Int (Map Int Result))', i guess ..)
16:24:55 <Guest13> can be sparse or dense depending on input
16:25:20 <Guest13> I don't know upfront which triples are needed
16:25:27 <ski> if you're okay with a dense caching space, you could try caching with an array
16:26:10 × pavonia quits (~user@user/siracusa) (Quit: Bye!)
16:26:32 <ski> but if your ranges (?) of `Int's are large, the array would contain a lot of elements, take a lot of space (the array itself would be allocated eagerly, only the array elements would be lazily evaluated)
16:27:00 <Guest13> the ranges aren't large
16:27:20 <Guest13> at most like 20
16:27:21 <ski> so, maybe try `Array (Int,Int,Int) Result' ?
16:27:31 <Guest13> ok, how can I use this to cache
16:27:35 tomboy64 joins (~tomboy64@user/tomboy64)
16:27:45 manwithluck joins (~manwithlu@149.102.244.20)
16:27:57 <Guest13> I understand the map f [1..] for fib, and even the tabulate version you showed me but I don't understand this one
16:28:03 <Guest13> im not really doing dp
16:28:06 <ski> you can use `listArray' (or `array'), or the `tabulate' i defined above, to (lazily) populate the array with elements, based on their indices
16:28:54 <ski> oh, you said "yes, but I am probably framing it badly" just after i asked "are you sure dynamic programming would make sense, for your problem, then ?", so i was taking that for granted
16:28:58 <Guest13> so I can do a \(x,y,z) -> f x y-1 z + f x-1 y z
16:29:20 × euphores quits (~SASL_euph@user/euphores) (Quit: Leaving.)
16:29:25 <Guest13> I think I get how to do it
16:30:11 <Guest13> im trying to count the ways of doing something
16:31:37 <ski> (i guess you actually meant `f x (y-1) z + f (x-1) y z', btw)
16:32:10 <Guest13> I will have a go at this
16:32:25 <Guest13> I need to think about how to implement the "dead ends" of the recursive call
16:32:56 <Guest13> its basically a "ways if go left" + "ways if go right" recursion
16:33:11 <Guest13> and you have some calls where you say it has gone wrong and ways = 0
16:34:55 <ski> base cases / dead ends, i guess
16:35:09 <Guest13> this would be setting the value to 0
16:35:20 <mauke> dead ends are where the recursion dies :-)
16:35:38 tzh joins (~tzh@c-76-115-131-146.hsd1.or.comcast.net)
16:35:53 euphores joins (~SASL_euph@user/euphores)
16:35:55 <Guest13> yeah, for some reason it being in a table confused me
16:37:05 <Guest13> I think I get it though, my program will query 0 0 0 in the table which will spawn recursive calls and the base case is n m 0 = 1
16:37:48 <Guest13> I will try this now thank you for the help ski
16:39:44 <Guest13> do I need to define my own 3d tabulate?
16:43:30 <ski> the above should work
16:44:55 × hueso quits (~root@user/hueso) (Read error: Connection reset by peer)
16:45:20 <ski> (there are instances like `(Ix a,Ix b,Ix c) => Ix (a,b,c)')
16:45:44 <ski> > range ((0,0),(1,3))
16:45:45 <lambdabot> [(0,0),(0,1),(0,2),(0,3),(1,0),(1,1),(1,2),(1,3)]
16:45:55 <ski> @type range
16:45:56 <lambdabot> Ix a => (a, a) -> [a]
16:46:05 hueso joins (~root@user/hueso)
16:46:08 <Guest13> I see
16:46:21 <ski> that's all indices in a rectangle, with upper left corner `(0,0)', lower right corner `(1,3)'
16:47:00 <ski> .. and `tabulate' calls `listArray' with a list defined using `range' to generate elements for all valid indices
16:47:08 <ski> @type listArray
16:47:09 <lambdabot> Ix i => (i, i) -> [e] -> Array i e
16:47:15 <ski> @type array
16:47:16 <lambdabot> Ix i => (i, i) -> [(i, e)] -> Array i e
16:48:40 <ski> (`listArray' is for when you just want to list the array elements (in proper index enumeration order, as given by e.g. `range'. `array' allows you to give the elements in arbitrary order, but then you have to pair up each element with its corresponding index, and it's also possible to repeat an index (in which case, iirc, it will just pick the last association pair))
16:48:46 <Guest13> "where fibs = L.tabulate (0,n) (\n -> case n of 0 -> 0; 1 -> 1; n -> fibs ! (n - 1) + fibs ! (n - 2))" is crazy
16:48:58 <ski> it's just a recursivelt defined array
16:49:03 <Guest13> yeah I like it
16:49:25 <ski> it automatically gives you top-down dynamic programming, through lazy caching of the array elements
16:49:40 <Guest13> I can never get top down vs bottom up lol
16:49:52 <Guest13> I know one goes from leaves other from root but idk
16:50:16 <ski> bottom-up means that you start at the "base cases" of the recursion, building your way upwards. for fibonacci, this would be starting at `0' and `1'
16:50:43 <Guest13> but when you call it you start at the top?
16:50:51 <Guest13> and then work your way down to the bottom
16:50:55 <Guest13> and then back up to the top
16:51:01 <ski> it requires knowing which results will depend on which other results, so that you can make sure to initialize the latter results before the former ones need them
16:51:26 <ski> top-down means that you start at the top desired result, and then let demand determine which sub-results are actually demanded
16:51:54 <Guest13> ok so fib (n-1) + fib (n-2) is top down
16:51:59 <ski> (and those are then cached, so that if they're needed in a sibling branch of the call-tree, they won't be recomputed, but just looked up)
16:52:51 <Guest13> what is an example of bottom up, I know bottom up parsing where you look at "leaves" of the grammar and then say this must be this production rule and so on
16:52:58 <Guest13> but not other cases
16:53:48 <ski> yea. if you do `fib n = fibLoop 0 1 n where fibLoop a b 0 = a; fibLoop a !b n = fibLoop b (a + b) (n-1)', then that's bottom-up (but keeping just the last two results around, since for fibonacci we know we don't need any previous ones any longer)
16:54:39 <Guest13> ah I see
16:54:47 <Guest13> bottom up is usually better surely
16:54:53 <Guest13> if you can do it
16:56:01 × neiluj quits (~neiluj@193.203.71.162) (Ping timeout: 256 seconds)
16:57:21 <Guest13> is it convention to put the changing values in the recursive call before or after the static ones?
16:57:26 <ski> > let memoFib n | n >= 0 = fib n where ((!) . L.tabulate (0,n) -> fib) = \case 0 -> 0; 1 -> 1; n -> fib (n-1) + fib (n-2) in memoFib 12
16:57:28 <lambdabot> 144
16:57:30 <ski> ^ a cute way to, instead of inlining the function `fib' into the array `fibs', inlining the array `fibs' into the function `fib', using `ViewPatterns' to pass the function `\case ...' through `L.tabulate (0,n)' (giving back an array), and then also through `(!)' (indexing the array, giving back a function), before naming that function `fib' .. while `\case ...' already uses that `fib', recursively
16:58:18 <ski> @let memoArray :: Ix i => (i,i) -> (i -> e) -> (i -> e); memoArray ix f = (L.tabulate ix f !)
16:58:19 <lambdabot> Defined.
16:58:35 <ski> > let memoFib n | n >= 0 = fib n where (memoArray (0,n) -> fib) = \case 0 -> 0; 1 -> 1; n -> fib (n-1) + fib (n-2) in memoFib 12 -- same thing, just slightly clearer
16:58:37 <lambdabot> 144
17:00:39 <Guest13> not sure I understand this one
17:00:42 <ski> Guest13 : "bottom up is usually better surely","if you can do it" -- depends. if you know which results will be needed, beforehand, i'll probably be a little more efficient, i suppose. but if there may be large swathes of subresults that may not actually be needed, then it's hard to avoid computing them anyway with bottom-up, so in that case you may be doing quite a bit more work than for top-down
17:01:13 <Guest13> ((!) . tabulate (0,n) -> fib) = \case 0 -> 0; 1 -> 1; n -> fib (n-1) + fib (n-2) I don't understand
17:01:23 <ski> Guest13 : well, basically we just splice a memoization/caching lookup inbetween each recursive call
17:01:50 <ski> `(<expr> -> <pat>)' is a, so-called, view pattern
17:01:50 <Guest13> I don't understand the assignment
17:02:12 <Guest13> we are assigning a function to the left
17:02:24 <ski> my use of the view pattern above is rather unusual .. normally view patterns are used in function (formal) parameter patterns
17:02:31 <ski> e.g.
17:02:52 <ski> > let last (reverse -> x:_) = x in last [2,3,5,7]
17:02:54 <lambdabot> 7
17:03:31 <ski> this will call `reverse' on the input `[2,3,5,7]', before trying to match it with the pattern `x:_'. so we actually match the list `[7,5,3,2]' with the pattern `x:_', so `x' becomes `7'
17:03:56 <ski> that example makes sense to you ?
17:04:17 <Guest13> I understand what it is doing
17:04:22 <ski> oh
17:04:25 <Guest13> but not how the syntax reflects that
17:04:25 <ski> in general
17:04:36 <ski> foo (f -> y) = ..y..
17:04:41 <Guest13> yeah
17:04:49 <ski> can be refactored/rewritten as
17:04:56 <ski> foo x = ..y..
17:04:58 <ski> where
17:05:01 <ski> y = f x
17:05:55 <ski> (.. except that if `y' is a complex pattern, rather than a simple variable, then failure to match that pattern will cause the whole defining equation `foo (f -> y) = ...' to fail (trying the next defining equation instead), while with the `where'-version above, this doesn't happen)
17:06:19 <ski> or, more generally, we can say that
17:06:23 <ski> (f -> y) = x
17:06:28 <ski> amounts to the same thing as
17:06:32 <ski> y = f x
17:07:01 <Guest13> I see how applying f to both sides does that
17:07:02 <ski> (input `x', matched against the view-pattern `(f -> y)', will call `f' on the input `x', and match the result of that to the pattern `y')
17:07:11 <ski> so, in my example
17:07:20 <ski> (memoArray (0,n) -> fib) = \case 0 -> 0; 1 -> 1; n -> fib (n-1) + fib (n-2)
17:07:26 <ski> this is actually the same thing as
17:07:36 <ski> fib = memoArray (0,n) (\case 0 -> 0; 1 -> 1; n -> fib (n-1) + fib (n-2))
17:07:59 <Guest13> is there a reason to phrase it like that?
17:08:04 <ski> cuteness
17:08:08 <Guest13> lol
17:08:31 <Guest13> I understood the below one immediately but the top was super confusing lol
17:08:38 <Guest13> I think I get it now though
17:08:58 <Guest13> you are saying that to get x in (f -> x) = y you need to call f on y
17:09:17 <ski> well, we're also avoiding wrapping the whole `\case ...' in brackets. so when we break that over multiple lines in the source file, we don't need a closing bracket at the end, that may look a bit unclear which opening bracket it is matching, multiple lines up
17:09:35 <ski> it would perhaps be even more fun, if we could write
17:09:48 <ski> (memoArray (0,n) -> fib) 0 = 0
17:09:51 <ski> (memoArray (0,n) -> fib) 1 = 1
17:09:55 <ski> (memoArray (0,n) -> fib) n = fib (n-1) + fib (n-2)
17:10:24 <Guest13> what does memoArray do again?
17:10:25 <ski> .. but my unintended usage of view patterns, above, doesn't support this style of defining `fib'
17:10:45 <Guest13> ! . tabulate
17:10:47 <ski> (and .. it might be unclear whether there'd be only a single call to `memoArray' here, or three separate calls)
17:11:19 <ski> `tabulate (0,n)' converts the function to an array that lists the results of the function, for each input in the range `(0,n)'
17:11:30 <ski> `(!)' converts back from that array, to the function
17:11:42 <Guest13> ok ok
17:12:03 <ski> so, `(!) . tabulate (0,n)' allocates a single array, and makes a new function that, when called, will indirect through this array before calling the original function
17:12:26 ft joins (~ft@p508db8fc.dip0.t-ipconnect.de)
17:12:28 Tuplanolla joins (~Tuplanoll@91-159-69-59.elisa-laajakaista.fi)
17:12:43 <ski> btw .. note that we should not use
17:13:07 <ski> fib n = memoArray (0,n) fib (n-1) + memoArray (0,n) fib (n-2)
17:13:08 <ski> or
17:13:18 <ski> fib n = fib' (n-1) + fib' (n-2)
17:13:20 <ski> where
17:13:32 <ski> fib' = memoArray (0,n) fib
17:13:35 <Guest13> because these are two different arrays
17:13:50 <ski> since this would call `memoArray' once for each recursive call, allocating a new array on each recursive call
17:13:58 <Guest13> ok I see
17:14:01 <ski> we only want to allocate an array on the initial/top call
17:14:15 <Guest13> so defining it as f -> x = y is good
17:14:40 <ski> well .. it does look a bit neat
17:14:56 <ski> of course, there's nothing wrong with naming the intermediate array cache, as well
17:14:58 × patrl quits (~patrl@user/patrl) (Remote host closed the connection)
17:16:01 <Guest13> I gotta go cook dinner, but I will let you know how the problem goes
17:16:11 <Guest13> I think I understand it fairly well know
17:16:12 <Guest13> now
17:16:41 <ski> but i suppose one reason i played around with view patterns here (or rather, a more complcated function, involving a two-dimensional array, for matching a pattern string inside a text string), was to try to keep the memoized code version as close as possible to the original, non-memoized code
17:19:54 <Guest13> so you can reuse the non memoized code?
17:20:06 <Guest13> or separate the logic
17:20:08 <ski> no, not really
17:20:26 <Guest13> so it is clear where the memoization happens and where the recursion happens
17:20:28 <ski> but i localize the differences to a minimal numer of places
17:20:49 <ski> well .. that too. but it's not that unclear for the more elaborated versions, either
17:21:23 <ski> it's more to clearly seee that you haven't accidentally introduced some bug change in the memoized version
17:22:02 <ski> and also to easily be able to ignore the memoization when reading (when thinking about what it does, without concern for the memoization optimiztion)
17:22:59 <Guest13> (y) thank you for the help! ill see if I can let you know how my solution goes, and maybe send it to this channel at some point
17:23:00 <ski> because i keep the recursive calls `fib (n-1) + fib (n-2)', rather than replacing them with array lookups `fibs ! (n-1) + fib ! (n-2)'
17:23:23 <Guest13> its much cleaner like that
17:23:32 <ski> well ..
17:23:42 <ski> .. you should use whichever version is clearer to you
17:24:11 <ski> if you think the view pattern version is too clever, or obscure, then you probably shouldn't use it
17:24:47 × billchenchina quits (~billchenc@103.152.35.21) (Ping timeout: 256 seconds)
17:43:19 × Guest13 quits (~Guest13@cpc93370-hers8-2-0-cust590.6-3.cable.virginm.net) (Ping timeout: 250 seconds)
17:44:48 halloy9814 joins (~halloy981@103.144.93.164)
17:45:09 halloy9814 is now known as suvid
17:45:15 <suvid> hi
17:46:28 × suvid quits (~halloy981@103.144.93.164) (Remote host closed the connection)
17:50:05 ph88 joins (~ph88@2a02:8109:9e26:c800:801e:36ad:9367:33b9)
17:51:46 jcarpenter2 joins (~lol@2603:3016:1e01:b940:892b:2549:5c20:9c9b)
17:54:40 × euphores quits (~SASL_euph@user/euphores) (Quit: Leaving.)
18:00:18 euphores joins (~SASL_euph@user/euphores)
18:02:59 polyphem joins (~rod@p4fc2c1da.dip0.t-ipconnect.de)
18:06:40 suvid joins (~suvid@103.144.93.164)
18:07:22 <suvid> hi
18:08:05 × xnyhps quits (~xnyhps@2a02:2770:3:0:216:3eff:fe67:3288) (Ping timeout: 240 seconds)
18:08:19 xnyhps joins (~xnyhps@2a02:2770:3:0:216:3eff:fe67:3288)
18:10:21 × random-jellyfish quits (~developer@user/random-jellyfish) (Ping timeout: 255 seconds)
18:11:42 × suvid quits (~suvid@103.144.93.164) (Remote host closed the connection)
18:14:30 y04nn joins (~username@2a03:1b20:8:f011::e10d)
18:24:31 wootehfoot joins (~wootehfoo@user/wootehfoot)
18:38:55 × jjnkn quits (~jjnkn@46.150.73.222.kyiv.volia.net) (Remote host closed the connection)
18:50:06 philopsos joins (~caecilius@user/philopsos)
18:50:34 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
18:54:41 danse-nr3 joins (~danse-nr3@151.47.136.223)
18:55:36 raehik joins (~raehik@rdng-25-b2-v4wan-169990-cust1344.vm39.cable.virginm.net)
18:56:38 × sawilagar quits (~sawilagar@user/sawilagar) (Ping timeout: 256 seconds)
19:12:36 × sprout quits (~quassel@84-80-106-227.fixed.kpn.net) (Read error: Connection reset by peer)
19:12:49 sprout joins (~quassel@2a02-a448-3a80-0-4d25-a983-a243-75e.fixed6.kpn.net)
19:13:28 × puke quits (~puke@user/puke) (Remote host closed the connection)
19:13:41 × bsima quits (~bsima@2604:a880:400:d0::19f1:7001) (Quit: ZNC 1.8.2 - https://znc.in)
19:14:01 × MironZ quits (~MironZ@nat-infra.ehlab.uk) (Quit: Ping timeout (120 seconds))
19:14:13 bsima joins (~bsima@143.198.118.179)
19:14:20 MironZ joins (~MironZ@nat-infra.ehlab.uk)
19:14:25 × sprout quits (~quassel@2a02-a448-3a80-0-4d25-a983-a243-75e.fixed6.kpn.net) (Read error: Connection reset by peer)
19:14:35 × titibandit quits (~user@user/titibandit) (Read error: Connection reset by peer)
19:15:01 × Athas quits (athas@sigkill.dk) (Quit: ZNC 1.8.2 - https://znc.in)
19:15:02 × poscat quits (~poscat@user/poscat) (Quit: Bye)
19:15:09 titibandit joins (~user@user/titibandit)
19:15:22 poscat joins (~poscat@user/poscat)
19:15:28 × beaky quits (~beaky@2a03:b0c0:0:1010::1e:a001) (Read error: Connection reset by peer)
19:15:30 jinsun_ joins (~jinsun@user/jinsun)
19:15:30 × jinsun quits (~jinsun@user/jinsun) (Killed (mercury.libera.chat (Nickname regained by services)))
19:15:30 jinsun_ is now known as jinsun
19:15:34 driib3 joins (~driib@vmi931078.contaboserver.net)
19:15:35 dagi85299 joins (~dagit@24.21.226.72)
19:15:42 Riviera_ joins (Riviera@user/riviera)
19:15:47 beaky joins (~beaky@2a03:b0c0:0:1010::1e:a001)
19:15:55 × Riviera quits (Riviera@user/riviera) (Killed (NickServ (GHOST command used by Riviera_)))
19:15:57 × caubert quits (~caubert@user/caubert) (Read error: Connection reset by peer)
19:15:58 × fr33domlover quits (~fr33domlo@towards.vision) (Quit: Ping timeout (120 seconds))
19:15:59 puke joins (~puke@user/puke)
19:16:05 Riviera_ is now known as Riviera
19:16:06 acidjnk_new joins (~acidjnk@p5dd87bdf.dip0.t-ipconnect.de)
19:16:07 sprout joins (~quassel@84-80-106-227.fixed.kpn.net)
19:16:23 remexre_ joins (~remexre@user/remexre)
19:16:28 Athas joins (athas@2a01:7c8:aaac:1cf:a4c:e787:a74:d356)
19:16:35 × bsima1 quits (9d7e39c8ad@2a03:6000:1812:100::dd) (Read error: Connection reset by peer)
19:16:35 × fgaz_ quits (1ff9197ed6@2a03:6000:1812:100::11ea) (Read error: Connection reset by peer)
19:16:35 × jleightcap quits (7bc4014b62@user/jleightcap) (Read error: Connection reset by peer)
19:16:35 × brettgilio quits (a35ba67324@2a03:6000:1812:100::260) (Read error: Connection reset by peer)
19:16:35 × cpli quits (77fc530071@2a03:6000:1812:100::252) (Read error: Connection reset by peer)
19:16:35 × whereiseveryone quits (206ba86c98@2a03:6000:1812:100::2e4) (Read error: Connection reset by peer)
19:16:35 × Ankhers quits (e99e97ef8e@2a03:6000:1812:100::2a2) (Read error: Connection reset by peer)
19:16:35 × kuruczgy quits (55b66dd3ae@2a03:6000:1812:100::127f) (Read error: Connection reset by peer)
19:16:35 × henrytill quits (e0180937c3@2a03:6000:1812:100::e8c) (Read error: Connection reset by peer)
19:16:35 × JoelMcCracken quits (5ea8252fbb@2a03:6000:1812:100::10e3) (Read error: Connection reset by peer)
19:16:35 × chaitlatte0 quits (ea29c0bb16@user/chaitlatte0) (Read error: Connection reset by peer)
19:16:35 × rselim quits (ce261f06ff@user/milesrout) (Read error: Connection reset by peer)
19:16:35 × eso quits (a0662dfd5e@2a03:6000:1812:100::1266) (Read error: Connection reset by peer)
19:16:35 × lukec quits (9dfd4d094e@2a03:6000:1812:100::10e) (Read error: Connection reset by peer)
19:16:35 × evanrelf quits (3addc196af@2a03:6000:1812:100::f0) (Read error: Connection reset by peer)
19:16:35 × jmcantrell quits (644f1bed9a@user/jmcantrell) (Read error: Connection reset by peer)
19:16:35 × shreyasminocha quits (51fdc93eda@user/shreyasminocha) (Read error: Connection reset by peer)
19:16:35 × samhh quits (7569f027cf@2a03:6000:1812:100::e4) (Read error: Connection reset by peer)
19:16:35 × probie quits (cc0b34050a@user/probie) (Read error: Connection reset by peer)
19:16:35 × aniketd quits (32aa4844cd@2a03:6000:1812:100::dcb) (Read error: Connection reset by peer)
19:16:35 × akspecs quits (00cc8321af@sourcehut/user/akspecs) (Read error: Connection reset by peer)
19:16:35 × fluffyballoon quits (45ce440a48@2a03:6000:1812:100::e2) (Read error: Connection reset by peer)
19:16:35 × fn_lumi quits (3d621153a5@2a03:6000:1812:100::df7) (Read error: Connection reset by peer)
19:16:35 × arcadewise quits (52968ed80d@2a03:6000:1812:100::3df) (Read error: Connection reset by peer)
19:16:35 × filwisher quits (2e6936c793@2a03:6000:1812:100::170) (Read error: Connection reset by peer)
19:16:35 samhh_ is now known as samhh
19:16:37 × ursa-major quits (114efe6c39@2a03:6000:1812:100::11f3) (Read error: Connection reset by peer)
19:16:40 × mht-wtf quits (~mht@2a03:b0c0:3:e0::1e2:c001) (Ping timeout: 246 seconds)
19:16:42 × chessai quits (sid225296@id-225296.lymington.irccloud.com) (Read error: Connection reset by peer)
19:16:43 × systemfault quits (sid267009@about/typescript/member/systemfault) (Read error: Connection reset by peer)
19:16:46 × integral quits (sid296274@user/integral) (Read error: Connection reset by peer)
19:16:56 × driib quits (~driib@vmi931078.contaboserver.net) (Read error: Connection reset by peer)
19:16:57 × econo_ quits (uid147250@id-147250.tinside.irccloud.com) (Ping timeout: 268 seconds)
19:16:57 × xsarnik quits (xsarnik@lounge.fi.muni.cz) (Ping timeout: 268 seconds)
19:17:02 × aforemny_ quits (~aforemny@2001:9e8:6cd4:e700:d233:e5e6:582d:855) (Quit: ZNC 1.8.2 - https://znc.in)
19:17:34 × xstill_ quits (xstill@fimu/xstill) (Ping timeout: 268 seconds)
19:17:35 × lambdap2371 quits (~lambdap@static.167.190.119.168.clients.your-server.de) (Quit: Ping timeout (120 seconds))
19:17:43 bsima1 joins (9d7e39c8ad@2a03:6000:1812:100::dd)
19:17:44 fgaz_ joins (1ff9197ed6@2a03:6000:1812:100::11ea)
19:17:44 lukec joins (9dfd4d094e@2a03:6000:1812:100::10e)
19:17:44 filwisher joins (2e6936c793@2a03:6000:1812:100::170)
19:17:44 brettgilio joins (a35ba67324@2a03:6000:1812:100::260)
19:17:44 fluffyballoon joins (45ce440a48@2a03:6000:1812:100::e2)
19:17:44 fn_lumi joins (3d621153a5@2a03:6000:1812:100::df7)
19:17:44 shreyasminocha joins (51fdc93eda@user/shreyasminocha)
19:17:44 aniketd joins (32aa4844cd@2a03:6000:1812:100::dcb)
19:17:44 eso joins (a0662dfd5e@2a03:6000:1812:100::1266)
19:17:44 jleightcap joins (7bc4014b62@user/jleightcap)
19:17:44 xigua_ joins (~xigua@user/xigua)
19:17:44 × haritz quits (~hrtz@user/haritz) (Remote host closed the connection)
19:17:44 econo__ joins (uid147250@id-147250.tinside.irccloud.com)
19:17:44 chessai_ joins (sid225296@id-225296.lymington.irccloud.com)
19:17:44 aspen__ joins (sid449115@id-449115.helmsley.irccloud.com)
19:17:44 systemfault_ joins (sid267009@about/typescript/member/systemfault)
19:17:44 <ski> whee
19:17:44 EvanR_ joins (~EvanR@user/evanr)
19:17:44 haritz joins (~hrtz@2a02:8010:65b5:0:6009:6384:e3cb:2220)
19:17:44 × Pent quits (sid313808@id-313808.lymington.irccloud.com) (Read error: Connection reset by peer)
19:17:44 Boarders____ joins (sid425905@id-425905.lymington.irccloud.com)
19:17:44 integral_ joins (sid296274@user/integral)
19:17:44 × dagit quits (~dagit@2001:558:6025:38:71c6:9d58:7252:8976) (Remote host closed the connection)
19:17:44 dy_ joins (sid3438@user/dy)
19:17:44 amir_ joins (sid22336@user/amir)
19:17:44 × hugo quits (znc@quicksilver.lysator.liu.se) (Quit: ZNC 1.8.2+deb3.1 - https://znc.in)
19:17:44 × scav quits (sid309693@user/scav) (Ping timeout: 256 seconds)
19:17:44 × h2t quits (~h2t@user/h2t) (Ping timeout: 256 seconds)
19:17:44 × _0xa_ quits (~user@2001:19f0:5001:2ba8:5400:1ff:feda:88fc) (Quit: ZNC 1.7.5+deb4 - https://znc.in)
19:17:44 × pierrot quits (~pi@user/pierrot) (Ping timeout: 256 seconds)
19:17:44 × joeyh quits (joeyh@kitenet.net) (Quit: ZNC 1.8.2+deb3+b4 - https://znc.in)
19:17:44 × darkling quits (~darkling@2001-ba8-1f1-f0e6-0-0-0-2.autov6rev.bitfolk.space) (Remote host closed the connection)
19:17:44 hugo joins (znc@quicksilver.lysator.liu.se)
19:17:44 h2t_ joins (~h2t@user/h2t)
19:17:44 darksatanic joins (~darkling@savella.carfax.org.uk)
19:17:44 × rvalue quits (~rvalue@user/rvalue) (Ping timeout: 256 seconds)
19:17:44 × yandere quits (sid467876@id-467876.ilkley.irccloud.com) (Ping timeout: 256 seconds)
19:17:44 × carter quits (sid14827@id-14827.helmsley.irccloud.com) (Ping timeout: 256 seconds)
19:17:44 × edwardk quits (sid47016@haskell/developer/edwardk) (Ping timeout: 256 seconds)
19:17:44 yandere_ joins (sid467876@id-467876.ilkley.irccloud.com)
19:17:44 alanz_ joins (sid110616@id-110616.uxbridge.irccloud.com)
19:17:44 × nek0 quits (~nek0@user/nek0) (Quit: Ping timeout (120 seconds))
19:17:44 × PotatoGim quits (sid99505@id-99505.lymington.irccloud.com) (Read error: Connection reset by peer)
19:17:44 × Boarders___ quits (sid425905@id-425905.lymington.irccloud.com) (Read error: Connection reset by peer)
19:17:44 × amir quits (sid22336@user/amir) (Read error: Connection reset by peer)
19:17:44 × bw_____ quits (sid2730@id-2730.ilkley.irccloud.com) (Read error: Connection reset by peer)
19:17:44 × mauke quits (~mauke@user/mauke) (Ping timeout: 246 seconds)
19:17:44 × cln_ quits (cln@wtf.cx) (Ping timeout: 246 seconds)
19:17:44 amir_ is now known as amir
19:17:44 × alanz quits (sid110616@id-110616.uxbridge.irccloud.com) (Ping timeout: 246 seconds)
19:17:44 driib3 is now known as driib
19:17:44 chessai_ is now known as chessai
19:17:44 systemfault_ is now known as systemfault
19:17:44 econo__ is now known as econo_
19:17:44 integral_ is now known as integral
19:17:44 gaze___ joins (sid387101@id-387101.helmsley.irccloud.com)
19:17:44 edwardk joins (sid47016@haskell/developer/edwardk)
19:17:44 alanz_ is now known as alanz
19:17:50 Fangs_ joins (sid141280@id-141280.hampstead.irccloud.com)
19:17:52 × remexre quits (~remexre@user/remexre) (Ping timeout: 268 seconds)
19:17:54 nek0 joins (~nek0@2a01:4f8:222:2b41::12)
19:17:54 × nek0 quits (~nek0@2a01:4f8:222:2b41::12) (Changing host)
19:17:54 nek0 joins (~nek0@user/nek0)
19:17:56 Pent joins (sid313808@id-313808.lymington.irccloud.com)
19:17:57 remexre_ is now known as remexre
19:18:00 dmj`_ joins (sid72307@id-72307.hampstead.irccloud.com)
19:18:03 PotatoGim_ joins (sid99505@id-99505.lymington.irccloud.com)
19:18:04 × Pozyomka quits (~pyon@user/pyon) (Ping timeout: 246 seconds)
19:18:04 × riatre quits (~quassel@2001:310:6000:f::5198:1) (Ping timeout: 246 seconds)
19:18:07 carter_ joins (sid14827@id-14827.helmsley.irccloud.com)
19:18:07 × aspen quits (sid449115@id-449115.helmsley.irccloud.com) (Ping timeout: 256 seconds)
19:18:07 × landonf quits (landonf@mac68k.info) (Ping timeout: 256 seconds)
19:18:08 × coldtom quits (~coldtom@coldrick.cc) (Quit: Ping timeout (120 seconds))
19:18:08 aspen__ is now known as aspen
19:18:08 × Goodbye_Vincent quits (cyvahl@freakshells.net) (Quit: Ping timeout (120 seconds))
19:18:09 rvalue joins (~rvalue@user/rvalue)
19:18:10 bw_____ joins (sid2730@id-2730.ilkley.irccloud.com)
19:18:11 × xigua quits (~xigua@user/xigua) (Ping timeout: 268 seconds)
19:18:11 × dmj` quits (sid72307@id-72307.hampstead.irccloud.com) (Ping timeout: 268 seconds)
19:18:11 xigua_ is now known as xigua
19:18:11 dmj`_ is now known as dmj`
19:18:18 xsarnik joins (xsarnik@lounge.fi.muni.cz)
19:18:19 coldtom joins (~coldtom@coldrick.cc)
19:18:20 aforemny joins (~aforemny@2001:9e8:6cd4:e700:d233:e5e6:582d:855)
19:18:22 Pozyomka joins (~pyon@user/pyon)
19:18:23 xstill_ joins (xstill@fimu/xstill)
19:18:25 Goodbye_Vincent joins (cyvahl@freakshells.net)
19:18:25 lambdap2371 joins (~lambdap@static.167.190.119.168.clients.your-server.de)
19:18:29 × EvanR quits (~EvanR@user/evanr) (Ping timeout: 268 seconds)
19:18:31 mht-wtf joins (~mht@mht.wtf)
19:18:37 scav joins (sid309693@user/scav)
19:18:39 fr33domlover joins (~fr33domlo@towards.vision)
19:18:45 whereiseveryone joins (206ba86c98@2a03:6000:1812:100::2e4)
19:18:46 ursa-major joins (114efe6c39@2a03:6000:1812:100::11f3)
19:18:48 × acidjnk quits (~acidjnk@p200300d6e714dc32b43b4fa4bda78a3a.dip0.t-ipconnect.de) (Ping timeout: 268 seconds)
19:18:48 × remmie quits (ianremsen@tilde.team) (Ping timeout: 268 seconds)
19:18:48 × dy quits (sid3438@user/dy) (Ping timeout: 268 seconds)
19:18:48 × gaze__ quits (sid387101@id-387101.helmsley.irccloud.com) (Ping timeout: 268 seconds)
19:18:48 × Fangs quits (sid141280@id-141280.hampstead.irccloud.com) (Ping timeout: 268 seconds)
19:18:48 × haritz quits (~hrtz@2a02:8010:65b5:0:6009:6384:e3cb:2220) (Changing host)
19:18:48 haritz joins (~hrtz@user/haritz)
19:18:48 gaze___ is now known as gaze__
19:18:48 dy_ is now known as dy
19:18:48 Fangs_ is now known as Fangs
19:18:51 arcadewise joins (52968ed80d@2a03:6000:1812:100::3df)
19:18:53 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 240 seconds)
19:18:53 _0xa joins (~user@2001:19f0:5001:2ba8:5400:1ff:feda:88fc)
19:18:53 × _0xa quits (~user@2001:19f0:5001:2ba8:5400:1ff:feda:88fc) (Changing host)
19:18:53 _0xa joins (~user@user/0xa/x-3134607)
19:18:55 mauke joins (~mauke@user/mauke)
19:18:56 rselim joins (ce261f06ff@user/milesrout)
19:18:58 × TheCoffeMaker quits (~TheCoffeM@user/thecoffemaker) (Quit: So long and thanks for all the fish)
19:18:58 Ankhers joins (e99e97ef8e@2a03:6000:1812:100::2a2)
19:19:04 riatre joins (~quassel@2001:310:6000:f::5198:1)
19:19:05 cpli joins (77fc530071@2a03:6000:1812:100::252)
19:19:05 akspecs joins (00cc8321af@sourcehut/user/akspecs)
19:19:10 jmcantrell joins (644f1bed9a@user/jmcantrell)
19:19:11 × mhatta quits (~mhatta@www21123ui.sakura.ne.jp) (Remote host closed the connection)
19:19:11 kuruczgy joins (55b66dd3ae@2a03:6000:1812:100::127f)
19:19:13 henrytill joins (e0180937c3@2a03:6000:1812:100::e8c)
19:19:14 joeyh joins (~joeyh@kitenet.net)
19:19:19 caubert joins (~caubert@user/caubert)
19:19:19 TheCoffeMaker joins (~TheCoffeM@user/thecoffemaker)
19:19:22 samhh_ joins (7569f027cf@2a03:6000:1812:100::e4)
19:19:23 mhatta joins (~mhatta@www21123ui.sakura.ne.jp)
19:19:25 JoelMcCracken joins (5ea8252fbb@2a03:6000:1812:100::10e3)
19:19:26 × manwithluck quits (~manwithlu@149.102.244.20) (Remote host closed the connection)
19:19:27 probie joins (cc0b34050a@user/probie)
19:19:27 × Noinia quits (~Frank@77-162-168-71.fixed.kpn.net) (Read error: Connection reset by peer)
19:19:28 × Dykam quits (Dykam@dykam.nl) (Remote host closed the connection)
19:19:29 cln_ joins (cln@wtf.cx)
19:19:37 chaitlatte0 joins (ea29c0bb16@user/chaitlatte0)
19:19:41 Noinia joins (~Frank@77-162-168-71.fixed.kpn.net)
19:19:41 evanrelf joins (3addc196af@2a03:6000:1812:100::f0)
19:20:35 pierrot joins (~pi@user/pierrot)
19:20:37 Dykam joins (Dykam@dykam.nl)
19:20:50 darksatanic is now known as darkling
19:20:57 × APic quits (apic@apic.name) (Ping timeout: 268 seconds)
19:22:11 APic joins (apic@apic.name)
19:22:53 × raehik quits (~raehik@rdng-25-b2-v4wan-169990-cust1344.vm39.cable.virginm.net) (Ping timeout: 240 seconds)
19:23:09 landonf joins (landonf@mac68k.info)
19:32:00 × bsima quits (~bsima@143.198.118.179) (Quit: ZNC 1.8.2 - https://znc.in)
19:32:01 remmie joins (ianremsen@tilde.team)
19:32:34 bsima joins (~bsima@2604:a880:400:d0::19f1:7001)
19:32:54 × oo_miguel quits (~Thunderbi@78-11-181-16.static.ip.netia.com.pl) (Quit: oo_miguel)
19:35:36 × L29Ah quits (~L29Ah@wikipedia/L29Ah) (Ping timeout: 260 seconds)
19:39:25 × sudden quits (~cat@user/sudden) (Ping timeout: 272 seconds)
19:44:08 raehik joins (~raehik@rdng-25-b2-v4wan-169990-cust1344.vm39.cable.virginm.net)
19:50:14 × immae quits (~immae@2a01:4f8:141:53e7::) (Quit: WeeChat 3.3)
19:51:04 sudden joins (~cat@user/sudden)
19:51:58 immae joins (~immae@2a01:4f8:141:53e7::)
19:52:22 × philopsos quits (~caecilius@user/philopsos) (Ping timeout: 246 seconds)
19:56:36 × wootehfoot quits (~wootehfoo@user/wootehfoot) (Read error: Connection reset by peer)
19:57:47 × raehik quits (~raehik@rdng-25-b2-v4wan-169990-cust1344.vm39.cable.virginm.net) (Ping timeout: 256 seconds)
19:58:57 L29Ah joins (~L29Ah@wikipedia/L29Ah)
20:00:54 L29Ah parts (~L29Ah@wikipedia/L29Ah) ()
20:02:23 L29Ah joins (~L29Ah@wikipedia/L29Ah)
20:08:56 × danse-nr3 quits (~danse-nr3@151.47.136.223) (Read error: Connection reset by peer)
20:09:06 danse-nr3 joins (~danse-nr3@rm-19-5-133.service.infuturo.it)
20:10:15 talismanick joins (~user@2601:644:937c:ed10::ae5)
20:10:44 kadir joins (~kadir@88.251.51.100)
20:13:45 × sord937 quits (~sord937@gateway/tor-sasl/sord937) (Quit: sord937)
20:22:28 <talismanick> Why is there no `Monoid e -> Alternative (Either e)` instance?
20:22:31 <talismanick> Is it something to do with kind, as in biasing a choice so it then acts "as if" it were `* -> *` like `Maybe` breaks some law I haven't thought of yet?
20:24:35 <talismanick> for context, I'm playing around with a package promising bidirectional parsing <-> prettyprinting on the basis of monadic profunctoriality, but it's bitrotted as GHC has evolved
20:25:29 <ski> hmm .. i see `Monoid e => Monoid (Validation e a)'
20:25:39 <ski> (doesn't seem to be one for `Alternative', though)
20:26:12 <talismanick> relaxing the <4.13 constraint went smoothly, except that newtype-deriving the all-important Alternative and MonadPlus failed with the error "no instance for MonadPlus (Either String)"
20:27:04 <talismanick> (deriving these instances for the reversible Printer type, that is)
20:27:50 <glguy> so this? instance Monoid e => Alternative (Either e) where empty = Left mempty; Right x <|> _ = Right x; _ <|> Right x = Right x; Left x <|> Left y = Left (x <> y)
20:27:51 <talismanick> ski: do you think I maybe need to add some newtype wrappers using Ap to lift Monoid to Alternative?
20:28:41 <talismanick> glguy: yeah, that looks right... am I missing something obvious about why this is wrong?
20:30:44 pavonia joins (~user@user/siracusa)
20:31:00 <talismanick> there is https://github.com/ekmett/bifunctors/issues/126 in the works, which might be enough
20:31:45 <talismanick> (if we get Bialternative and it lets us do what we wanted from Alternative/MonadPlus)
20:32:00 <ncf> https://gitlab.haskell.org/ghc/ghc/-/issues/9588
20:33:56 <glguy> I think there are just too many options for there to be a sensible implementation. Picking one arbitrarily will just lead to surprise bugs
20:35:34 EvanR_ is now known as EvanR
20:35:53 waleee joins (~waleee@h-176-10-144-38.NA.cust.bahnhof.se)
20:36:53 <talismanick> so, the right solution is probably to tear out Either altogether and use Error from transformers?
20:37:24 <talismanick> I mean, I guess that's a win for convenient typeclass polymorphism anyways
20:38:43 <talismanick> err, Except
20:38:53 <glguy> The nice solution is to make a new datatype with documented behaviors you rely on. Piecing together behaviors from generic types can be nice in a pinch but it's challenging for the future reader to know what properties of the generic thing are being relied upon later
20:40:50 × califax quits (~califax@user/califx) (Ping timeout: 260 seconds)
20:40:50 × ChaiTRex quits (~ChaiTRex@user/chaitrex) (Ping timeout: 260 seconds)
20:41:01 <talismanick> if anything, that's all the stronger an argument for getting rid of (Either String) and using the transformers package, given that a homegrown error type is liable to be a source of problems itself
20:41:03 califax_ joins (~califax@user/califx)
20:42:07 califax_ is now known as califax
20:42:09 <talismanick> I mean, say what you will about transformer stacks with tons of parameters, lens signatures, etc, but I feel like Except is universally understood
20:42:15 <glguy> If I'm using transformers it's behind a newtype
20:42:21 <talismanick> fair enough
20:44:24 ChaiTRex joins (~ChaiTRex@user/chaitrex)
20:47:20 machinedgod joins (~machinedg@d173-183-246-216.abhsia.telus.net)
20:49:07 <ncf> i'm not sure there are that many options for Alternative (Either e) tbh
20:49:42 <ncf> AFAICT you only have to choose a monoid for e and whether to keep the left or the right in Right a <|> Right b
20:50:15 <ncf> and it's not like there's a canonical monoid on every type (as opposed to the First semigroup), so you just make it a Monoid e constraint
20:51:00 × danse-nr3 quits (~danse-nr3@rm-19-5-133.service.infuturo.it) (Ping timeout: 255 seconds)
20:52:36 × kadir quits (~kadir@88.251.51.100) (Quit: WeeChat 4.2.2)
20:54:53 danza joins (~francesco@rm-19-5-133.service.infuturo.it)
20:58:09 × mei quits (~mei@user/mei) (Remote host closed the connection)
20:59:13 × danza quits (~francesco@rm-19-5-133.service.infuturo.it) (Ping timeout: 246 seconds)
21:02:19 × johnw quits (~johnw@69.62.242.138) (Quit: ZNC - http://znc.in)
21:02:45 johnw joins (~johnw@69.62.242.138)
21:04:37 mei joins (~mei@user/mei)
21:10:13 × ph88 quits (~ph88@2a02:8109:9e26:c800:801e:36ad:9367:33b9) (Remote host closed the connection)
21:10:37 m257 joins (~maaz@bras-base-hspron0502w-grc-15-174-92-92-146.dsl.bell.ca)
21:13:46 × takuan quits (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection)
21:14:07 × machinedgod quits (~machinedg@d173-183-246-216.abhsia.telus.net) (Ping timeout: 268 seconds)
21:15:05 oo_miguel joins (~Thunderbi@78-11-181-16.static.ip.netia.com.pl)
21:16:11 × polyphem quits (~rod@p4fc2c1da.dip0.t-ipconnect.de) (Ping timeout: 260 seconds)
21:17:20 <talismanick> ncf: isn't Alternative generally left-biased on mutual success? (pick `Right a` and bail)
21:18:21 <talismanick> and, why isn't `Monoid e => Alternative (Either e)` in base, then? That seems like a reasonably conservative-but-useful addition
21:18:23 <ncf> i mean Alternative [] isn't left-biased
21:18:35 <talismanick> oh, true
21:18:38 <ncf> but Either can't just concatenate the Rights, since it has to work parametrically in a
21:18:54 philopsos1 joins (~caecilius@user/philopsos)
21:19:07 <ncf> so it has to pick one, and left seems like the favoured one because english
21:20:12 <talismanick> ...but it's not unlawful, and there's precedent for English bias anyways
21:21:04 sawilagar joins (~sawilagar@user/sawilagar)
21:21:14 <ncf> i mean if you want to convince the Core Libraries Committee that this is the one true God-intended instance for Alternative (Either e), go for it
21:21:40 <ncf> from experience this will not be an easy task
21:27:20 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
21:31:46 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 246 seconds)
21:54:28 × __monty__ quits (~toonn@user/toonn) (Quit: leaving)
21:58:24 × fendor quits (~fendor@2a02:8388:1605:ce00:24e2:c141:1f86:a346) (Remote host closed the connection)
22:03:20 × L29Ah quits (~L29Ah@wikipedia/L29Ah) (Read error: Connection timed out)
22:06:16 systemhalted joins (~systemhal@130.51.137.77)
22:06:53 × califax quits (~califax@user/califx) (Remote host closed the connection)
22:07:47 califax joins (~califax@user/califx)
22:13:56 × systemhalted quits (~systemhal@130.51.137.77) (Ping timeout: 268 seconds)
22:17:33 × titibandit quits (~user@user/titibandit) (Remote host closed the connection)
22:19:31 agent314 joins (~quassel@193.37.254.131.adsl.inet-telecom.org)
22:20:05 × agent314 quits (~quassel@193.37.254.131.adsl.inet-telecom.org) (Client Quit)
22:20:28 L29Ah joins (~L29Ah@wikipedia/L29Ah)
22:20:42 × gmg quits (~user@user/gehmehgeh) (Ping timeout: 260 seconds)
22:20:59 sp1ff joins (~user@c-24-21-45-157.hsd1.wa.comcast.net)
22:22:24 gmg joins (~user@user/gehmehgeh)
22:25:14 × acidjnk_new quits (~acidjnk@p5dd87bdf.dip0.t-ipconnect.de) (Ping timeout: 252 seconds)
22:26:23 × ezzieyguywuf quits (~Unknown@user/ezzieyguywuf) (Ping timeout: 256 seconds)
22:27:57 ezzieyguywuf joins (~Unknown@user/ezzieyguywuf)
22:31:54 × gmg quits (~user@user/gehmehgeh) (Ping timeout: 260 seconds)
22:37:41 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
22:40:03 B-J joins (~BenziJuni@232-148-209-31.dynamic.hringdu.is)
22:40:58 × Benzi-Junior quits (~BenziJuni@232-148-209-31.dynamic.hringdu.is) (Read error: Connection reset by peer)
22:42:44 systemhalted joins (~systemhal@130.51.137.77)
22:45:08 × systemhalted quits (~systemhal@130.51.137.77) (Remote host closed the connection)
22:45:23 × sawilagar quits (~sawilagar@user/sawilagar) (Ping timeout: 268 seconds)
22:51:35 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 264 seconds)
22:57:55 × ystael quits (~ystael@user/ystael) (Quit: Lost terminal)
23:02:50 ystael joins (~ystael@user/ystael)
23:10:53 × Athas quits (athas@2a01:7c8:aaac:1cf:a4c:e787:a74:d356) (Quit: ZNC 1.8.2 - https://znc.in)
23:11:03 Athas joins (athas@2a01:7c8:aaac:1cf:a4c:e787:a74:d356)
23:25:48 × xff0x quits (~xff0x@2405:6580:b080:900:25be:f228:ec64:b69c) (Ping timeout: 256 seconds)
23:26:19 × Tuplanolla quits (~Tuplanoll@91-159-69-59.elisa-laajakaista.fi) (Quit: Leaving.)
23:29:22 × oo_miguel quits (~Thunderbi@78-11-181-16.static.ip.netia.com.pl) (Ping timeout: 246 seconds)
23:30:24 xff0x joins (~xff0x@2405:6580:b080:900:25be:f228:ec64:b69c)
23:34:01 × Athas quits (athas@2a01:7c8:aaac:1cf:a4c:e787:a74:d356) (Quit: ZNC 1.8.2 - https://znc.in)
23:34:11 Athas joins (athas@2a01:7c8:aaac:1cf:a4c:e787:a74:d356)
23:41:19 × petrichor quits (~znc-user@user/petrichor) (Ping timeout: 260 seconds)
23:44:53 × zzz quits (~yin@user/zero) (Ping timeout: 268 seconds)
23:50:58 petrichor joins (~znc-user@user/petrichor)
23:51:14 bitdex joins (~bitdex@gateway/tor-sasl/bitdex)

All times are in UTC on 2024-05-16.