Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,987 events total
2025-09-28 02:05:33 op_4 joins (~tslil@user/op-4/x-9116473)
2025-09-28 02:07:13 trickard_ is now known as trickard
2025-09-28 02:10:16 banner joins (~banner@1.41.210.25)
2025-09-28 02:13:15 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 02:14:23 <slondr> What's the best way to maintain/mutate state across calls of a function where I can't modify the function signature?
2025-09-28 02:14:50 × remmie quits (ianremsen@tilde.team) (Ping timeout: 248 seconds)
2025-09-28 02:14:52 <slondr> as in, I'm passing a callback function to a library, but I want my callback function to accumulate some context each time it's called
2025-09-28 02:16:00 <slondr> My first thought was to use forkIO to spawn a separate thread for maintaining state in a simple call/response recursive function, then build my callback function as a closure over a channel to this thread. But that seems like it might be overkill
2025-09-28 02:18:02 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds)
2025-09-28 02:21:21 remmie joins (ianremsen@tilde.team)
2025-09-28 02:24:55 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 02:27:41 <Leary> slondr: Close over a simple `IORef` instead? E.g. pass in a partially applied `mkCallBack :: IORef YourState -> CallBackType`.
2025-09-28 02:28:14 × trickard quits (~trickard@cpe-50-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-09-28 02:29:44 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2025-09-28 02:30:54 trickard_ joins (~trickard@cpe-50-98-47-163.wireline.com.au)
2025-09-28 02:32:22 <slondr> Hmm, can I reference IORefs in a non-IO function?
2025-09-28 02:32:33 × talismanick quits (~user@2601:644:937c:ed10::c8dc) (Read error: Connection reset by peer)
2025-09-28 02:35:39 Googulator80 joins (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu)
2025-09-28 02:35:42 × Googulator17 quits (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu) (Quit: Client closed)
2025-09-28 02:37:18 <Leary> In a pure function? No, but in that case you can't do anything with channels either.
2025-09-28 02:37:27 <Leary> If you're in a pure context, the function must do the same thing every time it's called; it can have no internal state.
2025-09-28 02:37:43 <slondr> ah, ok
2025-09-28 02:37:56 talismanick joins (~user@2601:644:937c:ed10::c8dc)
2025-09-28 02:39:23 <slondr> is there maybe a way to modify external state without it affecting the return value of the function? I suppose I could rebuild the callback function into something slightly different every time if so
2025-09-28 02:40:41 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 02:45:08 <Leary> Not without `unsafePerformIO`. You probably need to change your approach.
2025-09-28 02:45:36 <dcpagan> How do I safely decrement a type-level natural number?
2025-09-28 02:45:37 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds)
2025-09-28 02:45:39 × xff0x quits (~xff0x@2405:6580:b080:900:6b5a:7de1:ba67:bc14) (Ping timeout: 250 seconds)
2025-09-28 02:45:53 <slondr> Hmm, I agree that this approach seems rather fundamentally flawed, but I feel at the whim of the library here sadly
2025-09-28 02:46:27 × ljdarj quits (~Thunderbi@user/ljdarj) (Ping timeout: 244 seconds)
2025-09-28 02:48:07 × td_ quits (~td@i53870915.versanet.de) (Ping timeout: 240 seconds)
2025-09-28 02:50:23 td_ joins (~td@i5387092C.versanet.de)
2025-09-28 02:53:10 × remmie quits (ianremsen@tilde.team) (Ping timeout: 244 seconds)
2025-09-28 02:54:41 elnegro joins (elnegro@r186-50-77-161.dialup.adsl.anteldata.net.uy)
2025-09-28 02:56:29 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 03:01:30 remmie joins (ianremsen@tilde.team)
2025-09-28 03:02:34 × elnegro quits (elnegro@r186-50-77-161.dialup.adsl.anteldata.net.uy) (Remote host closed the connection)
2025-09-28 03:02:55 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2025-09-28 03:02:59 × cyphase_eviltwin quits (~cyphase@user/cyphase) (Remote host closed the connection)
2025-09-28 03:05:48 <dcpagan> I got a reduction stack overflow from type-level shenanigans. Wat do?
2025-09-28 03:06:53 cyphase joins (~cyphase@user/cyphase)
2025-09-28 03:10:20 Axman6 joins (~Axman6@user/axman6)
2025-09-28 03:10:54 <slondr> oh! if I partially-apply the function from within an IO context, I get a de-IO'd version of the function - maybe this is the key
2025-09-28 03:14:33 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 03:19:19 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2025-09-28 03:19:27 × mrvdb quits (~mrvdb@2001:19f0:5000:8582:5400:ff:fe07:3df5) (Ping timeout: 250 seconds)
2025-09-28 03:19:43 × _0xa quits (~user@user/0xa/x-3134607) (Ping timeout: 255 seconds)
2025-09-28 03:19:56 _0xa joins (~user@2001:19f0:5001:2ba8:5400:1ff:feda:88fc)
2025-09-28 03:19:56 × _0xa quits (~user@2001:19f0:5001:2ba8:5400:1ff:feda:88fc) (Changing host)
2025-09-28 03:19:56 _0xa joins (~user@user/0xa/x-3134607)
2025-09-28 03:20:00 mrvdb joins (~mrvdb@2001:19f0:5000:8582:5400:ff:fe07:3df5)
2025-09-28 03:24:24 × Googulator80 quits (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu) (Quit: Client closed)
2025-09-28 03:24:42 Googulator80 joins (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu)
2025-09-28 03:28:57 xff0x joins (~xff0x@2405:6580:b080:900:bd6b:8e9b:54f4:4d4b)
2025-09-28 03:30:19 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 03:31:26 <slondr> Hey that may have worked
2025-09-28 03:35:25 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds)
2025-09-28 03:37:59 trickard_ is now known as trickard
2025-09-28 03:45:33 × Googulator80 quits (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu) (Quit: Client closed)
2025-09-28 03:45:42 Googulator80 joins (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu)
2025-09-28 03:46:13 <slondr> indeed it did! now I can read and write to an IORef from within the library's invokation of the callback. this is awesome
2025-09-28 03:47:09 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 03:50:42 × Googulator80 quits (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu) (Quit: Client closed)
2025-09-28 03:50:50 Googulator80 joins (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu)
2025-09-28 03:51:40 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds)
2025-09-28 03:55:31 aforemny_ joins (~aforemny@2001:9e8:6cfa:f400:257:422d:548f:72ea)
2025-09-28 03:56:46 × aforemny quits (~aforemny@i577B128D.versanet.de) (Ping timeout: 256 seconds)
2025-09-28 04:02:37 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 04:07:19 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2025-09-28 04:10:25 × Googulator80 quits (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu) (Quit: Client closed)
2025-09-28 04:10:38 Googulator80 joins (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu)
2025-09-28 04:11:38 × arandombit quits (~arandombi@user/arandombit) (Remote host closed the connection)
2025-09-28 04:11:56 arandombit joins (~arandombi@user/arandombit)
2025-09-28 04:16:52 × arandombit quits (~arandombi@user/arandombit) (Ping timeout: 244 seconds)
2025-09-28 04:18:23 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 04:20:40 <dcpagan> Is there a standard way to iterate over type-level natural numbers?
2025-09-28 04:21:47 arandombit joins (~arandombi@user/arandombit)
2025-09-28 04:22:49 <dcpagan> For example, in the recursion-schemes package (https://hackage.haskell.org/package/recursion-schemes), an instance of a base functor for Natural was defined as Maybe, and Natural was an instance of the fixed point of Maybe.
2025-09-28 04:23:09 <dcpagan> Is there a standard type-level way of unfixing that fixed point?
2025-09-28 04:23:14 <dcpagan> Something like this?
2025-09-28 04:23:25 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds)
2025-09-28 04:23:28 <dcpagan> type family Unnatural (n :: Natural) where
2025-09-28 04:23:30 <dcpagan> Unnatural 0 = 'Nothing
2025-09-28 04:23:32 <dcpagan> Unnatural n = 'Just (n - 1)
2025-09-28 04:25:43 × defragger quits (~random@i5C742CDD.versanet.de) (Ping timeout: 240 seconds)
2025-09-28 04:26:00 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 04:30:49 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds)
2025-09-28 04:35:40 Googulator63 joins (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu)
2025-09-28 04:35:40 × Googulator80 quits (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu) (Quit: Client closed)
2025-09-28 04:37:47 polykernel joins (~polykerne@user/polykernel)
2025-09-28 04:41:42 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 04:47:12 × arandombit quits (~arandombi@user/arandombit) (Ping timeout: 256 seconds)
2025-09-28 04:48:07 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2025-09-28 04:55:41 Googulator50 joins (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu)
2025-09-28 04:55:41 × Googulator63 quits (~Googulato@2a01-036d-0106-03fa-f110-0864-c42c-107f.pool6.digikabel.hu) (Quit: Client closed)
2025-09-28 04:59:44 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-09-28 05:00:47 arandombit joins (~arandombi@user/arandombit)
2025-09-28 05:04:49 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 264 seconds)
2025-09-28 05:08:07 × Square quits (~Square@user/square) (Ping timeout: 240 seconds)

All times are in UTC.