Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,804,461 events total
2025-08-20 13:33:19 <dutchie> weird defaulting rules?
2025-08-20 13:33:30 <yin> defaulting to what?
2025-08-20 13:33:51 <dutchie> :t fix (pure (1:))
2025-08-20 13:33:52 <lambdabot> Num a => [a] -> [a]
2025-08-20 13:33:52 <int-e> yin: ghci binds `it` to the result of the last action. The `pure` puts the value into IO so that ghci doesn't attempt to print it.
2025-08-20 13:35:18 <int-e> If the expression is not an IO action, ghci will wrap it in `print`. (I don't know how exactly this works in detail.)
2025-08-20 13:35:59 <yin> > pure print
2025-08-20 13:36:01 <lambdabot> error:
2025-08-20 13:36:01 <lambdabot> • Ambiguous type variable ‘f0’ arising from a use of ‘show_M471017818634...
2025-08-20 13:36:01 <lambdabot> prevents the constraint ‘(Show
2025-08-20 13:36:22 <int-e> so you get two different behavior. 1) the expression is an IO action, and ghci does the equivlane tof `it <- expr`, and 2) it's not, and ghci does the equivlane of `let it = expr; print it`
2025-08-20 13:36:32 <int-e> "it" is weird.
2025-08-20 13:36:51 <yin> weird it is
2025-08-20 13:36:53 <int-e> > fix (1:)
2025-08-20 13:36:54 <lambdabot> [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1...
2025-08-20 13:37:40 <int-e> huh, "equivlane tof" -- that's a lot of transpositions
2025-08-20 13:38:09 <yin> my ghci doesn't complain about `pure print` and it gives it type `() -> IO ()`
2025-08-20 13:39:23 <int-e> right, that's defaulting the Show instance in Show a => a -> IO ()
2025-08-20 13:40:41 × DragonMaus quits (~dragonmau@user/dragonmaus) (Server closed connection)
2025-08-20 13:40:51 DragonMaus joins (~dragonmau@user/dragonmaus)
2025-08-20 13:43:15 kilt joins (~yin@104.74.114.89.rev.vodafone.pt)
2025-08-20 13:44:47 <kilt> i feel like this could be a scanl or something more elegant but i'm getting my head in a knot
2025-08-20 13:44:50 <kilt> https://paste.tomsmeding.com/eG961Z4A
2025-08-20 13:45:13 <kilt> right now m and n don't typecheck
2025-08-20 13:45:53 × notzmv quits (~umar@user/notzmv) (Read error: Connection reset by peer)
2025-08-20 13:46:55 <kilt> but the intention is clear i think
2025-08-20 13:49:00 <kilt> here's a working version
2025-08-20 13:49:02 <kilt> https://paste.tomsmeding.com/cbKSu9qY
2025-08-20 13:49:47 <int-e> :t Data.Either.partitionEithers
2025-08-20 13:49:48 <lambdabot> [Either a b] -> ([a], [b])
2025-08-20 13:51:12 <yin> int-e: that's nice!
2025-08-20 13:51:20 <int-e> (note the order of the results)
2025-08-20 13:52:32 <kilt> yes, but still my question is more about the general structure of the function
2025-08-20 13:53:22 <kilt> it feels like this could be a foldl or at least a scanl but i'm fighting my brain at this point
2025-08-20 13:54:06 <yin> what's Scan?
2025-08-20 13:55:06 <kilt> type Scan = [Point] ; match :: Scan -> Scan -> Either Scan Scan
2025-08-20 13:55:33 <jreicher> Someone has to write a "Fun with fixed points" blog entry after all this
2025-08-20 13:56:01 <yin> kilt: that <> can turn into a : to get rid of the concat, i think
2025-08-20 13:56:37 <int-e> kilt: without knowing anything about what `match` does this looks fine (though potentially expensive or even non-terminating)
2025-08-20 13:57:08 <int-e> well, `nub` is a bit of a red flag when it comes to performance, too
2025-08-20 13:58:11 <yin> wait nvm
2025-08-20 13:58:46 <int-e> recursive calls of `go` can have non-singleton lists as arguments for ms, I think.
2025-08-20 13:59:00 <yin> yep i was wrong
2025-08-20 13:59:23 <kilt> it feels so much like a scanl
2025-08-20 14:00:31 <int-e> kilt: So two answers. 1) that code looks fine to me for what it is. 2) there's a good chance that this isn't the best algorithm for what you're actually doing, but I don't know what the task is.
2025-08-20 14:02:52 <kilt> i'm solving https://adventofcode.com/2021/day/19 : https://paste.tomsmeding.com/HHbUgiGp
2025-08-20 14:04:35 <kilt> wellm, trying to...
2025-08-20 14:05:25 weary-traveler joins (~user@user/user363627)
2025-08-20 14:08:35 × troydm quits (~troydm@user/troydm) (Server closed connection)
2025-08-20 14:08:36 poscat joins (~poscat@user/poscat)
2025-08-20 14:08:58 troydm joins (~troydm@user/troydm)
2025-08-20 14:10:07 × poscat0x04 quits (~poscat@user/poscat) (Ping timeout: 256 seconds)
2025-08-20 14:13:54 × gabriel_sevecek quits (~gabriel@188-167-229-200.dynamic.chello.sk) (Ping timeout: 252 seconds)
2025-08-20 14:15:06 gabriel_sevecek joins (~gabriel@188-167-229-200.dynamic.chello.sk)
2025-08-20 14:23:46 Square2 joins (~Square@user/square)
2025-08-20 14:25:19 humasect joins (~humasect@dyn-192-249-132-90.nexicom.net)
2025-08-20 14:26:10 <int-e> kilt: looks superficially correct. here's a problem in the details: \(x,y,z) -> (x,z,y) is a reflection
2025-08-20 14:27:02 <int-e> (same for the other two odd permutations)
2025-08-20 14:27:07 × Square quits (~Square4@user/square) (Ping timeout: 256 seconds)
2025-08-20 14:32:32 × tromp quits (~textual@2001:1c00:3487:1b00:9c04:acc7:66ee:fca9) (Quit: My iMac has gone to sleep. ZZZzzz…)
2025-08-20 14:33:55 × Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine)
2025-08-20 14:34:03 × srk_ quits (~sorki@user/srk) (Remote host closed the connection)
2025-08-20 14:34:47 srk_ joins (~sorki@user/srk)
2025-08-20 14:36:17 × humasect quits (~humasect@dyn-192-249-132-90.nexicom.net) (Quit: Leaving...)
2025-08-20 14:42:24 Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915)
2025-08-20 15:00:45 <kilt> so is it
2025-08-20 15:07:13 × chele quits (~chele@user/chele) (Remote host closed the connection)
2025-08-20 15:09:48 × qqe quits (~qqq@185.54.20.59) (Read error: Connection reset by peer)
2025-08-20 15:10:17 qqe joins (~qqq@185.54.20.59)
2025-08-20 15:12:40 × jackdk quits (uid373013@cssa/life/jackdk) (Quit: Connection closed for inactivity)
2025-08-20 15:16:09 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:55ab:e185:7f81:54a4) (Quit: WeeChat 4.5.2)
2025-08-20 15:16:26 × ttybitnik quits (~ttybitnik@user/wolper) (Quit: Fading out...)
2025-08-20 15:17:34 × fp quits (~Thunderbi@wireless-86-50-140-217.open.aalto.fi) (Ping timeout: 256 seconds)
2025-08-20 15:43:47 × qqe quits (~qqq@185.54.20.59) (Read error: Connection reset by peer)
2025-08-20 15:44:38 qqe joins (~qqq@185.54.20.59)
2025-08-20 15:46:24 humasect joins (~humasect@dyn-192-249-132-90.nexicom.net)
2025-08-20 15:46:56 × tomku quits (~tomku@user/tomku) (Server closed connection)
2025-08-20 15:47:03 smalltalkman joins (uid545680@id-545680.hampstead.irccloud.com)
2025-08-20 15:47:10 tomku joins (~tomku@user/tomku)
2025-08-20 15:47:33 × Frostillicus quits (~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net) (Remote host closed the connection)
2025-08-20 15:47:55 Frostillicus joins (~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net)
2025-08-20 15:48:12 × bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Ping timeout: 272 seconds)
2025-08-20 15:50:09 × dsal quits (sid13060@id-13060.lymington.irccloud.com) (Server closed connection)
2025-08-20 15:50:20 dsal joins (sid13060@id-13060.lymington.irccloud.com)
2025-08-20 15:54:40 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 244 seconds)
2025-08-20 15:54:50 kaankeskin joins (~kaankeski@user/kaankeskin)
2025-08-20 15:55:18 merijn joins (~merijn@77.242.116.146)
2025-08-20 15:56:11 notzmv joins (~umar@user/notzmv)
2025-08-20 15:58:07 × Lycurgus quits (~juan@user/Lycurgus) (Quit: alsoknownas.renjuan.org ( juan@acm.org ))
2025-08-20 16:06:20 ttybitnik joins (~ttybitnik@user/wolper)
2025-08-20 16:06:27 tromp joins (~textual@2001:1c00:3487:1b00:9c04:acc7:66ee:fca9)
2025-08-20 16:07:53 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 245 seconds)
2025-08-20 16:08:18 merijn joins (~merijn@77.242.116.146)
2025-08-20 16:11:26 tccq joins (~user@user/tccq)
2025-08-20 16:13:05 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 256 seconds)
2025-08-20 16:13:16 × Frostillicus quits (~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net) (Ping timeout: 255 seconds)
2025-08-20 16:14:24 Frostillicus joins (~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net)
2025-08-20 16:19:52 × amadaluzia quits (~amadaluzi@user/amadaluzia) (Quit: ZNC 1.9.1 - https://znc.in)
2025-08-20 16:20:09 amadaluzia joins (~amadaluzi@user/amadaluzia)
2025-08-20 16:27:50 × Frostillicus quits (~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net) (Ping timeout: 256 seconds)

All times are in UTC.