2025/12/02

Newest at the top

2025-12-02 11:29:42 +0100 <kuribas> python would be something like this: https://gist.github.com/kuribas/bfeb96b35699d6a4f64b50f4732d62b9
2025-12-02 11:27:22 +0100vgtw(~vgtw@user/vgtw) (Ping timeout: 246 seconds)
2025-12-02 11:26:06 +0100 <tomsmeding> I don't think it's Haskell :p
2025-12-02 11:25:59 +0100 <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 11:25:35 +0100 <kuribas> I just feel like all of this is more complicated than equivalent python.
2025-12-02 11:25:15 +0100 <kuribas> yes
2025-12-02 11:24:45 +0100 <tomsmeding> and 'send out' the aliases to the coroutine via a channel?
2025-12-02 11:24:43 +0100acidjnk(~acidjnk@p200300d6e71719443da791614ae70cbb.dip0.t-ipconnect.de) acidjnk
2025-12-02 11:24:34 +0100xff0x(~xff0x@fsb6a9491c.tkyc517.ap.nuro.jp) (Ping timeout: 246 seconds)
2025-12-02 11:24:19 +0100 <kuribas> Another interesting solution would be to use coroutines, and have one routine for generating the tables aliases.
2025-12-02 11:22:45 +0100 <tomsmeding> anyway this is a function that I needed at some point and couldn't find in the standard libraries
2025-12-02 11:22:21 +0100 <tomsmeding> the state is already there, lol
2025-12-02 11:22:13 +0100 <tomsmeding> uh, no, don't instantiate m to State
2025-12-02 11:21:00 +0100vgtw(~vgtw@user/vgtw) vgtw
2025-12-02 11:20:47 +0100Googulator26(~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu)
2025-12-02 11:20:37 +0100Googulator26(~Googulato@2a01-036d-0106-4ad8-d9ec-010d-f188-ffcb.pool6.digikabel.hu) (Quit: Client closed)
2025-12-02 11:20:06 +0100 <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 11:19:21 +0100 <tomsmeding> instantiate m to State and roll
2025-12-02 11:19:10 +0100 <kuribas> tomsmeding: yes :)
2025-12-02 11:18:43 +0100 <tomsmeding> this? https://paste.tomsmeding.com/r70Fuwb3
2025-12-02 11:18:24 +0100 <kuribas> yeah
2025-12-02 11:18:14 +0100CiaoSen(~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) CiaoSen
2025-12-02 11:18:14 +0100 <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 11:17:46 +0100 <kuribas> tomsmeding: I just wanted to use bind (>>=), but with a monad stack. Like a list comprehension with state.
2025-12-02 11:17:16 +0100 <tomsmeding> or "cartesian product of the possibilities"
2025-12-02 11:16:58 +0100 <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 11:16:44 +0100vgtw(~vgtw@user/vgtw) (Ping timeout: 244 seconds)
2025-12-02 11:16:42 +0100 <lambdabot> (Num [a1], Traversable t) => (a2 -> [a1] -> Identity (b, [a1])) -> t a2 -> [a1]
2025-12-02 11:16:41 +0100 <kuribas> :t \f l -> concat $ flip runState 1 $ traverse (StateT . f) l
2025-12-02 11:16:18 +0100marinelli(~weechat@gateway/tor-sasl/marinelli) marinelli
2025-12-02 11:16:06 +0100 <kuribas> sorry...
2025-12-02 11:16:02 +0100 <kuribas> ah wait, it's StateT ...
2025-12-02 11:15:56 +0100marinelli(~weechat@gateway/tor-sasl/marinelli) (Remote host closed the connection)
2025-12-02 11:15:46 +0100 <tomsmeding> oh your were complaining about "type constructor"
2025-12-02 11:15:24 +0100 <kuribas> tomsmeding: https://hackage.haskell.org/package/mtl-2.3.1/docs/Control-Monad-State-Lazy.html#t:State
2025-12-02 11:14:29 +0100 <lambdabot> (Traversable t, Num [a1]) => (a2 -> [a1] -> (b, [a1])) -> t a2 -> [a1]
2025-12-02 11:14:27 +0100 <tomsmeding> :t \f l -> concat $ flip runState 1 $ traverse (state . f) l
2025-12-02 11:13:45 +0100chromoblob(~chromoblo@user/chromob1ot1c) chromoblob\0
2025-12-02 11:12:40 +0100chromoblob(~chromoblo@user/chromob1ot1c) (Read error: Connection reset by peer)
2025-12-02 11:12:04 +0100kritzefitz(~kritzefit@debian/kritzefitz) ()
2025-12-02 11:11:47 +0100 <kuribas> Isn't ListT done right a logic monad?
2025-12-02 11:10:55 +0100merijn(~merijn@77.242.116.146) (Ping timeout: 240 seconds)
2025-12-02 11:10:13 +0100Lycurgus(~juan@user/Lycurgus) (Quit: alsoknownas.renjuan.org ( juan@acm.org ))
2025-12-02 11:08:38 +0100comerijn(~merijn@77.242.116.146) merijn
2025-12-02 11:07:27 +0100 <kuribas> lambdabot: It's a type synonym ...
2025-12-02 11:06:25 +0100 <lambdabot> • imported from ‘Control.Monad.State’ at /home/lambda/.lambdabot/State/L.hs:65:1-26
2025-12-02 11:06:25 +0100 <lambdabot> • Illegal term-level use of the type constructor ‘State’
2025-12-02 11:06:25 +0100 <lambdabot> error: [GHC-01928]
2025-12-02 11:06:23 +0100 <kuribas> :t \f l -> concat $ flip runState 1 $ traverse (State . f) l
2025-12-02 11:03:42 +0100fp1(~Thunderbi@2001:708:20:1406::1370) (Ping timeout: 252 seconds)