2026/02/24

Newest at the top

2026-02-24 22:47:07 +0100 <newmind> .o( but it does say a lot about haskell as a language/ecosystem that we're discussing it )
2026-02-24 22:46:06 +0100 <monochrom> I am unconvinced that (putStrLn . unwords . map show) is too slow. It's only 0.05 seconds on my laptop if you redirect to a file (which is the right thing to do if you're simulating an online autotester; if you let it go to a terminal, then the bottleneck is the terminal)
2026-02-24 22:45:47 +0100 <haskellbridge> <ijouw> I want this https://hackage-content.haskell.org/package/Boolean-0.2.4/docs/Data-Boolean.html#t:OrdB and then define a function nubOrd' :: (OrdB a, BooleanOf a ~ Bool) => [a] -> [a] ; (maybe i should just not reimplement everything...)
2026-02-24 22:45:40 +0100merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) merijn
2026-02-24 22:43:02 +0100Arsen(16abab341f@gentoo/developer/managarm.dev.Arsen) Arsen
2026-02-24 22:37:42 +0100 <EvanR> maybe you need ways to lift library functions like nubOrdOn into your DSL
2026-02-24 22:36:58 +0100 <tomsmeding> it kind of sounds like you'll need to be a bit more specific here
2026-02-24 22:36:26 +0100 <haskellbridge> <ijouw> I want to use type families to allow the return type to be wrapped for DSL stuff
2026-02-24 22:35:41 +0100 <EvanR> if you're trying to define an alternate Ord instance, that's what newtypes are for, then you use Ord
2026-02-24 22:35:11 +0100 <EvanR> you want it to work on a variable class?
2026-02-24 22:35:02 +0100merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) (Ping timeout: 268 seconds)
2026-02-24 22:34:57 +0100 <EvanR> MyOrd ?
2026-02-24 22:34:25 +0100 <EvanR> not N
2026-02-24 22:34:21 +0100 <EvanR> oh it's only 2 lines
2026-02-24 22:34:07 +0100 <haskellbridge> <ijouw> It obviously does not work on MyOrd a => [a], and specifying MyOrd a, Ord a => [a] makes MyOrd seem pointless
2026-02-24 22:34:07 +0100 <tomsmeding> EvanR: yes, "YES" and 2 more ints
2026-02-24 22:33:46 +0100 <EvanR> yeah but it has to print a lot more than that in that case, so someone trying to replicate your running time is going to undershoot by a lot
2026-02-24 22:33:09 +0100jreicher(~joelr@user/jreicher) jreicher
2026-02-24 22:32:50 +0100 <lantti> It does need to print out 10^6 ints in the case n = 10^6. But thanks for the tips, i'll try some out and see if that makes a difference.
2026-02-24 22:32:41 +0100 <haskellbridge> <ijouw> Filters duplicates by sorting
2026-02-24 22:32:40 +0100 <EvanR> what is the trouble?
2026-02-24 22:32:29 +0100jreicher(~joelr@user/jreicher) (Ping timeout: 252 seconds)
2026-02-24 22:32:26 +0100 <haskellbridge> <ijouw> i meant this: nubOrdOn :: Ord b => (a -> b) -> [a] -> [a]
2026-02-24 22:31:52 +0100aka_dude(~aka_dude@192.71.166.120)
2026-02-24 22:31:32 +0100 <lambdabot> error: [GHC-88464] Variable not in scope: nubOn
2026-02-24 22:31:31 +0100 <lambdabot> :)
2026-02-24 22:31:20 +0100 <EvanR> @botsnack
2026-02-24 22:31:02 +0100 <EvanR> :t nubOn
2026-02-24 22:30:24 +0100 <haskellbridge> <ijouw> Is there a good way to define a more general Ord class that avoids troubles with functions using Ordered argumens like nubOn?
2026-02-24 22:30:17 +0100merijn(~merijn@host-cl.cgnat-g.v4.dfn.nl) merijn
2026-02-24 22:29:33 +0100 <EvanR> ok it doesn't seem to be trying to print out literally 10^6 ints but the program is more complex than that
2026-02-24 22:28:09 +0100 <lantti> in each run
2026-02-24 22:27:55 +0100 <lantti> so basically two runs of consecutive ints with one exception
2026-02-24 22:27:17 +0100 <lantti> the whole task is that one: https://cses.fi/alon/task/1092/
2026-02-24 22:26:32 +0100 <EvanR> are they particularly uniform ints or like up to 3 digits or
2026-02-24 22:26:07 +0100 <lantti> oops, 1000000
2026-02-24 22:25:54 +0100 <EvanR> 10^7 ints
2026-02-24 22:25:51 +0100cbarrett(sid192934@id-192934.helmsley.irccloud.com) cbarrett
2026-02-24 22:25:39 +0100cbarrett(sid192934@id-192934.helmsley.irccloud.com) (Server closed connection)
2026-02-24 22:25:35 +0100 <lantti> I can't figure out the profiling under stack right now, but unix time command for the 10000000 Ints case gives 0.8s
2026-02-24 22:25:04 +0100 <EvanR> requiring us to do artifically additional buffering wtf
2026-02-24 22:24:47 +0100 <EvanR> hopefully evaluate doesn't first take an MVar before evaluating xD
2026-02-24 22:23:24 +0100 <lambdabot> Foldable t => t b -> IO ()
2026-02-24 22:23:22 +0100 <mauke> :t mapM_ evaluate
2026-02-24 22:20:42 +0100 <tomsmeding> that's the dual version :p
2026-02-24 22:20:32 +0100 <EvanR> .oO( replace the printing with just evaluating the ints in sequence )
2026-02-24 22:20:01 +0100 <newmind> that was my second suggestion, replacing ints with [1..100000] or something
2026-02-24 22:19:21 +0100 <tomsmeding> further tip: benchmark your code but setting `ints = replicate 100000 123456789` or something, just to double-check it's actually the printing that's slow, not the computation preceding it
2026-02-24 22:19:01 +0100aka_dude(~aka_dude@2a03:f80:30:f490::1) (Remote host closed the connection)
2026-02-24 22:18:19 +0100morj_away(~morj@user/morj) (Quit: Konversation terminated!)