Home liberachat/#haskell: Logs Calendar

Logs on 2025-02-10 (liberachat/#haskell)

00:00:30 TheCoffeMaker joins (~TheCoffeM@user/thecoffemaker)
00:00:55 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
00:01:11 × TheCoffeMaker quits (~TheCoffeM@user/thecoffemaker) (Read error: Connection reset by peer)
00:02:03 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 246 seconds)
00:02:17 zaz joins (~zaz@195.89.33.222)
00:04:36 TheCoffeMaker joins (~TheCoffeM@user/thecoffemaker)
00:12:36 xff0x_ joins (~xff0x@2405:6580:b080:900:37f4:5b69:766f:630)
00:15:04 × xff0x quits (~xff0x@2405:6580:b080:900:f597:997a:28cf:fd48) (Ping timeout: 265 seconds)
00:16:57 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Remote host closed the connection)
00:17:57 × MyNetAz quits (~MyNetAz@user/MyNetAz) (Remote host closed the connection)
00:19:04 × img quits (~img@user/img) (Quit: ZNC 1.8.2 - https://znc.in)
00:20:24 img joins (~img@user/img)
00:24:49 × otbergsten quits (~otbergste@user/otbergsten) (Remote host closed the connection)
00:24:58 MyNetAz joins (~MyNetAz@user/MyNetAz)
00:25:01 zaz is now known as Zaz_
00:31:34 × xff0x_ quits (~xff0x@2405:6580:b080:900:37f4:5b69:766f:630) (Ping timeout: 268 seconds)
00:31:35 xff0x joins (~xff0x@2405:6580:b080:900:7b94:8fe8:c4af:8544)
00:34:17 <Zaz_> ncf Thanks a lot! Am I correct in thinking that it would be bijective if the codomain was the pair of strings where the first character of the second string is not lower case? Is this something that can be modelled in Haskell? E.g. with refined?
00:34:18 <Zaz_> Are you referring to Control.Lens.Iso? Is there any reason not to work with lenses? Or are they the best tool we have for implementing bijective programs?
00:36:57 ljdarj1 joins (~Thunderbi@user/ljdarj)
00:39:49 × ljdarj quits (~Thunderbi@user/ljdarj) (Ping timeout: 248 seconds)
00:39:49 ljdarj1 is now known as ljdarj
00:42:46 causal joins (~eric@50.35.84.231)
00:46:59 alfiee joins (~alfiee@user/alfiee)
00:48:57 × xff0x quits (~xff0x@2405:6580:b080:900:7b94:8fe8:c4af:8544) (Ping timeout: 252 seconds)
00:50:15 Axman6 joins (~Axman6@user/axman6)
00:51:13 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 245 seconds)
00:56:47 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
00:58:07 × Jeanne-Kamikaze quits (~Jeanne-Ka@static-198-54-134-151.cust.tzulo.com) (Quit: Leaving)
01:01:47 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 268 seconds)
01:03:59 × Tuplanolla quits (~Tuplanoll@91-159-69-59.elisa-laajakaista.fi) (Quit: Leaving.)
01:07:24 × gmg quits (~user@user/gehmehgeh) (Ping timeout: 264 seconds)
01:10:19 × Googulator quits (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu) (Quit: Client closed)
01:12:13 × sprotte24 quits (~sprotte24@p200300d16f25850039a3b2714e26a8e3.dip0.t-ipconnect.de) (Read error: Connection reset by peer)
01:15:01 × acidjnk_new3 quits (~acidjnk@p200300d6e7283f26c4dbaee3a15423f1.dip0.t-ipconnect.de) (Ping timeout: 248 seconds)
01:18:56 zenstoic joins (uid461840@id-461840.hampstead.irccloud.com)
01:19:07 vanishingideal joins (~vanishing@user/vanishingideal)
01:23:40 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
01:27:31 tnt2 joins (~Thunderbi@user/tnt1)
01:28:16 × tnt1 quits (~Thunderbi@user/tnt1) (Ping timeout: 252 seconds)
01:28:16 tnt2 is now known as tnt1
01:32:18 × califax quits (~califax@user/califx) (Remote host closed the connection)
01:34:31 califax joins (~califax@user/califx)
01:35:04 alfiee joins (~alfiee@user/alfiee)
01:36:25 xff0x joins (~xff0x@fsb6a9491c.tkyc517.ap.nuro.jp)
01:39:29 KicksonButt joins (~quassel@187.21.174.221)
01:39:33 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 252 seconds)
01:55:24 × bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Ping timeout: 264 seconds)
01:57:13 × KicksonButt quits (~quassel@187.21.174.221) (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
02:11:13 bitdex joins (~bitdex@gateway/tor-sasl/bitdex)
02:16:46 × pabs3 quits (~pabs3@user/pabs3) (Read error: Connection reset by peer)
02:17:50 pabs3 joins (~pabs3@user/pabs3)
02:23:54 × ljdarj quits (~Thunderbi@user/ljdarj) (Ping timeout: 272 seconds)
02:24:09 alfiee joins (~alfiee@user/alfiee)
02:24:49 user363627 joins (~user@user/user363627)
02:28:44 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 260 seconds)
02:28:53 × weary-traveler quits (~user@user/user363627) (Ping timeout: 244 seconds)
02:45:38 × machinedgod quits (~machinedg@d108-173-18-100.abhsia.telus.net) (Ping timeout: 252 seconds)
02:47:58 <tri> https://paste.tomsmeding.com/G0FDnu6f
02:48:36 <tri> I'm confused about the second function, how can handle still be referenced by hClose? It's already outside the lambda
02:49:27 <tri> in my first solution the second bind function >>= and >> is nested inside the lambda, so it makes sense handle is visible there
02:49:32 <Leary> No, those functions are exactly the same, only the formatting differs.
02:51:45 <tri> you mean the second function is nested >>= and >> in the lambda?
02:51:57 <tri> nesting*
02:52:24 <Leary> Yes.
02:54:33 <tri> I don't get it... my thought is >>= \content -> putStrLn content is working off of the result from the block openFile "/tmp/foo.txt" ReadMode >>= \handle -> hGetContents handle
02:55:16 <tri> but you mean it's only working off of the result of hGetContents handle inside the lambda
02:55:55 <Leary> There is no block. You can indent or unindent those lines as much as you want; Haskell doesn't care.
02:56:16 <Leary> Well, so long as you don't touch the top level.
02:57:07 <monochrom> Every lambda extends to the right as much as is legal.
02:58:11 <tri> https://paste.tomsmeding.com/t5ptrR9w
02:58:46 <tri> that's my mental model, but apparently that's wrong, and I'm still confused. I need to think a bit more...
02:59:10 <monochrom> It is a tautology that all confusions come from wrong models.
03:00:05 <monochrom> You attached too much meaning to indentation. At present, you are just formatting "\h -> foo >>= bar >> hClose h" in two ways that only humans see a difference.
03:01:46 <geekosaur> indentation does have meaning to Haskell, but only under certain conditions
03:02:01 <geekosaur> in particular, it is introduced by specifc keywords (let, where, case, do)
03:03:48 <tri> https://paste.tomsmeding.com/esi2Te6Q
03:05:57 <tri> I thought >>= will take everything before it as a single something, and feed it into the second param
03:07:28 <monochrom> Haskell is not a shell script language.
03:08:35 <Leary> `>>=` is just an operator, not special syntax. `\ <vars> -> <body>`, on the other hand, is. It wins.
03:09:58 × potatoespotatoes quits (~quassel@user/potatoespotatoes) (Ping timeout: 245 seconds)
03:10:40 potatoespotatoes joins (~quassel@130.44.147.204)
03:10:40 × potatoespotatoes quits (~quassel@130.44.147.204) (Changing host)
03:10:40 potatoespotatoes joins (~quassel@user/potatoespotatoes)
03:11:36 weary-traveler joins (~user@user/user363627)
03:12:15 alfiee joins (~alfiee@user/alfiee)
03:14:28 <tri> https://paste.tomsmeding.com/DHEbn4x0
03:15:17 <tri> So I understand how handle is visible to hClose now, it's just the non-indentation throws me off
03:15:50 × user363627 quits (~user@user/user363627) (Ping timeout: 272 seconds)
03:16:48 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 265 seconds)
03:19:04 <tri> thank you everyone
03:19:38 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Remote host closed the connection)
03:22:34 <mauke> https://paste.tomsmeding.com/EUvPtmbm
03:23:20 <monochrom> Haha Excel Haskell
03:24:43 × img quits (~img@user/img) (Quit: ZNC 1.8.2 - https://znc.in)
03:26:02 img joins (~img@user/img)
03:26:51 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
03:37:41 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 252 seconds)
03:37:41 Square2 joins (~Square@user/square)
03:40:11 <cheater> better Ex than In
03:44:55 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
03:44:58 × misterfish quits (~misterfis@84.53.85.146) (Ping timeout: 272 seconds)
03:57:32 × Raito_Bezarius quits (~Raito@wireguard/tunneler/raito-bezarius) (Ping timeout: 268 seconds)
03:58:35 Raito_Bezarius joins (~Raito@wireguard/tunneler/raito-bezarius)
04:00:03 × Taneb quits (~Taneb@runciman.hacksoc.org) (Quit: I seem to have stopped.)
04:01:15 Taneb joins (~Taneb@2001:41c8:51:10d:aaaa:0:aaaa:0)
04:01:18 alfiee joins (~alfiee@user/alfiee)
04:05:34 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 260 seconds)
04:22:40 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
04:28:53 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Remote host closed the connection)
04:33:25 × saimazoon quits (~hrtz@user/haritz) (Ping timeout: 252 seconds)
04:37:21 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
04:40:24 Smiles joins (uid551636@id-551636.lymington.irccloud.com)
04:40:35 × Unicorn_Princess quits (~Unicorn_P@user/Unicorn-Princess/x-3540542) (Remote host closed the connection)
04:41:40 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Quit: peterbecich)
04:42:17 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
04:42:40 haritz joins (~hrtz@82-69-11-11.dsl.in-addr.zen.co.uk)
04:42:41 × haritz quits (~hrtz@82-69-11-11.dsl.in-addr.zen.co.uk) (Changing host)
04:42:41 haritz joins (~hrtz@user/haritz)
04:49:21 alfiee joins (~alfiee@user/alfiee)
04:52:37 aforemny joins (~aforemny@2001:9e8:6cfe:5000:87c7:acaa:b551:71f7)
04:52:58 × aforemny_ quits (~aforemny@2001:9e8:6cdf:f800:9bf4:7ea7:4c6a:c80f) (Ping timeout: 265 seconds)
04:53:37 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 248 seconds)
04:56:44 <famubu> tomsmeding: Thanks for mentioning the LexicalNegation extension. (Sorry been away and forgot to reply).
05:07:29 × haritz quits (~hrtz@user/haritz) (Ping timeout: 248 seconds)
05:12:14 haritz joins (~hrtz@2a02:8010:65b5:0:5d9a:9bab:ee5e:b737)
05:12:18 × haritz quits (~hrtz@2a02:8010:65b5:0:5d9a:9bab:ee5e:b737) (Changing host)
05:12:18 haritz joins (~hrtz@user/haritz)
05:19:33 × Square2 quits (~Square@user/square) (Ping timeout: 268 seconds)
05:23:38 × hsw_ quits (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) (Quit: Leaving)
05:23:53 hsw joins (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net)
05:26:26 michalz joins (~michalz@185.246.207.221)
05:27:34 × haritz quits (~hrtz@user/haritz) (Ping timeout: 272 seconds)
05:27:56 × zenstoic quits (uid461840@id-461840.hampstead.irccloud.com) (Quit: Connection closed for inactivity)
05:28:25 tnt2 joins (~Thunderbi@user/tnt1)
05:29:57 × tnt1 quits (~Thunderbi@user/tnt1) (Ping timeout: 276 seconds)
05:29:57 tnt2 is now known as tnt1
05:33:23 × hsw quits (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) (Quit: Leaving)
05:33:37 hsw joins (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net)
05:36:21 Square2 joins (~Square4@user/square)
05:36:39 <albet70> is that a->b can be a function type signature?
05:37:26 alfiee joins (~alfiee@user/alfiee)
05:37:40 × hsw quits (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) (Client Quit)
05:37:54 hsw joins (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net)
05:38:41 × hsw quits (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) (Remote host closed the connection)
05:38:46 gmg joins (~user@user/gehmehgeh)
05:38:55 hsw joins (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net)
05:41:38 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 252 seconds)
05:42:18 × mhatta_ quits (~mhatta@www21123ui.sakura.ne.jp) (Quit: ZNC 1.9.1+deb2+b2 - https://znc.in)
05:42:33 × hsw quits (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net) (Client Quit)
05:42:59 hsw joins (~hsw@2001-b030-2303-0104-0172-0025-0012-0132.hinet-ip6.hinet.net)
05:50:25 misterfish joins (~misterfis@84.53.85.146)
05:52:54 haritz joins (~hrtz@2a02:8010:65b5:0:5d9a:9bab:ee5e:b737)
05:52:57 × haritz quits (~hrtz@2a02:8010:65b5:0:5d9a:9bab:ee5e:b737) (Changing host)
05:52:57 haritz joins (~hrtz@user/haritz)
05:57:24 × vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 252 seconds)
05:58:58 Anushka joins (~Anushka@101.0.63.173)
05:59:17 vanishingideal joins (~vanishing@user/vanishingideal)
06:02:12 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Remote host closed the connection)
06:02:52 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
06:07:39 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 268 seconds)
06:08:31 dgip^ joins (~dgip@108.192.66.114)
06:11:22 <ski> huh ?
06:11:39 × gmg quits (~user@user/gehmehgeh) (Remote host closed the connection)
06:12:19 gmg joins (~user@user/gehmehgeh)
06:25:50 alfiee joins (~alfiee@user/alfiee)
06:27:10 takuan joins (~takuan@d8D86B601.access.telenet.be)
06:30:01 Axma24393 joins (~Axman6@user/axman6)
06:30:02 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 252 seconds)
06:32:12 × Axman6 quits (~Axman6@user/axman6) (Ping timeout: 240 seconds)
06:36:07 lisbeths joins (uid135845@id-135845.lymington.irccloud.com)
06:39:51 <int-e> albet70: a -> b is the type of a function that takes an argument of type a and returns a result of type b
06:40:30 <int-e> (and the spaces are technically optional but highly recommended for readability)
06:40:48 <int-e> anyway. if that wasn't your question, please rephrase.
06:48:12 × gmg quits (~user@user/gehmehgeh) (Ping timeout: 264 seconds)
06:49:21 × Smiles quits (uid551636@id-551636.lymington.irccloud.com) (Quit: Connection closed for inactivity)
06:50:56 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
06:55:45 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 268 seconds)
07:03:21 chele joins (~chele@user/chele)
07:08:24 × HappyNewYear2025 quits (~newyear@2.219.56.221) (Ping timeout: 244 seconds)
07:13:54 alfiee joins (~alfiee@user/alfiee)
07:17:22 × Anushka quits (~Anushka@101.0.63.173) (Quit: Client closed)
07:18:13 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 248 seconds)
07:21:36 acidjnk_new3 joins (~acidjnk@p200300d6e7283f99c4dbaee3a15423f1.dip0.t-ipconnect.de)
07:28:00 × j1n37- quits (~j1n37@user/j1n37) (Read error: Connection reset by peer)
07:29:23 j1n37 joins (~j1n37@user/j1n37)
07:32:25 Anushka joins (~Anushka@101.0.63.173)
07:32:59 × Anushka quits (~Anushka@101.0.63.173) (Client Quit)
07:35:01 × ft quits (~ft@p4fc2a610.dip0.t-ipconnect.de) (Quit: leaving)
07:41:45 × reidrac quits (~reidrac@user/reidrac) (Quit: bye now!)
07:43:09 reidrac joins (~reidrac@user/reidrac)
07:44:48 × p3n quits (~p3n@217.198.124.246) (Quit: ZNC 1.9.1 - https://znc.in)
07:46:36 p3n joins (~p3n@2a00:19a0:3:7c:0:d9c6:7cf6:1)
07:48:52 dysthesis joins (~dysthesis@user/dysthesis)
07:51:45 eL_Bart0 joins (eL_Bart0@dietunichtguten.org)
07:52:05 haver joins (~newyear@2.219.56.221)
07:55:34 × weary-traveler quits (~user@user/user363627) (Remote host closed the connection)
07:58:01 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Quit: peterbecich)
08:00:02 × caconym quits (~caconym@user/caconym) (Quit: bye)
08:00:06 <albet70> I thought that b as result type must show before
08:01:31 caconym joins (~caconym@user/caconym)
08:01:38 alfiee joins (~alfiee@user/alfiee)
08:01:43 <int-e> :t const undefined
08:01:44 <lambdabot> b -> a
08:03:50 <ski> "must show before" ?
08:04:26 <int-e> @djinn a -> b
08:04:26 <lambdabot> -- f cannot be realized.
08:05:03 <int-e> yeah figuring out the question is still a puzzle with insufficient information
08:05:45 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 244 seconds)
08:06:13 × misterfish quits (~misterfis@84.53.85.146) (Ping timeout: 248 seconds)
08:08:58 <albet70> b must be defined somewhere, f :: a -> Int , is Ok, Int is defined, f :: a-> b -> b is Ok, even f :: a -> m b is Ok, but f :: a -> b is not
08:09:55 <ski> `a' and `b' there would be type variables, not having a global definition
08:10:06 <ski> (and ditto for `m')
08:10:23 <albet70> :t callCC
08:10:24 <lambdabot> MonadCont m => ((a -> m b) -> m a) -> m a
08:10:26 <ski> and .. it's not clear what your "is Ok" respectively "is not" means
08:11:30 <haskellbridge> <Bowuigi> I think it concerns inhabitation, ignoring the lack of constraints in "a -> m b"
08:12:03 <albet70> what is k's type in callCC $ \k -> do ...
08:12:45 <albet70> k :: (a -> m b) -> m a? or k :: a -> m b?
08:12:47 <haskellbridge> <Bowuigi> In the most general case it would be "(a -> m b) -> m a"
08:12:54 <ski> would be `a -> m b', for the particular `a' and `m' referenced by that `do ...', and by the surrounding context of that `callCC (\k -> do ...)' call
08:13:04 <ski> (and `b' is arbitrary)
08:13:30 <albet70> :t (>>=)
08:13:31 <lambdabot> Monad m => m a -> (a -> m b) -> m b
08:14:36 <haskellbridge> <Bowuigi> Oh yeah k is "a -> m b", the whole lambda is "(a -> m b) -> m a"
08:14:48 <ski> `do ...' there have type `m a', given `k' having type `a -> m b'
08:15:01 <ski> therefore `\k -> do ...' would have type `(a -> m b) -> m a'
08:15:18 <ski> and therefore `callCC (\k -> do ...)' would have type `m a'
08:16:02 × FragByte quits (~christian@user/fragbyte) (Quit: Quit)
08:16:14 <haskellbridge> <Bowuigi> The "m a" (where m is an instance of MonadCont and therefore an instance of Monad) part in the signature is why you can use the do
08:17:02 <haskellbridge> <Bowuigi> The "m a" in the lambda, I mean
08:17:26 <ski> (a possible alternative type for `callCC', which would be slightly more general, would be `MonadCont m => ((forall b. a -> m b) -> m a) -> m a'. this would be a rank-3 type, which would allow `k' to be used polymorphically, being invoked in multiple places inside `do ..', having potentially different monadic result types `b' in each place)
08:18:00 FragByte joins (~christian@user/fragbyte)
08:18:12 × Sgeo quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer)
08:21:02 <haskellbridge> <Bowuigi> Anyway, regarding the "functions that are not ok", you can know which one is inhabited (by non-bottoms) on simple cases by just looking at the type signature. This property is a corollary of parametricity
08:22:09 <haskellbridge> <Bowuigi> You mentioned that "a -> b" is not ok, this is because you have no way to get a "b" given an "a" as is. If you had some constraint that allowed this, it would be "ok"
08:24:18 <ski> similarly, `f :: a -> m b' is "not ok" (contrary to what you said), because you have no way to build an `m b', from an `a'
08:25:09 <haskellbridge> <Bowuigi> "a -> b -> b" is ok because you can get a "b" directly. In fact, any function of this type (ignoring bottoms) is equal to "\a b -> b".
08:25:45 <haskellbridge> <Bowuigi> The same can be said about "a -> b -> a" and "\a b -> a"
08:25:56 Anushka joins (~Anushka@103.158.254.201)
08:26:13 <ski> @djinn a -> b -> b
08:26:14 <lambdabot> f _ a = a
08:28:47 sord937 joins (~sord937@gateway/tor-sasl/sord937)
08:30:49 Anushka88 joins (~Anushka@2409:40f2:200a:540c:99ac:eae:949f:cdf1)
08:33:40 × Anushka quits (~Anushka@103.158.254.201) (Ping timeout: 240 seconds)
08:35:36 × Anushka88 quits (~Anushka@2409:40f2:200a:540c:99ac:eae:949f:cdf1) (Client Quit)
08:35:49 Anushka joins (~Anushka@2409:40f2:200a:540c:99ac:eae:949f:cdf1)
08:41:05 <Leary> @free bad :: a -> b
08:41:05 <lambdabot> g . bad = bad . f
08:42:45 <Leary> `True = (const True . bad) () = (bad . g) () = (const False . bad) () = False`; contradiction; QED (no `bad`).
08:43:59 <ski> is `g' `id', here ?
08:44:07 <Leary> It's anything.
08:44:36 <ski> yea, but for concreteness
08:44:57 <Leary> Let it be `id` then.
08:45:49 × Zaz_ quits (~zaz@195.89.33.222) (Quit: Client closed)
08:45:49 lortabac joins (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4)
08:46:18 <ski> (cf. `forall (x : A). P x |- exists (x : A). P x', but only if `A' is inhabited)
08:49:22 alfiee joins (~alfiee@user/alfiee)
08:49:37 merijn joins (~merijn@77.242.116.146)
08:49:37 × Anushka quits (~Anushka@2409:40f2:200a:540c:99ac:eae:949f:cdf1) (Quit: Client closed)
08:51:07 ljdarj joins (~Thunderbi@user/ljdarj)
08:51:15 gmg joins (~user@user/gehmehgeh)
08:52:22 × tzh quits (~tzh@c-76-115-131-146.hsd1.or.comcast.net) (Quit: zzz)
08:54:09 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 260 seconds)
08:55:51 <albet70> :t runKleisli
08:55:52 <lambdabot> Kleisli m a b -> a -> m b
08:56:11 machinedgod joins (~machinedg@d108-173-18-100.abhsia.telus.net)
08:57:11 Anushka joins (~Anushka@2409:40f2:200a:540c:99ac:eae:949f:cdf1)
08:57:54 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
08:58:09 × Anushka quits (~Anushka@2409:40f2:200a:540c:99ac:eae:949f:cdf1) (Client Quit)
08:59:34 × eL_Bart0 quits (eL_Bart0@dietunichtguten.org) (Ping timeout: 260 seconds)
09:00:23 lxsameer joins (~lxsameer@Serene/lxsameer)
09:01:51 Anushka joins (~Anushka@2409:40f2:200a:540c:99ac:eae:949f:cdf1)
09:01:57 euouae joins (~euouae@user/euouae)
09:02:09 <euouae> Hello when I use hls on emacs I get "SMethod_CompletionItemResolve" issues a lot and they're very annoying
09:02:12 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 252 seconds)
09:02:32 <euouae> how can I stop them? I've grepped emacs' packages source code for this and it's not popping up I think it's in the hls itself
09:02:57 <euouae> https://github.com/haskell/haskell-language-server/blob/31b8787fed05a9cad51c4a124d99c9f10fff3d7c/ghcide/test/exe/CompletionTests.hs#L566
09:03:18 dhil joins (~dhil@2a0c:b381:5bf:3500:ca67:e13c:58d1:a27e)
09:04:05 tabaqui1 joins (~root@87.200.129.102)
09:05:09 <haskellbridge> <me7itamen> https://github.com/haskell/haskell-language-server/pull/4478
09:05:30 <haskellbridge> <me7itamen> this PR had fixed it
09:05:53 <euouae> Is my hls maybe older then?
09:06:02 <tomsmeding> this was merged only 3 weeks ago
09:06:03 <euouae> I'm using 2.9.0.1
09:06:14 × m1dnight quits (~m1dnight@d8D861908.access.telenet.be) (Ping timeout: 252 seconds)
09:06:28 <haskellbridge> <me7itamen> yep, try build hls yourself
09:06:46 <tomsmeding> it's even newer than 2.10.0.0, which hasn't been released yet
09:07:06 Anushka14 joins (~Anushka@103.158.254.207)
09:07:10 <tomsmeding> building HLS is easy, build the repo and then `cabal build -w ghc-<VERSION> all`
09:07:23 <euouae> okay so I build hls, then what?
09:07:42 <euouae> how do I tell ghcup to use it? or are you suggesting that I configure emacs to use that built hls
09:07:51 <tomsmeding> or you could `ghcup compile hls -g master --ghc <VERSION>`
09:08:00 <tomsmeding> that would probably automatically register it in ghcup
09:08:05 <haskellbridge> <me7itamen> I use "ghcup compile hls -g 9b0c3c03aea0f6fe2f488abc09942414933c5200 --ghc 9.6.6"
09:08:07 <haskellbridge> <maerwald> "tell ghcup to use it"?
09:08:12 Googulator joins (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu)
09:08:30 <haskellbridge> <maerwald> you probably have to _set_ it
09:08:32 <haskellbridge> <maerwald> check the TUI
09:08:46 <tomsmeding> maerwald: I was suggesting manually `cabal build`ing a HLS, that won't appear in ghcup
09:08:57 <tomsmeding> if you do it via `ghcup compile hls` then it should, of course :)
09:09:13 <haskellbridge> <maerwald> yes, it resuses cabal store so that shouldn't be expensive
09:09:36 <tomsmeding> does it just do `cabal build` in a temporary directory on a git clone, or is there more magic involved in `ghcup compile hls`?
09:09:49 <haskellbridge> <maerwald> something like that
09:10:01 CiaoSen joins (~Jura@2a02:8071:64e1:7180:4e50:ddff:fe9b:8922)
09:10:09 <tomsmeding> simple is good
09:10:21 <haskellbridge> <maerwald> https://github.com/haskell/ghcup-hs/blob/master/lib/GHCup/HLS.hs#L359
09:10:40 × Anushka quits (~Anushka@2409:40f2:200a:540c:99ac:eae:949f:cdf1) (Ping timeout: 240 seconds)
09:10:50 <tomsmeding> fancy tracked exceptions system
09:11:07 <haskellbridge> <maerwald> I don't know if it's any use, lmao
09:11:19 <tomsmeding> I just haven't seen it before in haskell :)
09:11:41 <haskellbridge> <maerwald> https://hackage.haskell.org/package/variant
09:12:39 × AlexZenon quits (~alzenon@178.34.151.30) (Ping timeout: 268 seconds)
09:14:51 × Anushka14 quits (~Anushka@103.158.254.207) (Quit: Client closed)
09:14:54 <tomsmeding> passing `--disable-tests` is an obvious thing I'll be stealing for my own HLS builds lol
09:15:11 <tomsmeding> but yeah it looks like it does what I said, but not quite because flexibility
09:16:08 × vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 252 seconds)
09:17:17 <euouae> What's --disable-tests?
09:17:32 <tomsmeding> maerwald: `Member x xs = MemberAtIndex (IndexOf x xs) x xs` that feels... weirdly redundant?
09:17:35 <euouae> Oh to skip testing hls after its built?
09:17:42 <tomsmeding> euouae: no just to not _build_ the tests
09:17:51 <tomsmeding> I'm not running them anyway, but I'm spending CPU time building them
09:17:53 <tomsmeding> rather pointless
09:18:00 <euouae> sure
09:18:46 AlexZenon joins (~alzenon@178.34.151.30)
09:18:57 <tomsmeding> maerwald: interesting lib, thanks for the pointer
09:19:36 Smiles joins (uid551636@id-551636.lymington.irccloud.com)
09:22:01 misterfish joins (~misterfis@31-161-39-137.biz.kpn.net)
09:23:09 vanishingideal joins (~vanishing@user/vanishingideal)
09:24:50 × famubu quits (~julinuser@user/famubu) (Quit: leaving)
09:25:37 Anushka joins (~Anushka@103.158.254.207)
09:30:28 HappyNewYear2025 joins (~newyear@2.219.56.221)
09:31:13 × CiaoSen quits (~Jura@2a02:8071:64e1:7180:4e50:ddff:fe9b:8922) (Ping timeout: 244 seconds)
09:33:04 × haver quits (~newyear@2.219.56.221) (Ping timeout: 244 seconds)
09:33:44 eL_Bart0 joins (eL_Bart0@dietunichtguten.org)
09:35:10 × Anushka quits (~Anushka@103.158.254.207) (Ping timeout: 240 seconds)
09:38:26 alfiee joins (~alfiee@user/alfiee)
09:39:58 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 252 seconds)
09:41:10 <haskellbridge> <Bowuigi> What is VariantF used for? Most of the use cases I've found don't require rows with kinds other than Type (VariantF uses Type -> Type)
09:42:54 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 252 seconds)
09:45:28 merijn joins (~merijn@77.242.116.146)
09:55:01 zaz joins (~zaz@195.89.33.222)
09:56:26 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 268 seconds)
09:59:23 merijn joins (~merijn@77.242.116.146)
10:01:53 m1dnight joins (~m1dnight@d8D861908.access.telenet.be)
10:08:37 CiaoSen joins (~Jura@2a02:8071:64e1:7180:4e50:ddff:fe9b:8922)
10:12:06 kuribas joins (~user@ptr-17d51ep4791u6fgzj68.18120a2.ip6.access.telenet.be)
10:12:18 <euouae> Here's another issue, maybe someone knows, but how can I stop lsp autocomplete inside comments in emacs?
10:17:15 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Quit: WeeChat 4.4.2)
10:26:30 alfiee joins (~alfiee@user/alfiee)
10:27:00 × xff0x quits (~xff0x@fsb6a9491c.tkyc517.ap.nuro.jp) (Ping timeout: 252 seconds)
10:29:36 × dysthesis quits (~dysthesis@user/dysthesis) (Ping timeout: 264 seconds)
10:30:56 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 252 seconds)
10:44:11 haritz is now known as saimazoon
10:46:47 × m1dnight quits (~m1dnight@d8D861908.access.telenet.be) (Quit: WeeChat 3.0)
10:47:59 <tomsmeding> Bowuigi: it's used here https://hackage.haskell.org/package/variant-1.0.1/docs/Data-Variant-EADT.html where the functor is a base functor, to describe recursive types
10:49:16 <dminuoso> Mmm, what a revelation. I just (re)discovered eldoc. With LSP it's extremely useful to just set point to an identifier, and then get both the non-monomorphized *and* monomorphized type of the thing.
10:49:31 <dminuoso> Having both at your fingertips is.. awesome. :)
10:49:48 <tomsmeding> (this is the LSP "hover" feature, right?)
10:50:15 <tomsmeding> VSCode shows it if you hover over the name with the mouse; it's one of the standard LSP bindings in vim
10:50:18 <dminuoso> Presumably yes.
10:50:36 <dminuoso> With emacs its just so cool this happens automatically when you set point.
10:50:37 <tomsmeding> and yes, it is quite useful :)
10:50:45 <dminuoso> So I dont have to use my mouse to get this information
10:50:57 <tomsmeding> using the mouse is just for vscode plebs
10:51:34 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 260 seconds)
10:59:16 tnt2 joins (~Thunderbi@user/tnt1)
11:01:27 × tnt1 quits (~Thunderbi@user/tnt1) (Ping timeout: 276 seconds)
11:01:27 tnt2 is now known as tnt1
11:02:04 × CiaoSen quits (~Jura@2a02:8071:64e1:7180:4e50:ddff:fe9b:8922) (Ping timeout: 260 seconds)
11:02:45 × acidjnk_new3 quits (~acidjnk@p200300d6e7283f99c4dbaee3a15423f1.dip0.t-ipconnect.de) (Ping timeout: 248 seconds)
11:03:24 <ncf> zaz: not quite; the image of span p consists of the pairs of lists (x, y) such that all of x satisfies p and either the head of y doesn't satisfy p or y is empty
11:09:42 merijn joins (~merijn@77.242.116.146)
11:12:30 × koz quits (~koz@121.99.240.58) (Ping timeout: 276 seconds)
11:14:54 alfiee joins (~alfiee@user/alfiee)
11:16:24 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 252 seconds)
11:18:08 koz joins (~koz@121.99.240.58)
11:18:59 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 244 seconds)
11:21:15 Anushka joins (~Anushka@101.0.63.190)
11:25:19 × Anushka quits (~Anushka@101.0.63.190) (Client Quit)
11:26:33 × haskellbridge quits (~hackager@syn-024-093-192-219.res.spectrum.com) (Remote host closed the connection)
11:28:21 × Smiles quits (uid551636@id-551636.lymington.irccloud.com) (Quit: Connection closed for inactivity)
11:28:57 haskellbridge joins (~hackager@syn-024-093-192-219.res.spectrum.com)
11:28:57 ChanServ sets mode +v haskellbridge
11:29:16 xff0x joins (~xff0x@2405:6580:b080:900:36c:449b:42ad:5dc6)
11:32:27 merijn joins (~merijn@77.242.116.146)
11:35:36 × tabaqui quits (~root@167.71.80.236) (Ping timeout: 265 seconds)
11:40:14 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
11:44:30 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 246 seconds)
11:45:22 × koz quits (~koz@121.99.240.58) (Ping timeout: 252 seconds)
11:48:16 CiaoSen joins (~Jura@ip-037-201-241-067.um10.pools.vodafone-ip.de)
11:50:56 koz joins (~koz@121.99.240.58)
11:52:57 lortabac joins (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4)
11:56:51 jespada joins (~jespada@2800:a4:2243:2100:5cc9:2329:b53c:b25f)
12:03:18 alfiee joins (~alfiee@user/alfiee)
12:04:26 acidjnk_new3 joins (~acidjnk@p200300d6e7283f99c4dbaee3a15423f1.dip0.t-ipconnect.de)
12:06:04 × ljdarj quits (~Thunderbi@user/ljdarj) (Ping timeout: 260 seconds)
12:08:24 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 276 seconds)
12:10:10 m1dnight joins (~m1dnight@d8D861908.access.telenet.be)
12:25:40 tabaqui joins (~root@167.71.80.236)
12:27:27 × mange quits (~user@user/mange) (Quit: Zzz...)
12:32:31 × manwithluck` quits (~manwithlu@2a09:bac1:5be0:20::49:de) (Remote host closed the connection)
12:33:38 manwithluck` joins (~manwithlu@2a09:bac1:5be0:20::49:de)
12:35:27 × HappyNewYear2025 quits (~newyear@2.219.56.221) (Ping timeout: 244 seconds)
12:36:17 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
12:40:50 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 265 seconds)
12:44:33 sprotte24 joins (~sprotte24@p200300d16f2cc700d9ccd33fac989807.dip0.t-ipconnect.de)
12:47:46 ljdarj joins (~Thunderbi@user/ljdarj)
12:52:02 alfiee joins (~alfiee@user/alfiee)
12:53:00 otbergsten joins (~otbergste@user/otbergsten)
12:55:46 × CiaoSen quits (~Jura@ip-037-201-241-067.um10.pools.vodafone-ip.de) (Ping timeout: 252 seconds)
12:56:49 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 260 seconds)
13:00:28 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 244 seconds)
13:01:06 merijn joins (~merijn@77.242.116.146)
13:06:03 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 246 seconds)
13:06:13 merijn joins (~merijn@77.242.116.146)
13:11:53 <dminuoso> Oh here's a curious question that I come back to a few times a year. Everytime I cook up a ToField/FromField class, I generally dont want to use Show/Read for serialization as I want the freedom to rename.
13:12:29 <dminuoso> Instead I usually do something like `toField s = case s of Started -> toField "started"; Stopped -> toField "stopped"`
13:12:51 <dminuoso> Which by itself is fine, but when I write a FromField, there's the potential for typos such that they dont qlign.
13:13:21 <dminuoso> So then I keep thinking about just writing an assoc list [(Started, "started"), ("Stopped", "stopped")], but then pattern match exhaustiveness is not on my side.
13:13:42 <dminuoso> TH is an obvious solution, but its not some simple 2-liner I want to include in every poroject
13:18:36 <int-e> (bonus point if the "qlign" was intentional)
13:20:08 wootehfoot joins (~wootehfoo@user/wootehfoot)
13:28:23 × zwro quits (~z@user/zero) (Ping timeout: 252 seconds)
13:30:38 zero joins (~z@user/zero)
13:33:48 × sprotte24 quits (~sprotte24@p200300d16f2cc700d9ccd33fac989807.dip0.t-ipconnect.de) (Quit: Leaving)
13:35:23 × bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Quit: = "")
13:37:02 tnt2 joins (~Thunderbi@user/tnt1)
13:37:04 × tnt1 quits (~Thunderbi@user/tnt1) (Ping timeout: 260 seconds)
13:37:04 tnt2 is now known as tnt1
13:39:46 alfiee joins (~alfiee@user/alfiee)
13:43:19 × CryptLab quits (NSA@gateway/vpn/protonvpn/commanderbond007) (Read error: Connection reset by peer)
13:44:08 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 245 seconds)
13:46:13 CryptLab joins (NSA@gateway/vpn/protonvpn/commanderbond007)
13:46:14 × vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 244 seconds)
13:48:06 vanishingideal joins (~vanishing@user/vanishingideal)
13:55:58 × causal quits (~eric@50.35.84.231) (Quit: WeeChat 4.5.1)
13:57:00 × misterfish quits (~misterfis@31-161-39-137.biz.kpn.net) (Ping timeout: 252 seconds)
14:00:36 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
14:03:21 <haskellbridge> <Profpatsch> dminuoso: https://code.tvl.fyi/tree/users/Profpatsch/my-prelude/src/MyPrelude.hs#n695
14:04:50 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 244 seconds)
14:05:16 <dminuoso> Profpatsch: Oh, so simple and effective. I had not thought of Bounded.
14:06:33 weary-traveler joins (~user@user/user363627)
14:10:50 <haskellbridge> <Profpatsch> dminuoso: now that I think about this, since usually the difference between maxBound and minBound is small for enums, using List.elem instead of Map.elem should be better actually
14:11:02 <haskellbridge> <Profpatsch> Cause scanning a list is lower overhead at small size
14:11:07 × acidjnk_new3 quits (~acidjnk@p200300d6e7283f99c4dbaee3a15423f1.dip0.t-ipconnect.de) (Ping timeout: 268 seconds)
14:11:47 <dminuoso> Profpatsch: I think you meant List.lookup/Map.lookup rather than elem, but yeah.
14:11:52 <haskellbridge> <Profpatsch> yeah
14:11:58 <dminuoso> I've already adapted it to use Data.List and simplified it a bit.
14:12:15 <haskellbridge> <Profpatsch> I originally copied it from relude i think
14:12:32 <dminuoso> For the large general case, if you have loads of these and want optimal performance I would use TH anyway.
14:12:39 <haskellbridge> <Profpatsch> yeah
14:13:24 <haskellbridge> <Profpatsch> dminuoso: I had this as well https://hackage.haskell.org/package/pa-field-parser-0.3.0.0/docs/FieldParser.html#v:invertPretty
14:13:32 <haskellbridge> <Profpatsch> Which fits it into my actual parsing interface
14:14:21 <dminuoso> Oh that looks a little bit more dangerous, now.
14:14:49 <dminuoso> It should contain some unsafe note about how it should only be used on injective pretty functions.
14:15:13 <haskellbridge> <Profpatsch> yeah
14:15:23 <dminuoso> Cant quite imagine the usecase. What do you use it for?
14:15:30 <haskellbridge> <Profpatsch> dminuoso: but fwiw, there’s the TH slot: https://hackage.haskell.org/package/pa-field-parser-0.3.0.0/docs/FieldParser.html#v:literal
14:15:48 <haskellbridge> <Profpatsch> dminuoso: composite parsing for simple values
14:16:14 <haskellbridge> <Profpatsch> (utf8 >>> signedDecimal) :: FieldParser ByteString Integer
14:16:39 <haskellbridge> <Profpatsch> it’s super simple but surprisingly versatile
14:16:47 × otbergsten quits (~otbergste@user/otbergsten) (Remote host closed the connection)
14:16:54 <dminuoso> This is kind of cute.
14:17:10 × koz quits (~koz@121.99.240.58) (Ping timeout: 252 seconds)
14:17:20 <haskellbridge> <Profpatsch> the best abstractions are cute and kinda silly :)
14:17:25 <dminuoso> I'm doing something like this but the >>> structure follows a tree, based on parsing values.
14:17:39 <haskellbridge> <Profpatsch> yeah I experimented with this as well
14:18:01 <haskellbridge> <Profpatsch> always a trade-off between unbounded memory usage and good error messages
14:18:06 <dminuoso> (So I maintain a decoding tree, and while Im parsing Im recursing into my parser function)
14:18:22 <dminuoso> Which is important since the decoding rules are sort of passed in at runtime.
14:18:22 <haskellbridge> <Profpatsch> dminuoso: something like this? https://code.tvl.fyi/tree/users/Profpatsch/my-prelude/src/Parse.hs
14:18:52 <dminuoso> No, its definitely monadic.
14:18:54 sawilagar joins (~sawilagar@user/sawilagar)
14:18:54 <haskellbridge> <Profpatsch> I don’t like the abstraction very much, but it’s useful for e.g. parsing XML
14:19:12 <dminuoso> Though I guess I could make it work too.
14:19:27 <haskellbridge> <Profpatsch> Ah yeah, you can have a specialized "bind" function usually
14:19:34 <haskellbridge> <Profpatsch> that throws away errors
14:19:47 <haskellbridge> <Profpatsch> It nearly-but-not-quite fits
14:19:48 <dminuoso> Mine is directly bolted onto flatparse
14:19:54 <dminuoso> Because I like the sheer simplicity of that interface.
14:20:33 <dminuoso> And with that, I have this super trivial refocus function: https://gist.github.com/dminuoso/e9026b66182bd438910c895184b97ad5
14:20:40 <haskellbridge> <Profpatsch> dminuoso: I tried abstracting the pattern of creating these kinds of parsers a little with https://code.tvl.fyi/tree/users/Profpatsch/my-prelude/src/ValidationParseT.hs
14:20:44 <dminuoso> Which makes this >>> notion really simple to do.
14:20:56 <haskellbridge> <Profpatsch> but never got to a point where I think it’s super interesting for the general use-case
14:21:05 <dminuoso> (But its limited to when each stage expects a bytestring)
14:21:34 <dminuoso> Gah I find prefix Compose hard to ready.
14:21:44 <dminuoso> This should have been named :.:
14:21:53 <dminuoso> s/ready/read/
14:22:12 <dminuoso> Profpatsch: We should compare notes when I have a little more time, I gotta blaze.
14:22:20 <haskellbridge> <Profpatsch> dminuoso: fwiw I’m not talking conventional parsers (stream of tokens to data struct) but “vertical” parsers (value of high entropy to value of lower entropy)
14:22:26 <haskellbridge> <Profpatsch> 420 :)
14:22:34 <dminuoso> haskellbridge: No I get the idea of vertical parsing.
14:22:40 <dminuoso> What I do is still a kind of vertical parsing in that sense.
14:22:58 <haskellbridge> <Profpatsch> Ah, I see
14:23:18 <dminuoso> essentially it's slowly zooming into a bytestring buffer (though that zooming action sometimes includes fusing some chunks together over the parsing)
14:23:19 koz joins (~koz@121.99.240.58)
14:23:40 <dminuoso> until you reach a primitive, and then that primitive gets turned into Int, Bool, String
14:23:53 <dminuoso> Plus some labels and context as to what that Int, Bool or String is.
14:24:04 <dminuoso> (Which is just a path description of the decoding tree)
14:24:48 <dminuoso> Its just that in my parser, each step produces a bytestring buffer, and I refocus (not with the primitive I linked above, that one is a bit more special) into that slice.
14:24:52 × jespada quits (~jespada@2800:a4:2243:2100:5cc9:2329:b53c:b25f) (Quit: My Mac has gone to sleep. ZZZzzz…)
14:27:58 <euouae> I read half of the STG paper before I felt that I've been going to deep for my own good
14:28:51 <euouae> Doing some leetcode I realized I wanted something that looked a lot like lenses so I got a book on them (penner's optics by example) and after that I'll try writing a web app
14:28:51 alfiee joins (~alfiee@user/alfiee)
14:29:09 <euouae> I've already written this app in the past in Python so it'll be exciting to see how much I can improve with Haskell
14:29:40 acidjnk_new3 joins (~acidjnk@p200300d6e7283f99c4dbaee3a15423f1.dip0.t-ipconnect.de)
14:30:42 <euouae> Though lenses do make Haskell look like APL a bit, they are really cool. Like view/span of C++ but more powerful and expressive
14:31:16 CiaoSen joins (~Jura@ip-037-201-241-067.um10.pools.vodafone-ip.de)
14:33:18 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 252 seconds)
14:35:04 <dminuoso> euouae: Yeah optics/lenses are some of the most novel libraries in Haskell.
14:35:52 <dminuoso> Although I find the usecases where they outperform manual accessors are limited.
14:36:29 <euouae> by outperform are you talking about code performance or generally that they're the better tool?
14:36:40 <dminuoso> The latter.
14:36:53 <dminuoso> Execution performance is in general really good.
14:37:32 <euouae> maybe it's a style thing, but I like them personally
14:37:44 <dminuoso> But the DSL (especially all the operators) can look confusing, there's only so much %~~.! and ?!~..! that my eyes can tolerate.
14:37:45 <euouae> they do remind me also of lisp's SETF, which I also always liked but it is limited
14:38:45 <dminuoso> We have one big use case, which is a networking compiler. In our intermediate representation we have deeply nested data types (around 10 layers deep), with lists/maps, most have plenty of fields..
14:38:58 <euouae> There's ways around the wackyness of the operators, one on top of my head is to color-code them
14:39:01 <dminuoso> And `optics` gives us a tool to concisely manipulate that large structure in passes.
14:39:19 <euouae> Hmm... neat.
14:39:36 <euouae> It might not be of serious use to me but the book does teach me some haskell too in between
14:39:39 <dminuoso> euouae: In general lens/optics is best when your data is deeply nested.
14:39:54 <dminuoso> If its not, I would refrain.
14:40:08 <euouae> One thing that I didn't understand, and maybe that's some GHC extension, is, how to beat the namespace problem for the record accessors?
14:40:11 <euouae> field accesosrs
14:40:19 <dminuoso> What namespace problem?
14:40:36 <euouae> well, data X = X {name :: String} and then data Y = Y {name :: String}
14:41:00 <dminuoso> I just do what most others do: data X = X { xName :: String } and data Y = Y { yName :: String }
14:41:22 <euouae> I read that there's some new GHC extension that solves this, or maybe a proposal: <https://ghc-proposals.readthedocs.io/en/latest/proposals/0282-record-dot-syntax.html>
14:41:29 <euouae> But I also read that lenses deal with this problem, not sure how.
14:41:30 <dminuoso> I know there's a *bunch* of extensions that try and give you ways to not do that..
14:41:39 <dminuoso> But I find them all confusing.
14:41:54 <dminuoso> euouae: Oh that's quite easy.
14:42:04 <dminuoso> Very roughly you could just say
14:42:12 <dminuoso> % class HasName a where name :: a -> String
14:42:12 <yahb2> <no output>
14:42:25 <dminuoso> % data Person = Person { pName :: String; pAge :: Int }
14:42:25 <yahb2> <interactive>:137:39: error: [GHC-58481] parse error on input ‘;’
14:42:28 <dminuoso> % data Person = Person { pName :: String, pAge :: Int }
14:42:28 <yahb2> <no output>
14:42:35 <dminuoso> % instance HasName Person where name = pName
14:42:35 <yahb2> <no output>
14:43:00 <euouae> ah right, and you let polymorphicity deal with it
14:43:06 <dminuoso> euouae: This is the idea in essence. Now you can have many things and using `name :: HasName a => a -> String` you can get the name of anything that HasName.
14:43:25 <dminuoso> euouae: With lens/optics rather than extracting the name, you can just produce some kind of optic instead
14:43:33 <dminuoso> Which you can use to read *or* modify (if its a lens)
14:43:49 <dminuoso> So you might have:
14:43:49 <euouae> it would be a `HasName x => Lens' x String` right?
14:43:55 <dminuoso> Right.
14:44:04 <dminuoso> That's all there is to it.
14:44:23 <euouae> I think RecordDotSyntax lets you do x.name instead
14:44:45 <dminuoso> Like I said, I find them confusing due to interactions with other extensions.
14:44:51 <euouae> got it
14:44:59 <dminuoso> But hey, some people seem to like it?
14:45:22 <dminuoso> In my eyes RecordDotSyntax feels very unpolished and it breaks in plenty of non-trivial cases.
14:45:30 <euouae> could've chosen something else like x`name or x@name
14:45:34 <dminuoso> `optics` does not break in non-trivial cases, b
14:47:29 <mauke> [...] Like view/span of C++ <- I always thought they were a bit like C++ member pointers, at least in the trivial case
14:47:50 <mauke> first-class, composable member pointers
14:48:08 <euouae> They're very much like view/span because in both cases templates are involved & their wonderful error messages :P
14:48:41 <euouae> I just know that I've looked in the past to understand view/span better and it reminded me of them
14:53:08 × CiaoSen quits (~Jura@ip-037-201-241-067.um10.pools.vodafone-ip.de) (Ping timeout: 272 seconds)
15:09:42 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 268 seconds)
15:09:55 × prasad quits (~Thunderbi@2601:243:c001:3f07::d1) (Remote host closed the connection)
15:10:25 merijn joins (~merijn@77.242.116.146)
15:12:13 × sawilagar quits (~sawilagar@user/sawilagar) (Ping timeout: 244 seconds)
15:15:48 <dminuoso> The cool thing about lens/optics is not just that they are first class, but all their characteristics (does it target multiple things or not, is it a sum or product type, what is the larger thing and what is the smaller thing) do not just live in the type system, but the the the types change from composition is the result of some mathematics rather.
15:18:04 __monty__ joins (~toonn@user/toonn)
15:18:16 alfiee joins (~alfiee@user/alfiee)
15:20:22 × hellwolf quits (~user@262a-8508-ab6e-9670-0f00-4d40-07d0-2001.sta.estpak.ee) (Ping timeout: 272 seconds)
15:21:23 sawilagar joins (~sawilagar@user/sawilagar)
15:22:33 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 246 seconds)
15:23:01 hellwolf joins (~user@92b0-6982-e317-36c1-0f00-4d40-07d0-2001.sta.estpak.ee)
15:27:28 Square3 joins (~Square@user/square)
15:28:17 × Square2 quits (~Square4@user/square) (Ping timeout: 252 seconds)
15:29:55 misterfish joins (~misterfis@84.53.85.146)
15:36:44 × misterfish quits (~misterfis@84.53.85.146) (Ping timeout: 252 seconds)
15:44:07 tzh joins (~tzh@c-76-115-131-146.hsd1.or.comcast.net)
15:49:49 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
15:54:36 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 276 seconds)
16:03:13 <euouae> im not aware of that but if i learn them well i might look into papers too
16:03:29 <dminuoso> euouae: Well you kind of are, already.
16:03:47 <dminuoso> lens exposes this fact into your face.
16:03:57 <dminuoso> You compose any kind of optic with just function composition (.)
16:04:48 <euouae> ah, i dont know howw that works, but i was curious yes
16:04:52 <dminuoso> In a sense this applies to `optics` too, except its hidden behind a custom composition operator (%) to hide the mathematical implementation.
16:05:22 <dminuoso> That is, in optics you dont ever see any profunctors or some strange missing constraint when misusing the library
16:06:06 <dminuoso> euouae: You can derive this yourself. I have a set of simple excercises where you could come up with how they work on your own.
16:06:27 <dminuoso> If you are interested.
16:06:45 <euouae> sure, i will look together with the book
16:06:53 <dminuoso> (In fact, these are the very excercises that someone tought me with)
16:07:02 <dminuoso> taught me lenses with.
16:07:21 alfiee joins (~alfiee@user/alfiee)
16:09:03 <euouae> i thought maybe to look into the microlens implementation too
16:09:13 <dminuoso> Perhaps try and derive this yohurself first.
16:09:16 <euouae> learn fromsome real code
16:09:23 <dminuoso> Otherwise you deprive yourself of the wonders of coming up with this yhourself.
16:11:33 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Quit: WeeChat 4.4.2)
16:11:34 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 252 seconds)
16:11:40 × acidjnk_new3 quits (~acidjnk@p200300d6e7283f99c4dbaee3a15423f1.dip0.t-ipconnect.de) (Ping timeout: 272 seconds)
16:11:58 <bwe> for `Text` I define `Parser MyDataType`. But how do I parse for example a tuple `(Text, Text)`? I feel defining a function `:: (Text, Text) -> Maybe MyDataType` is not right because I can't combine it with other parsers easily. What's your take on it?
16:12:13 <bwe> …and of course, I am referring to Megaparsec
16:12:37 <dminuoso> bwe: What does this tuple encode, exactly?
16:13:27 <bwe> Tabular data. And at times stuff belonging into the second cell is being found in the first.
16:14:54 jespada joins (~jespada@2800:a4:2243:2100:5cc9:2329:b53c:b25f)
16:15:06 <dminuoso> bwe: So I know how this could be done with flatparse...
16:15:15 <dminuoso> There's this combinator I mentioned earlier that I have..
16:17:19 <bwe> …is this generally possible with Megaparsec?
16:17:32 <dminuoso> Absolutely, you can do what I do with megaparsec too.
16:18:57 <bwe> What I've got is that `Parser a` abstracts away the input that is `Text`. Therefore I conclude that I ought define another `ParserTuple a b` that abstracts away a tuple?
16:19:45 <dminuoso> Lets ignore the fact that this is a very XY problem.
16:20:30 <dminuoso> So what I have is something like `refocus :: ByteString -> Get a -> Get a` where `Get` is just some type alias over a fancy parser type.
16:20:59 <dminuoso> This just swaps out the underlying buffer, runs the parser and then stitches the continuations together
16:21:53 <dminuoso> Now you could write this for ParsecT too, that way you could do something like `let (b1, b2) = tup in try (refocus b1 $ ...) <|> try (refocus b2 $ ...)
16:22:22 <dminuoso> But it feels awkward and might not make sense if you some outer ambient parser state
16:23:08 <dminuoso> But even without ambient parser state, you could do this.
16:23:16 <bwe> Actually you are right: I am solving the wrong problem. I should better introduce a dto intermediary and from that construct a unified result based on the results.
16:24:27 <dminuoso> euouae: So imagine you have a simple 3-dimensional vector type: https://paste.tomsmeding.com/RshSBpbw
16:25:05 <dminuoso> euouae: Start by writing an instance Functor for that. Once done, give me a ping.
16:30:26 <bwe> dminuoso: How do I backtrack with Megaparsec if one parser just succeeded?
16:30:42 <dminuoso> bwe: Well you dont if it succeeds..
16:30:47 <dminuoso> Not sure what the question means
16:31:26 <bwe> dminuoso: I basically want to parse `s` again with another parser in a bigger parser function.
16:31:43 <dminuoso> What do you mean with "again"?
16:33:55 × jespada quits (~jespada@2800:a4:2243:2100:5cc9:2329:b53c:b25f) (Ping timeout: 252 seconds)
16:34:07 × pavonia quits (~user@user/siracusa) (Quit: Bye!)
16:34:35 <bwe> dminuoso: https://play.haskell.org/saved/HGeKdnSW
16:35:14 <dminuoso> bwe: Like I said, you need something like `refocus` that I mentioned above.
16:35:21 <dminuoso> Or I guess you could use `lookahead`
16:35:27 <dminuoso> Yeah that would work for you.
16:35:52 <dminuoso> do { a <- lookahead parser1; b <- parser2 ... }
16:37:04 <bwe> dminuoso: so, swapping out the underlying buffer to the beginning, that means saving the buffer before parsing, then accessing the saved value and reset it to that when I want it, right?
16:37:24 <dminuoso> bwe: If all you want is just parse without consuming, use lookahead.
16:38:15 <haskellbridge> <Bowuigi> tomsmeding re:VariantF oh, is it useful for anything else? I can cover that usecase with other features. I think it was used in an effect system at some point
16:38:32 jespada joins (~jespada@2800:a4:224d:2b00:41f1:b3c7:471b:62da)
16:41:29 <bwe> dminuoso: yeah, that's actually what lookahead is doing :). Thanks for pointing me at that.
16:42:07 <dminuoso> bwe: Note that of course *inside* the parser it consumes. Its just that `lookahead` resets the consumption state at the end.
16:42:44 haver joins (~newyear@2.219.56.221)
16:43:06 × chele quits (~chele@user/chele) (Remote host closed the connection)
16:46:04 × saimazoon quits (~hrtz@user/haritz) (Ping timeout: 260 seconds)
16:49:33 × tnt1 quits (~Thunderbi@user/tnt1) (Ping timeout: 245 seconds)
16:53:42 tnt1 joins (~Thunderbi@user/tnt1)
16:55:25 alfiee joins (~alfiee@user/alfiee)
16:58:10 tnt2 joins (~Thunderbi@user/tnt1)
16:58:29 × tnt1 quits (~Thunderbi@user/tnt1) (Ping timeout: 260 seconds)
16:58:30 tnt2 is now known as tnt1
16:59:41 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 244 seconds)
17:00:05 × machinedgod quits (~machinedg@d108-173-18-100.abhsia.telus.net) (Ping timeout: 248 seconds)
17:01:43 JuanDaugherty joins (~juan@user/JuanDaugherty)
17:01:48 × Square3 quits (~Square@user/square) (Ping timeout: 252 seconds)
17:02:53 × vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 245 seconds)
17:03:53 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
17:04:54 vanishingideal joins (~vanishing@user/vanishingideal)
17:08:24 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 252 seconds)
17:09:23 acidjnk_new3 joins (~acidjnk@p200300d6e7283f99c4dbaee3a15423f1.dip0.t-ipconnect.de)
17:13:57 haritz joins (~hrtz@82-69-11-11.dsl.in-addr.zen.co.uk)
17:13:59 × haritz quits (~hrtz@82-69-11-11.dsl.in-addr.zen.co.uk) (Changing host)
17:13:59 haritz joins (~hrtz@user/haritz)
17:22:15 sp1ff joins (~user@c-67-160-173-55.hsd1.wa.comcast.net)
17:25:38 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 252 seconds)
17:31:10 <euouae> dminuoso: this is what I have, fmap f Vec3{ v3x = x, v3y = y, v3z = z} = Vec3{ v3x = f x, v3y = f y, v3z = f z}
17:34:49 × dhil quits (~dhil@2a0c:b381:5bf:3500:ca67:e13c:58d1:a27e) (Ping timeout: 244 seconds)
17:39:54 × JuanDaugherty quits (~juan@user/JuanDaugherty) (Quit: praxis.meansofproduction.biz (juan@acm.org))
17:43:29 alfiee joins (~alfiee@user/alfiee)
17:46:57 × acidjnk_new3 quits (~acidjnk@p200300d6e7283f99c4dbaee3a15423f1.dip0.t-ipconnect.de) (Ping timeout: 268 seconds)
17:47:48 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 246 seconds)
17:51:24 × euphores quits (~SASL_euph@user/euphores) (Quit: Leaving.)
17:58:10 × kuribas quits (~user@ptr-17d51ep4791u6fgzj68.18120a2.ip6.access.telenet.be) (Ping timeout: 248 seconds)
17:59:41 × malte quits (~malte@mal.tc) (Remote host closed the connection)
18:00:37 euphores joins (~SASL_euph@user/euphores)
18:01:18 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
18:08:45 × weary-traveler quits (~user@user/user363627) (Remote host closed the connection)
18:16:26 × ChaiTRex quits (~ChaiTRex@user/chaitrex) (Quit: ChaiTRex)
18:19:12 <euouae> Well, it's ok. don't worry. I have a lot to do with this book anyway ;) I'll be busy for a while...
18:23:56 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 252 seconds)
18:29:33 Lord_of_Life_ joins (~Lord@user/lord-of-life/x-2819915)
18:29:37 × Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 248 seconds)
18:29:58 × zaz quits (~zaz@195.89.33.222) (Quit: Client closed)
18:30:18 kuribas joins (~user@ptr-17d51emaanaat95nvda.18120a2.ip6.access.telenet.be)
18:31:14 Lord_of_Life_ is now known as Lord_of_Life
18:31:52 alfiee joins (~alfiee@user/alfiee)
18:33:29 Katarushisu2 joins (~Katarushi@finc-20-b2-v4wan-169598-cust1799.vm7.cable.virginm.net)
18:33:49 × Katarushisu quits (~Katarushi@finc-20-b2-v4wan-169598-cust1799.vm7.cable.virginm.net) (Read error: Connection reset by peer)
18:33:49 Katarushisu2 is now known as Katarushisu
18:36:29 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 260 seconds)
18:36:33 × Googulator quits (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu) (Quit: Client closed)
18:36:48 Googulator joins (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu)
18:36:57 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
18:39:15 × Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 252 seconds)
18:40:29 Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915)
18:41:13 × lxsameer quits (~lxsameer@Serene/lxsameer) (Ping timeout: 268 seconds)
18:41:55 ft joins (~ft@p4fc2a610.dip0.t-ipconnect.de)
18:43:22 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 252 seconds)
18:45:02 zero is now known as zwro
18:46:28 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
18:47:33 ash3en joins (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207)
18:50:00 <tomsmeding> Bowuigi: I have no clue, I first saw the whole 'variant' package when dminuoso sent it, when was it, ereyesterday?
18:51:01 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds)
18:52:47 acidjnk_new3 joins (~acidjnk@p200300d6e7283f99c4dbaee3a15423f1.dip0.t-ipconnect.de)
18:54:14 <tomsmeding> euouae: out of the loop, but that looks like a decent Functor instance
18:55:08 × jespada quits (~jespada@2800:a4:224d:2b00:41f1:b3c7:471b:62da) (Quit: My Mac has gone to sleep. ZZZzzz…)
18:58:23 yegorc joins (~yegorc@user/yegorc)
19:01:51 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
19:04:19 × ljdarj quits (~Thunderbi@user/ljdarj) (Ping timeout: 260 seconds)
19:04:42 ljdarj joins (~Thunderbi@user/ljdarj)
19:05:43 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
19:06:41 tnt2 joins (~Thunderbi@user/tnt1)
19:07:24 × tnt1 quits (~Thunderbi@user/tnt1) (Ping timeout: 260 seconds)
19:07:25 tnt2 is now known as tnt1
19:08:24 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds)
19:09:43 × wootehfoot quits (~wootehfoo@user/wootehfoot) (Read error: Connection reset by peer)
19:10:09 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 248 seconds)
19:10:14 target_i joins (~target_i@user/target-i/x-6023099)
19:12:26 sprotte24 joins (~sprotte24@p200300d16f01b70069649c661068a391.dip0.t-ipconnect.de)
19:15:54 × yegorc quits (~yegorc@user/yegorc) (Remote host closed the connection)
19:15:56 ljdarj1 joins (~Thunderbi@user/ljdarj)
19:16:20 yegorc joins (~yegorc@user/yegorc)
19:16:43 misterfish joins (~misterfis@84.53.85.146)
19:16:58 × yegorc quits (~yegorc@user/yegorc) (Remote host closed the connection)
19:17:21 yegorc joins (~yegorc@user/yegorc)
19:18:10 <haskellbridge> <Bowuigi> Ah, I see
19:19:01 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
19:19:07 × ljdarj quits (~Thunderbi@user/ljdarj) (Ping timeout: 265 seconds)
19:19:07 ljdarj1 is now known as ljdarj
19:19:09 × yegorc quits (~yegorc@user/yegorc) (Remote host closed the connection)
19:19:23 yegorc joins (~yegorc@user/yegorc)
19:20:36 alfiee joins (~alfiee@user/alfiee)
19:21:11 × yegorc quits (~yegorc@user/yegorc) (Remote host closed the connection)
19:21:35 yegorc joins (~yegorc@user/yegorc)
19:22:28 × yegorc quits (~yegorc@user/yegorc) (Remote host closed the connection)
19:22:52 yegorc joins (~yegorc@user/yegorc)
19:24:54 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 260 seconds)
19:25:31 × yegorc quits (~yegorc@user/yegorc) (Client Quit)
19:26:04 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds)
19:27:03 × ash3en quits (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) (Quit: ash3en)
19:29:54 pavonia joins (~user@user/siracusa)
19:37:04 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
19:37:07 jespada joins (~jespada@2800:a4:224d:2b00:41f1:b3c7:471b:62da)
19:38:55 × jespada quits (~jespada@2800:a4:224d:2b00:41f1:b3c7:471b:62da) (Client Quit)
19:40:14 machinedgod joins (~machinedg@d108-173-18-100.abhsia.telus.net)
19:41:40 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
19:49:06 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
19:53:08 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
19:53:45 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
19:56:28 × acidjnk_new3 quits (~acidjnk@p200300d6e7283f99c4dbaee3a15423f1.dip0.t-ipconnect.de) (Remote host closed the connection)
19:56:52 acidjnk_new3 joins (~acidjnk@p200300d6e7283f999088022741b454a0.dip0.t-ipconnect.de)
20:00:01 × caconym quits (~caconym@user/caconym) (Quit: bye)
20:00:41 caconym joins (~caconym@user/caconym)
20:04:28 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
20:04:35 Googulator28 joins (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu)
20:07:57 × zfnmxt quits (~zfnmxt@user/zfnmxt) (Remote host closed the connection)
20:08:10 × Googulator quits (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu) (Ping timeout: 240 seconds)
20:08:22 alfiee joins (~alfiee@user/alfiee)
20:10:56 zfnmxt joins (~zfnmxt@user/zfnmxt)
20:11:54 ash3en joins (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207)
20:12:12 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
20:12:50 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 252 seconds)
20:13:40 × Googulator28 quits (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu) (Quit: Client closed)
20:13:55 Googulator28 joins (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu)
20:23:09 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
20:23:44 jespada joins (~jespada@2800:a4:224d:2b00:41f1:b3c7:471b:62da)
20:27:41 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds)
20:30:06 <dminuoso> euouae: Okay, add that function to your module. Now, another useful thing is going be a function `traverseVec :: Applicative f => (a -> f b) -> Vec a -> f (Vec b)` that takes a function of type `a -> f b` (imagine f ~ IO or f ~ Maybe, it does not matter), apply it to each value, sequence the effects and replace the values of that vector.
20:30:47 × Googulator28 quits (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu) (Quit: Client closed)
20:30:57 <dminuoso> Once you have it, we'll shortly explore how this can be useful and then proceed to the final step.
20:31:01 Googulator28 joins (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu)
20:32:30 × jespada quits (~jespada@2800:a4:224d:2b00:41f1:b3c7:471b:62da) (Quit: My Mac has gone to sleep. ZZZzzz…)
20:32:52 HappyNewYear2025 joins (~newyear@2.219.56.221)
20:34:24 × haver quits (~newyear@2.219.56.221) (Ping timeout: 244 seconds)
20:36:43 otbergsten joins (~otbergste@user/otbergsten)
20:38:30 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
20:44:33 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds)
20:46:32 malte joins (~malte@mal.tc)
20:46:55 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 252 seconds)
20:49:30 × gawen quits (~gawen@user/gawen) (Quit: cya)
20:50:05 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
20:50:48 × paotsaq quits (~paotsaq@127.209.37.188.rev.vodafone.pt) (Ping timeout: 245 seconds)
20:51:30 × ash3en quits (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) (Quit: ash3en)
20:54:05 gawen joins (~gawen@user/gawen)
20:54:20 paotsaq joins (~paotsaq@127.209.37.188.rev.vodafone.pt)
20:54:42 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
20:56:50 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
20:58:04 sprotte24_ joins (~sprotte24@p200300d16f01b7005c77723fc43a3702.dip0.t-ipconnect.de)
20:59:01 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 248 seconds)
20:59:06 alfiee joins (~alfiee@user/alfiee)
20:59:27 × kuribas quits (~user@ptr-17d51emaanaat95nvda.18120a2.ip6.access.telenet.be) (Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3))
21:00:45 × misterfish quits (~misterfis@84.53.85.146) (Ping timeout: 244 seconds)
21:01:05 × sprotte24_ quits (~sprotte24@p200300d16f01b7005c77723fc43a3702.dip0.t-ipconnect.de) (Client Quit)
21:01:42 × sprotte24 quits (~sprotte24@p200300d16f01b70069649c661068a391.dip0.t-ipconnect.de) (Ping timeout: 246 seconds)
21:03:07 sprotte24 joins (~sprotte24@p200300d16f01b7005c77723fc43a3702.dip0.t-ipconnect.de)
21:03:31 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 265 seconds)
21:08:08 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
21:10:56 × Googulator28 quits (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu) (Quit: Client closed)
21:11:08 × gawen quits (~gawen@user/gawen) (Quit: cya)
21:11:10 Googulator28 joins (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu)
21:11:52 lunitur joins (~lunitur@86.33.73.151)
21:12:52 yegorc joins (~yegorc@user/yegorc)
21:15:06 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 265 seconds)
21:15:26 × target_i quits (~target_i@user/target-i/x-6023099) (Quit: leaving)
21:15:37 gawen joins (~gawen@user/gawen)
21:19:34 × rvalue quits (~rvalue@user/rvalue) (Read error: Connection reset by peer)
21:20:08 rvalue joins (~rvalue@user/rvalue)
21:22:26 × michalz quits (~michalz@185.246.207.221) (Remote host closed the connection)
21:25:49 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
21:29:06 × vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 252 seconds)
21:30:48 × tabaqui1 quits (~root@87.200.129.102) (Ping timeout: 268 seconds)
21:30:52 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 272 seconds)
21:31:22 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
21:39:39 × dgip^ quits (~dgip@108.192.66.114) (Ping timeout: 260 seconds)
21:40:01 dgip^ joins (~dgip@108.192.66.114)
21:40:07 × takuan quits (~takuan@d8D86B601.access.telenet.be) (Remote host closed the connection)
21:41:10 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
21:42:24 <euouae> dminuoso: I can't figure that one out!
21:42:52 <euouae> I was looking at `:i Applicative` to see if I could combine any of the functions involved, also the Functor info since Vec3 is a functor
21:45:00 <dminuoso> % :t (<*>)
21:45:00 <yahb2> (<*>) :: Applicative f => f (a -> b) -> f a -> f b
21:45:08 <dminuoso> % :t (<$>))
21:45:08 <yahb2> <interactive>:1:6: error: [GHC-58481] parse error on input ‘)’
21:45:11 <dminuoso> % :t (<$>)
21:45:11 <yahb2> (<$>) :: Functor f => (a -> b) -> f a -> f b
21:45:42 <euouae> oh yeah
21:45:43 <dminuoso> euouae: You will have to use <*> and your `fmap` that you have written.
21:46:09 <dminuoso> That <$> is just an infix version that you can use if you wrote an `instance Functor Vec3 where fmap = ...`
21:46:20 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
21:46:39 <euouae> Well, <$> would take it to Vec3 (f b)
21:47:45 mange joins (~user@user/mange)
21:48:11 alfiee joins (~alfiee@user/alfiee)
21:48:43 × sord937 quits (~sord937@gateway/tor-sasl/sord937) (Quit: sord937)
21:48:44 <dminuoso> euouae: Well, all you need is what you wrote in that module, plus <*>
21:49:12 <dminuoso> Not sure what you meant by `<$> would take it to Vec3 (f b)`
21:52:34 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 252 seconds)
21:53:16 <euouae> well, fmap would take me to `Vec3 b`, e.g. `b = f c` or whatnot. I don't know how to swap Vec3 and f
21:55:38 <dminuoso> euouae: Okay, add some `data Vec1 a = Vec1 { v1x :: a }` and `data Vec2 a = Vec2 { v2x :: a, v2y :: a }` variants, implement fmap for both
21:55:48 <dminuoso> And then write such a traverse function first for Vec1, then for Vec2.
21:56:06 <dminuoso> Then it should be clearer.
21:57:03 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
21:57:14 <euouae> basicaly implement liftA3 using liftA2?
21:57:17 <euouae> for Vec3?
21:58:00 <dminuoso> euouae: Try and use <$> and <*> instead of liftA2/liftA3.
21:59:07 <dminuoso> euouae: And no.
21:59:16 <euouae> Is it `traverseVec f v = fmap f v` for Vec3? It seems like ti is
22:00:03 <euouae> oh no nevermind, the type checker was failing earlier and I didn't see
22:00:06 <dminuoso> First implement some `traverseVec1 :: Applicative f => (a -> f b) -> Vec1 a -> f (Vec1 b)`, followed by some `traverseVec2 :: Applicative f => (a -> f b) -> Vec2 a -> f (Vec2 b)`
22:00:43 <dminuoso> There's some minor detail about one of these types that we'll get to after you're done.
22:00:47 <dminuoso> (We'll simplify one of them)
22:01:18 <euouae> I dont' see how I can do it for Vec1
22:01:28 <euouae> I don't know what to do after having an `f b`
22:01:39 <euouae> oh, use the constructor with <$>?
22:01:46 <dminuoso> :-)
22:01:58 <dminuoso> euouae: Look at the types, experiment.
22:02:26 <dminuoso> All you need for this excercise until now is everything you have written, plus potentially (<*>)
22:02:52 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 268 seconds)
22:03:16 <dminuoso> But do follow your instinct with using the constructor with <$>, maybe it helps.
22:03:41 <euouae> well it worked for Vec1
22:04:57 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
22:05:12 <dminuoso> If the implementation type checked, it will be correct.
22:05:44 <dminuoso> (That does not necessarily hold true for the next ones, but the only mistake you can make would be glaringly obvious)
22:06:08 <dminuoso> euouae: Care to share your solution?
22:06:44 <euouae> I don't feel like I gain any insight from this however
22:06:55 <dminuoso> Lets have a quick look
22:06:59 <euouae> it's not the first time I've done stuff like this and it doesn't really stick with me
22:07:13 <euouae> that's all I have <https://termbin.com/25ts>
22:07:22 <euouae> the final traverseVec doesn't typecheck
22:07:37 <dminuoso> euouae: First, use <$> instead of fmap
22:07:56 <dminuoso> It will look and feel a bit nicer on traverseVec2
22:07:59 <euouae> in Vec1?
22:08:11 <dminuoso> euouae: In all the traverse things in this excercise.
22:08:34 <dminuoso> I mean you can use fmap if you insist, but there's a visual pattern that emerges if you use <$> instead.
22:09:11 <dminuoso> euouae: Ignore the Vec3 case for now. Try and do this for Vec2 instead.
22:10:44 <dminuoso> euouae: Also, I recommend for your Functor instance you write it as `fmap f (Vec3 x y z) = Vec3 (f x) (f y) (f z)`
22:11:08 <dminuoso> It helps visualize the fact that `Vec3 :: a -> a -> a -> Vec3` much better.
22:11:21 <dminuoso> Or similarly `Vec2 :: a -> a -> Vec2 a`
22:11:26 <dminuoso> Which could serve you as a hint
22:12:43 <euouae> right that's what I'm working with trying to figure out what to do with these f's that show up in the arrows a -> Vec2 a etc
22:14:24 <euouae> I got it with `traverseVec f (Vec3 x y z) = Vec3 <$> f x <*> f y <*> f z`
22:14:36 <dminuoso> Perfect
22:15:00 vanishingideal joins (~vanishing@user/vanishingideal)
22:15:17 × Googulator28 quits (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu) (Quit: Client closed)
22:15:18 <dminuoso> Now it should be obvious, there is a kind of type the type checker could not catch, namely if you mixed up the order of `f x`, `f y` and `f z`
22:15:30 Googulator28 joins (~Googulato@2a01-036d-0106-4074-758c-12a1-cbb4-05eb.pool6.digikabel.hu)
22:15:33 <dminuoso> euouae: Is it obvious how this function would be used with various choices of `f`?
22:15:39 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
22:17:24 <euouae> I'm not sure what you mean by that...
22:17:41 <euouae> how would I use it in a IO actoin for example?
22:18:24 <dminuoso> Try: traverseVec (\x -> putStrLn ("Replace " <> show x <> " with:") *> getLine) (Vec3 1 2 3)
22:18:26 <euouae> traverseVec putStrLn (Vec3 "a" "b" "c")
22:19:02 <dminuoso> Or that, sure, though putStrLn replaces it with useless values so it may not seem that obvious.
22:20:04 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
22:21:47 <dminuoso> But you can also try other effects such as Maybe, say using `\x -> if odd x then Nothing else Just (x * 10)` with some choices of numbers in the vector.
22:22:23 <dminuoso> This traverse thing lets you just run over all values, collect the effects, and rewrite the values within that effect.
22:22:48 <dminuoso> euouae: Experiment with it a bit if you want, let me know once you want the last part of the puzzle.
22:23:45 × vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 248 seconds)
22:25:46 vanishingideal joins (~vanishing@user/vanishingideal)
22:31:02 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
22:35:39 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds)
22:37:34 alfiee joins (~alfiee@user/alfiee)
22:40:13 peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com)
22:42:04 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 260 seconds)
22:42:06 Tuplanolla joins (~Tuplanoll@91-159-69-59.elisa-laajakaista.fi)
22:46:09 tri joins (~tri@ool-44c70bcb.dyn.optonline.net)
22:46:26 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
22:49:29 × __monty__ quits (~toonn@user/toonn) (Quit: leaving)
22:50:30 × tri quits (~tri@ool-44c70bcb.dyn.optonline.net) (Ping timeout: 252 seconds)
22:53:26 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 268 seconds)
22:54:46 <euouae> dminuoso: let me rain check you on that because I have to get away from the computer for a while
22:55:08 <dminuoso> euouae: We can resume this another time. See you.
22:55:53 <euouae> thank you!
23:04:30 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
23:09:40 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 272 seconds)
23:09:54 × hololeap quits (~quassel@user/hololeap) (Quit: Bye)
23:10:57 hololeap joins (~quassel@user/hololeap)
23:15:26 × peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 252 seconds)
23:19:52 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
23:24:39 × sawilagar quits (~sawilagar@user/sawilagar) (Ping timeout: 265 seconds)
23:26:59 alfiee joins (~alfiee@user/alfiee)
23:27:09 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
23:31:11 × alfiee quits (~alfiee@user/alfiee) (Ping timeout: 252 seconds)
23:39:33 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
23:44:19 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds)
23:53:47 Sgeo joins (~Sgeo@user/sgeo)
23:53:48 × otbergsten quits (~otbergste@user/otbergsten) (Remote host closed the connection)
23:54:55 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
23:59:39 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds)

All times are in UTC on 2025-02-10.