Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,801,995 events total
2025-12-02 12:27:25 × tromp quits (~textual@2001:1c00:3487:1b00:4073:6a24:b181:8b56) (Quit: My iMac has gone to sleep. ZZZzzz…)
2025-12-02 12:27:28 trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au)
2025-12-02 12:29:55 × comerijn quits (~merijn@77.242.116.146) (Ping timeout: 245 seconds)
2025-12-02 12:29:56 <[exa]> kuribas: what do you mean with arbitrary
2025-12-02 12:32:38 <[exa]> ah like, choose what routine to wait for at a given point
2025-12-02 12:34:49 × trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-12-02 12:35:27 <[exa]> seems like conduit really can't, there's no space for that in the data structure... https://hackage-content.haskell.org/package/conduit-1.3.6.1/docs/src/Data.Conduit.Internal.Pipe.html#Pipe
2025-12-02 12:36:12 <[exa]> with Streaming this is pretty simple (you can unpack multiple sources yourself) but streaming is much less coroutine-ish
2025-12-02 12:37:40 × Inline quits (~inlinE@2001-4dd3-7fc8-0-c092-91dd-c569-3f74.ipv6dyn.netcologne.de) (Ping timeout: 265 seconds)
2025-12-02 12:38:06 trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au)
2025-12-02 12:39:29 merijn joins (~merijn@77.242.116.146)
2025-12-02 12:48:00 <lucabtz> (spoiler advent of code) someone wants to comment my solution so i can improve https://paste.tomsmeding.com/0wThIO6g
2025-12-02 12:48:07 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 240 seconds)
2025-12-02 12:50:15 × AlexZenon quits (~alzenon@85.174.183.216) (Quit: ;-)
2025-12-02 12:51:37 × AlexNoo quits (~AlexNoo@85.174.183.216) (Quit: Leaving)
2025-12-02 12:54:20 merijn joins (~merijn@77.242.116.146)
2025-12-02 12:55:42 Anarchos joins (~Anarchos@91-161-254-16.subs.proxad.net)
2025-12-02 12:56:10 <kuribas> [exa]: arbitrary number or types of streams.
2025-12-02 12:57:11 <kuribas> Now that I think of it (ListT IO) or (ListT (ST s)), stored in a IORef or STRef makes for an excelent coroutine.
2025-12-02 12:57:54 <[exa]> yeah, if you don't mind losing the safety net of the streaming library around it it's IMO quite the way to go
2025-12-02 12:58:52 <[exa]> anyway I did this recently with streaming (few days back in scrollback), it's essentially this idea, except without the unnecessary ioref
2025-12-02 12:59:58 <kuribas> [exa]: you mean exceptions?
2025-12-02 13:00:37 <[exa]> yeah partially exceptions and partially having to watch who's doing what with the global ioref
2025-12-02 13:01:40 <Rembane> lucabtz: I like that one! Nice!
2025-12-02 13:02:14 <lucabtz> Rembane thanks
2025-12-02 13:02:19 <lucabtz> part 2 is a bit slow
2025-12-02 13:02:40 <lucabtz> wait or you mean the split i posted earlier
2025-12-02 13:02:43 <[exa]> lucabtz: not sure how much I'd spoil here if I give hints... but have you considered pre-splitting the numbers on input and looking at them like at pairs of intervals?
2025-12-02 13:02:48 <Rembane> lucabtz: I meant the split! :)
2025-12-02 13:03:13 <[exa]> lucabtz: in which case you should be able to avoid scanning through the whole range
2025-12-02 13:03:19 <kuribas> [exa]: would bracket help?
2025-12-02 13:03:29 <[exa]> kuribas: probably
2025-12-02 13:03:34 × trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-12-02 13:03:45 <[exa]> kuribas: sec, I'll show a piece of code that does something similar with streaming
2025-12-02 13:03:47 trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au)
2025-12-02 13:04:27 <kuribas> Streaming, ListT and Streamly all look similar.
2025-12-02 13:04:36 <[exa]> kuribas: https://paste.tomsmeding.com/L7EFsnUc
2025-12-02 13:04:37 <kuribas> ListT seems simpler, while Streamly is focussed on performance.
2025-12-02 13:07:23 <[exa]> man, streamly is huge
2025-12-02 13:08:03 Enrico63 joins (~Enrico63@host-212-171-79-170.pool212171.interbusiness.it)
2025-12-02 13:08:07 X-Scale joins (~ARM@6.67.114.89.rev.vodafone.pt)
2025-12-02 13:09:01 <lucabtz> Rembane thanks, i replace takeWhile and dropWhile with break which seemed more appropriate
2025-12-02 13:09:24 <Rembane> lucabtz: Yeah, and it should be faster, but I haven't measured.
2025-12-02 13:09:35 trickard_ is now known as trickard
2025-12-02 13:09:55 <lucabtz> i suppose it can do two operations at once right
2025-12-02 13:10:14 <[exa]> yeah it saves 1 list walk
2025-12-02 13:10:41 <lucabtz> [exa] im not sure exactly what you mean
2025-12-02 13:10:53 <[exa]> lucabtz: with the 1 list walk, or with the above hint?
2025-12-02 13:11:06 <lucabtz> no the hint, the list walk i understand
2025-12-02 13:11:40 <[exa]> okay so if I read the code right, you're taking all the numbers one by one, cut them in half and compare the halves, right?
2025-12-02 13:11:58 <lucabtz> yep
2025-12-02 13:12:10 <[exa]> <possible spoilers start>
2025-12-02 13:12:15 <lucabtz> i must say though the part cutting them in half is not slow
2025-12-02 13:12:26 <lucabtz> its the other part which is slow
2025-12-02 13:13:16 <lucabtz> tbh i havent measured but you have it basically instantly
2025-12-02 13:13:38 <lucabtz> if you want you can pm me to avoid the spoilers!
2025-12-02 13:13:45 <[exa]> ah ok
2025-12-02 13:17:02 AlexNoo joins (~AlexNoo@85.174.183.216)
2025-12-02 13:18:03 __monty__ joins (~toonn@user/toonn)
2025-12-02 13:20:13 <kuribas> [exa]: how does conduit take care of exceptions?
2025-12-02 13:21:21 × adamCS quits (~adamCS@70.19.85.77) (Remote host closed the connection)
2025-12-02 13:23:25 <[exa]> no clue tbh
2025-12-02 13:30:46 AlexZenon joins (~alzenon@85.174.183.216)
2025-12-02 13:36:38 × trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-12-02 13:39:19 trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au)
2025-12-02 13:41:05 adamCS joins (~adamCS@70.19.85.77)
2025-12-02 13:43:30 <ski> @type let mapAccumLM :: (Traversable t,Monad m) => (s -> a -> m (s,b)) -> s -> t a -> m (s,t b); mapAccumLM f s0 = fmap swap . flip runStateT s0 . traverse (StateT . (fmap swap .) . flip f) in mapAccumLM -- `mapAccumLM' ~= `traverse' on `StateT'
2025-12-02 13:43:33 <lambdabot> (Traversable t, Monad m) => (s -> a -> m (s, b)) -> s -> t a -> m (s, t b)
2025-12-02 13:54:07 tromp joins (~textual@2001:1c00:3487:1b00:4073:6a24:b181:8b56)
2025-12-02 13:54:52 sindu joins (~sindu@2.148.32.207.tmi.telenormobil.no)
2025-12-02 13:57:09 × adamCS quits (~adamCS@70.19.85.77) (Remote host closed the connection)
2025-12-02 13:58:55 adamCS joins (~adamCS@70.19.85.77)
2025-12-02 14:10:45 × Googulator7 quits (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed)
2025-12-02 14:10:51 Googulator13 joins (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu)
2025-12-02 14:11:24 × tt123160 quits (~tt1231@2603:6010:8700:4a81:a4f6:acff:fe95:3803) (Ping timeout: 260 seconds)
2025-12-02 14:18:22 × machinedgod quits (~machinedg@d75-159-126-101.abhsia.telus.net) (Remote host closed the connection)
2025-12-02 14:23:49 × pavonia quits (~user@user/siracusa) (Quit: Bye!)
2025-12-02 14:30:16 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 246 seconds)
2025-12-02 14:35:44 × user363627 quits (~user@user/user363627) (Remote host closed the connection)
2025-12-02 14:40:33 merijn joins (~merijn@77.242.116.146)
2025-12-02 14:43:07 × Googulator13 quits (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed)
2025-12-02 14:47:26 <kuribas> There is something true about haskell making hard things easy, and easy things hard.
2025-12-02 14:49:45 <merijn> kuribas: conduit just assumes you use ResourceT
2025-12-02 14:49:52 <merijn> (for exception handling)
2025-12-02 14:50:43 <kuribas> merijn: So I can just use this over IO or ST ?
2025-12-02 14:52:11 <merijn> Generally you'd use `ResourceT IO` or similar as base for conduit
2025-12-02 14:53:19 <kuribas> I mean I can use this over ListT or Streamly
2025-12-02 14:54:31 × CiaoSen quits (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 255 seconds)
2025-12-02 15:00:59 tt123160 joins (~tt1231@2603:6010:8700:4a81:a4f6:acff:fe95:3803)
2025-12-02 15:09:31 vanishingideal joins (~vanishing@user/vanishingideal)
2025-12-02 15:10:36 <kuribas> tomsmeding: the ListT version would look something like this (untested) https://gist.github.com/kuribas/bfeb96b35699d6a4f64b50f4732d62b9
2025-12-02 15:13:18 <tomsmeding> kuribas: I don't see any ListT?
2025-12-02 15:13:24 <tomsmeding> oh
2025-12-02 15:14:07 <kuribas> tomsmeding: fromFoldable and fromList
2025-12-02 15:14:36 <kuribas> ah input should be "fromFoldable input"
2025-12-02 15:15:09 <tomsmeding> and where fromList is toList?
2025-12-02 15:15:10 <kuribas> hmm, missing a "lift".
2025-12-02 15:15:53 <kuribas> right, sorry...
2025-12-02 15:15:58 <tomsmeding> kuribas: are you sure you're not confusing ListT for a writer monad?
2025-12-02 15:16:56 <kuribas> tomsmeding: That would mean another monad in the stack, no?

All times are in UTC.