Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,802,015 events total
2025-12-02 10:16:18 marinelli joins (~weechat@gateway/tor-sasl/marinelli)
2025-12-02 10:16:41 <kuribas> :t \f l -> concat $ flip runState 1 $ traverse (StateT . f) l
2025-12-02 10:16:42 <lambdabot> (Num [a1], Traversable t) => (a2 -> [a1] -> Identity (b, [a1])) -> t a2 -> [a1]
2025-12-02 10:16:44 × vgtw quits (~vgtw@user/vgtw) (Ping timeout: 244 seconds)
2025-12-02 10:16:58 <tomsmeding> kuribas: I don't see how ListT is relevant here, but then I don't really understand your usecase yet; ListT is for nondeterminism
2025-12-02 10:17:16 <tomsmeding> or "cartesian product of the possibilities"
2025-12-02 10:17:46 <kuribas> tomsmeding: I just wanted to use bind (>>=), but with a monad stack. Like a list comprehension with state.
2025-12-02 10:18:14 <tomsmeding> is it that you want to loop over a list with some state, and while doing so, generate values to be stored in a returned list at the end?
2025-12-02 10:18:14 CiaoSen joins (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db)
2025-12-02 10:18:24 <kuribas> yeah
2025-12-02 10:18:43 <tomsmeding> this? https://paste.tomsmeding.com/r70Fuwb3
2025-12-02 10:19:10 <kuribas> tomsmeding: yes :)
2025-12-02 10:19:21 <tomsmeding> instantiate m to State and roll
2025-12-02 10:20:06 <tomsmeding> note the swap because mapAccumL and runState do not agree on which part of the pair should go which way :p
2025-12-02 10:20:37 × Googulator26 quits (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed)
2025-12-02 10:20:47 Googulator26 joins (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu)
2025-12-02 10:21:00 vgtw joins (~vgtw@user/vgtw)
2025-12-02 10:22:13 <tomsmeding> uh, no, don't instantiate m to State
2025-12-02 10:22:21 <tomsmeding> the state is already there, lol
2025-12-02 10:22:45 <tomsmeding> anyway this is a function that I needed at some point and couldn't find in the standard libraries
2025-12-02 10:24:19 <kuribas> Another interesting solution would be to use coroutines, and have one routine for generating the tables aliases.
2025-12-02 10:24:34 × xff0x quits (~xff0x@fsb6a9491c.tkyc517.ap.nuro.jp) (Ping timeout: 246 seconds)
2025-12-02 10:24:43 acidjnk joins (~acidjnk@p200300d6e71719443da791614ae70cbb.dip0.t-ipconnect.de)
2025-12-02 10:24:45 <tomsmeding> and 'send out' the aliases to the coroutine via a channel?
2025-12-02 10:25:15 <kuribas> yes
2025-12-02 10:25:35 <kuribas> I just feel like all of this is more complicated than equivalent python.
2025-12-02 10:25:59 <tomsmeding> my knowledge of funny programming languages is not large enough to be able to point to which one, but I feel like there's a language where this would be the "neat" solution
2025-12-02 10:26:06 <tomsmeding> I don't think it's Haskell :p
2025-12-02 10:27:22 × vgtw quits (~vgtw@user/vgtw) (Ping timeout: 246 seconds)
2025-12-02 10:29:42 <kuribas> python would be something like this: https://gist.github.com/kuribas/bfeb96b35699d6a4f64b50f4732d62b9
2025-12-02 10:30:24 vgtw joins (~vgtw@user/vgtw)
2025-12-02 10:30:56 <tomsmeding> I see you haven't been programming python recently with the syntax errors, but otherwise yes :p
2025-12-02 10:31:05 <tomsmeding> although the 'break' may be tricky
2025-12-02 10:31:18 <kuribas> actually I have
2025-12-02 10:31:31 <tomsmeding> (= instead of ==, elif instead of else if)
2025-12-02 10:31:38 <kuribas> elif is valid python
2025-12-02 10:31:42 <tomsmeding> is it?
2025-12-02 10:31:51 <tomsmeding> oh right
2025-12-02 10:32:04 <tomsmeding> then what's github's syntax highlighter up about
2025-12-02 10:32:15 <kuribas> I forgot a colon.
2025-12-02 10:32:23 <tomsmeding> oh
2025-12-02 10:37:15 × vgtw quits (~vgtw@user/vgtw) (Ping timeout: 240 seconds)
2025-12-02 10:37:35 × comerijn quits (~merijn@77.242.116.146) (Ping timeout: 240 seconds)
2025-12-02 10:37:35 vgtw joins (~vgtw@user/vgtw)
2025-12-02 10:38:39 <Leary> kuribas: How about `foldA :: (Foldable t, Applicative f, Monoid b) => (a -> f b) -> t a -> f b; foldA f = getAp . foldMap (Ap . f)`? `f` can be `State s`, `b` can be a list ...
2025-12-02 10:38:49 <Leary> Or flip the args and call it `forA`, even better.
2025-12-02 10:39:43 × tromp quits (~textual@2001:1c00:3487:1b00:4073:6a24:b181:8b56) (Quit: My iMac has gone to sleep. ZZZzzz…)
2025-12-02 10:40:19 haritz joins (~hrtz@140.228.70.141)
2025-12-02 10:40:19 × haritz quits (~hrtz@140.228.70.141) (Changing host)
2025-12-02 10:40:19 haritz joins (~hrtz@user/haritz)
2025-12-02 10:42:46 trickard_ is now known as trickard
2025-12-02 10:44:25 <kuribas> foldmap?
2025-12-02 10:45:42 <Leary> Yes, `foldMap`. It sure doesn't sound like you need `traverse`.
2025-12-02 10:45:47 dhil joins (~dhil@5.151.29.141)
2025-12-02 10:46:02 tromp joins (~textual@2001:1c00:3487:1b00:4073:6a24:b181:8b56)
2025-12-02 10:49:49 <kuribas> :t ala
2025-12-02 10:49:51 <lambdabot> (Functor f, Rewrapping s t) => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s)
2025-12-02 10:50:30 <kuribas> :t alaf Ap foldMap
2025-12-02 10:50:32 <lambdabot> k1} {a}. (Foldable t, Monoid (Ap g b)) => (a -> g b) -> t a -> g b
2025-12-02 10:50:34 merijn joins (~merijn@77.242.116.146)
2025-12-02 10:50:50 × Googulator26 quits (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed)
2025-12-02 10:50:51 Googulator56 joins (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu)
2025-12-02 10:51:46 <kuribas> :t alaf StateT traverse
2025-12-02 10:51:48 <lambdabot> (Traversable t, Monad m') => (a -> s' -> m' (a', s')) -> t a -> s' -> m' (t a', s')
2025-12-02 11:05:38 <kuribas> :t alaf state traverse
2025-12-02 11:05:40 <lambdabot> (Unwrapped (m (t b)) ~ (s -> (t b, s)), Rewrapped (m b) (m (t b)), Rewrapped (m (t b)) (m b), MonadState s m, Traversable t) => (a -> Unwrapped (m b)) -> t a -> Unwrapped (m (t b))
2025-12-02 11:06:53 <kuribas> I have a haskell script that I made for my own use. But there may be interest, though like not haskell :-(
2025-12-02 11:07:08 <kuribas> I could 1) dockerize it, 2) rewrite in python/clojure/...
2025-12-02 11:08:40 × energizer quits (~energizer@user/energizer) (Quit: ZNC 1.7.0+deb0+xenial1 - https://znc.in)
2025-12-02 11:10:22 poscat0x04 joins (~poscat@user/poscat)
2025-12-02 11:11:02 energizer joins (~energizer@user/energizer)
2025-12-02 11:11:15 × poscat quits (~poscat@user/poscat) (Ping timeout: 240 seconds)
2025-12-02 11:11:36 wbooze joins (~wbooze@cgn-195-14-217-157.nc.de)
2025-12-02 11:15:32 × trickard quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-12-02 11:15:47 trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au)
2025-12-02 11:16:40 × wbooze quits (~wbooze@cgn-195-14-217-157.nc.de) (Quit: Leaving)
2025-12-02 11:17:50 wbooze joins (~wbooze@cgn-195-14-217-157.nc.de)
2025-12-02 11:20:42 × Googulator56 quits (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed)
2025-12-02 11:20:49 Googulator7 joins (~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu)
2025-12-02 11:22:36 xff0x joins (~xff0x@2405:6580:b080:900:b577:52ee:470:5943)
2025-12-02 11:27:25 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 245 seconds)
2025-12-02 11:35:24 <kuribas> Is there a corouting library that can allow you to take arbitrary routines as argument?
2025-12-02 11:35:45 <kuribas> Instead of "x <- await", "x <- await routineA".
2025-12-02 11:36:52 ttybitnik joins (~ttybitnik@user/wolper)
2025-12-02 11:39:06 <kuribas> conduit can only await from a single source
2025-12-02 11:51:55 <kuribas> Maybe just a ST or IO monad, with Streamly or ListT stored into IORefs.
2025-12-02 11:54:52 × Inline quits (~inlinE@2001-4dd3-7fc8-0-2be-fec0-ba58-7d11.ipv6dyn.netcologne.de) (Ping timeout: 246 seconds)
2025-12-02 11:56:54 merijn joins (~merijn@77.242.116.146)
2025-12-02 11:58:04 Digitteknohippie is now known as Digit
2025-12-02 12:03:29 Inline joins (~inlinE@2001-4dd3-7fc8-0-c092-91dd-c569-3f74.ipv6dyn.netcologne.de)
2025-12-02 12:03:29 × trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-12-02 12:06:12 trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au)
2025-12-02 12:11:52 humasect joins (~humasect@dyn-192-249-132-90.nexicom.net)
2025-12-02 12:14:14 × trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-12-02 12:16:05 × confusedalex quits (~confuseda@user/confusedalex) (Remote host closed the connection)
2025-12-02 12:17:04 × humasect quits (~humasect@dyn-192-249-132-90.nexicom.net) (Ping timeout: 260 seconds)
2025-12-02 12:17:10 trickard_ joins (~trickard@cpe-85-98-47-163.wireline.com.au)
2025-12-02 12:18:06 comerijn joins (~merijn@77.242.116.146)
2025-12-02 12:20:31 × trickard_ quits (~trickard@cpe-85-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-12-02 12:20:35 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 240 seconds)

All times are in UTC.