Logs: liberachat/#haskell
| 2025-08-28 16:25:44 | → | Googulator33 joins (~Googulato@2a01-036d-0106-28ad-d14e-68ce-c41e-4464.pool6.digikabel.hu) |
| 2025-08-28 16:26:07 | <EvanR> | StateT basically does nothing but add 1 mutable variable |
| 2025-08-28 16:26:43 | <EvanR> | whatever manipulations on it you write yourself on top of that |
| 2025-08-28 16:26:59 | <EvanR> | there are other monads that specialize in randomness |
| 2025-08-28 16:27:28 | <EvanR> | while IO gives you randomness, as many mutable variables as you want, and more |
| 2025-08-28 16:31:44 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 2025-08-28 16:33:39 | × | divlamir quits (~divlamir@user/divlamir) (Read error: Connection reset by peer) |
| 2025-08-28 16:33:58 | <haskellbridge> | <sm> indeed! |
| 2025-08-28 16:34:07 | → | divlamir joins (~divlamir@user/divlamir) |
| 2025-08-28 16:34:41 | <lightspell1> | EvanR: I'm trying to figure out how to limit the code to one mutable state, rather than running everything in IO |
| 2025-08-28 16:36:01 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds) |
| 2025-08-28 16:39:15 | <geekosaur> | but the random seed is itself a mutable state, so you necessarily have two unless you design your own state that combines them |
| 2025-08-28 16:43:55 | → | lightspell joins (~lightspel@dhcp-143-103-27-110.gobrightspeed.net) |
| 2025-08-28 16:45:38 | <lightspell> | I get that, but I thought the random generator is mutating itself every time I use it, and I'm passing it around as an argument to each function, so the way it's written now the StateT monad only needs to maintain the game state. I would like to also encapsulate the random generator as its own state, like you suggest, so it doesn't need to get |
| 2025-08-28 16:45:38 | <lightspell> | passed around all the time. I figured that would need some kind of nested transformers with mtl. |
| 2025-08-28 16:46:08 | <EvanR> | you could use two StateTs in a row for 2 variables but it gets interesting |
| 2025-08-28 16:46:21 | <EvanR> | or one StateT and one random monad transformer |
| 2025-08-28 16:46:48 | <EvanR> | without getting into MonadState generalizations |
| 2025-08-28 16:46:51 | → | ljdarj joins (~Thunderbi@user/ljdarj) |
| 2025-08-28 16:47:05 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 2025-08-28 16:47:25 | × | lightspell1 quits (~lightspel@dhcp-143-103-27-110.gobrightspeed.net) (Ping timeout: 250 seconds) |
| 2025-08-28 16:48:10 | <EvanR> | e.g. RandomT (sold separately) would add the ability the pick uniformly from a list and shuffle a list |
| 2025-08-28 16:48:12 | <lightspell> | That's what I'm trying to figure out how to do, yes. I barely understand what I'm doing now, so I don't want to get into further generalizations yet. |
| 2025-08-28 16:49:22 | × | tromp quits (~textual@2001:1c00:3487:1b00:6941:8da5:79d5:ac1b) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 2025-08-28 16:49:36 | × | chele quits (~chele@user/chele) (Remote host closed the connection) |
| 2025-08-28 16:51:07 | → | lightspell45 joins (~lightspel@dhcp-143-103-27-110.gobrightspeed.net) |
| 2025-08-28 16:51:13 | <lightspell45> | geez, I don't know what's up with these disconnections. Sorry. |
| 2025-08-28 16:52:09 | → | lightspell52 joins (~lightspel@dhcp-143-103-27-110.gobrightspeed.net) |
| 2025-08-28 16:52:19 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds) |
| 2025-08-28 16:52:20 | <lightspell52> | okay I give up for now. I'll try again later with a more stable service. Thanks for the help! |
| 2025-08-28 16:52:30 | <EvanR> | light spell, that's a blast from the past |
| 2025-08-28 16:52:34 | <EvanR> | dungeon master |
| 2025-08-28 16:53:55 | × | lightspell quits (~lightspel@dhcp-143-103-27-110.gobrightspeed.net) (Ping timeout: 250 seconds) |
| 2025-08-28 16:54:11 | <lightspell52> | I've tried nesting State inside the StateT to hold the random number generator. However, I have no idea how to actually do that |
| 2025-08-28 16:55:42 | → | tromp joins (~textual@2001:1c00:3487:1b00:6941:8da5:79d5:ac1b) |
| 2025-08-28 16:55:47 | <lightspell52> | Something like this. Defining `MyRandomState` clearly doesn't work because I don't think you can have parameterized types in a type definition like this. But I don't know how to tell it that I want the `m` to be `State` and the `g` to be the generator in the state. |
| 2025-08-28 16:55:48 | <lightspell52> | type MyRandomState = (StatefulGen g m) => State g |
| 2025-08-28 16:55:48 | <lightspell52> | type GameState a = StateT Game MyRandom a |
| 2025-08-28 16:56:05 | × | lightspell45 quits (~lightspel@dhcp-143-103-27-110.gobrightspeed.net) (Ping timeout: 250 seconds) |
| 2025-08-28 16:56:29 | <lightspell52> | That's complete nonsense code. Just trying to communicate the concept, something here just hasn't clicked yet for me. |
| 2025-08-28 16:57:54 | <EvanR> | it would be like StateT Game (StateT RNG IO a) |
| 2025-08-28 16:58:08 | → | tzh joins (~tzh@c-76-115-131-146.hsd1.or.comcast.net) |
| 2025-08-28 16:58:24 | <EvanR> | where RNG is the type for the generator state, whatever that is |
| 2025-08-28 16:58:27 | <EvanR> | not a monad |
| 2025-08-28 16:59:14 | <EvanR> | but because they're both StateT the disambiguation for the StateT methods gets fun |
| 2025-08-28 16:59:38 | <EvanR> | which is why a dedicated RandomT would be more ergonomic |
| 2025-08-28 17:00:26 | × | krei-se- quits (~krei-se@p3ee0fd0d.dip0.t-ipconnect.de) (Quit: ZNC 1.9.1 - https://znc.in) |
| 2025-08-28 17:00:30 | <EvanR> | I typoed that: StateT Game (StateT RNG IO) a |
| 2025-08-28 17:00:42 | → | qqe joins (~qqq@185.54.20.59) |
| 2025-08-28 17:01:25 | <EvanR> | the third argument is a monad, which has to have kind * -> * |
| 2025-08-28 17:01:54 | <EvanR> | 2nd argument ? 3rd position |
| 2025-08-28 17:03:58 | → | peterbecich joins (~Thunderbi@syn-047-229-123-186.res.spectrum.com) |
| 2025-08-28 17:04:08 | × | ggVGc quits (~ggVGc@a.lowtech.earth) (Server closed connection) |
| 2025-08-28 17:04:12 | <lightspell52> | That makes so more sense, than you. I will give that a try. |
| 2025-08-28 17:04:31 | → | ggVGc joins (~ggVGc@a.lowtech.earth) |
| 2025-08-28 17:08:14 | → | sprotte24 joins (~sprotte24@p200300d16f0bc80029e95c83e39d93ca.dip0.t-ipconnect.de) |
| 2025-08-28 17:09:49 | × | jreicher quits (~user@user/jreicher) (Ping timeout: 260 seconds) |
| 2025-08-28 17:12:35 | × | trickard quits (~trickard@cpe-57-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-08-28 17:12:49 | → | trickard joins (~trickard@cpe-57-98-47-163.wireline.com.au) |
| 2025-08-28 17:13:19 | × | peterbecich quits (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 260 seconds) |
| 2025-08-28 17:13:48 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 2025-08-28 17:16:04 | × | Frostillicus quits (~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net) (Quit: Frostillicus) |
| 2025-08-28 17:17:34 | × | kuribas quits (~user@ip-188-118-57-242.reverse.destiny.be) (Remote host closed the connection) |
| 2025-08-28 17:19:08 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds) |
| 2025-08-28 17:19:08 | × | machinedgod quits (~machinedg@d75-159-126-101.abhsia.telus.net) (Ping timeout: 260 seconds) |
| 2025-08-28 17:28:44 | → | ft joins (~ft@p4fc2a25a.dip0.t-ipconnect.de) |
| 2025-08-28 17:29:35 | → | segfaultfizzbuzz joins (~segfaultf@23-93-74-222.fiber.dynamic.sonic.net) |
| 2025-08-28 17:29:35 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 2025-08-28 17:33:09 | × | arandombit quits (~arandombi@user/arandombit) (Ping timeout: 260 seconds) |
| 2025-08-28 17:34:53 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds) |
| 2025-08-28 17:35:15 | → | chromoblob joins (~chromoblo@user/chromob1ot1c) |
| 2025-08-28 17:44:51 | → | arandombit joins (~arandombi@2603:7000:4600:ffbe:2ca2:a28f:2f37:22f6) |
| 2025-08-28 17:44:51 | × | arandombit quits (~arandombi@2603:7000:4600:ffbe:2ca2:a28f:2f37:22f6) (Changing host) |
| 2025-08-28 17:44:51 | → | arandombit joins (~arandombi@user/arandombit) |
| 2025-08-28 17:45:23 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 2025-08-28 17:48:20 | × | hakutaku quits (~textual@chen.yukari.eu.org) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2025-08-28 17:48:58 | × | trickard quits (~trickard@cpe-57-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-08-28 17:49:01 | → | hakutaku joins (~textual@chen.yukari.eu.org) |
| 2025-08-28 17:49:05 | × | arandombit quits (~arandombi@user/arandombit) (Ping timeout: 248 seconds) |
| 2025-08-28 17:50:09 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds) |
| 2025-08-28 17:51:42 | → | trickard_ joins (~trickard@cpe-57-98-47-163.wireline.com.au) |
| 2025-08-28 17:59:01 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 2025-08-28 18:00:23 | → | arandombit joins (~arandombi@user/arandombit) |
| 2025-08-28 18:03:00 | → | ttybitnik joins (~ttybitnik@user/wolper) |
| 2025-08-28 18:03:37 | → | vanishingideal joins (~vanishing@user/vanishingideal) |
| 2025-08-28 18:04:04 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds) |
| 2025-08-28 18:04:39 | → | Googulator9 joins (~Googulato@2a01-036d-0106-28ad-d14e-68ce-c41e-4464.pool6.digikabel.hu) |
| 2025-08-28 18:08:27 | × | Googulator33 quits (~Googulato@2a01-036d-0106-28ad-d14e-68ce-c41e-4464.pool6.digikabel.hu) (Ping timeout: 250 seconds) |
| 2025-08-28 18:10:10 | × | poscat quits (~poscat@user/poscat) (Remote host closed the connection) |
| 2025-08-28 18:10:42 | Googulator9 | is now known as Googulator |
| 2025-08-28 18:10:44 | → | poscat joins (~poscat@user/poscat) |
| 2025-08-28 18:12:27 | → | krei-se joins (~krei-se@p3ee0fd0d.dip0.t-ipconnect.de) |
| 2025-08-28 18:14:31 | → | merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl) |
| 2025-08-28 18:19:49 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds) |
| 2025-08-28 18:22:39 | → | ThePenguin2 joins (~ThePengui@cust-95-80-28-221.csbnet.se) |
| 2025-08-28 18:24:34 | × | ThePenguin quits (~ThePengui@cust-95-80-31-242.csbnet.se) (Ping timeout: 245 seconds) |
| 2025-08-28 18:24:34 | ThePenguin2 | is now known as ThePenguin |
| 2025-08-28 18:24:58 | → | notzmv joins (~umar@user/notzmv) |
| 2025-08-28 18:26:57 | × | ThePenguin quits (~ThePengui@cust-95-80-28-221.csbnet.se) (Remote host closed the connection) |
| 2025-08-28 18:27:17 | → | ThePenguin joins (~ThePengui@cust-95-80-28-221.csbnet.se) |
All times are in UTC.