2024-12-22 00:01:53 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich |
2024-12-22 00:03:53 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) (Remote host closed the connection) |
2024-12-22 00:04:13 +0100 | chexum | (~quassel@gateway/tor-sasl/chexum) chexum |
2024-12-22 00:09:03 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 00:14:58 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds) |
2024-12-22 00:20:26 +0100 | <exarkun> | today, right now |
2024-12-22 00:20:41 +0100 | <haskellbridge> | <thirdofmay18081814goya> really? cool |
2024-12-22 00:20:45 +0100 | <haskellbridge> | <thirdofmay18081814goya> what library are you using |
2024-12-22 00:20:56 +0100 | <exarkun> | reflex-sdl2 |
2024-12-22 00:21:10 +0100 | <exarkun> | and reflex, of course |
2024-12-22 00:22:05 +0100 | <haskellbridge> | <thirdofmay18081814goya> neat, will try out reflex right now |
2024-12-22 00:22:13 +0100 | ubert1 | (~Thunderbi@p200300ecdf117cbda8ce35cba2c9a19e.dip0.t-ipconnect.de) ubert |
2024-12-22 00:23:13 +0100 | ubert | (~Thunderbi@p200300ecdf117ce99c7826839207afbb.dip0.t-ipconnect.de) (Ping timeout: 252 seconds) |
2024-12-22 00:23:13 +0100 | ubert1 | ubert |
2024-12-22 00:25:41 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 00:30:39 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 276 seconds) |
2024-12-22 00:31:20 +0100 | son0p | (~ff@186.121.98.118) (Ping timeout: 265 seconds) |
2024-12-22 00:32:01 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 252 seconds) |
2024-12-22 00:34:27 +0100 | hiredman | (~hiredman@frontier1.downey.family) (Quit: Lost terminal) |
2024-12-22 00:38:12 +0100 | son0p | (~ff@186.121.98.118) son0p |
2024-12-22 00:39:51 +0100 | takuan | (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
2024-12-22 00:41:03 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 00:42:30 +0100 | tremon | (~tremon@83.80.159.219) (Quit: getting boxed in) |
2024-12-22 00:46:11 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds) |
2024-12-22 00:49:00 +0100 | E2Combinator | (~E2Combina@190.180.45.137) |
2024-12-22 00:55:17 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 00:58:09 +0100 | housemate | (~housemate@ppp203-122-213-191.static.internode.on.net) housemate |
2024-12-22 00:58:09 +0100 | MyNetAz | (~MyNetAz@user/MyNetAz) (Remote host closed the connection) |
2024-12-22 00:58:57 +0100 | gorignak | (~gorignak@user/gorignak) (Ping timeout: 252 seconds) |
2024-12-22 01:01:58 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds) |
2024-12-22 01:04:28 +0100 | <Leary> | % :t \xs i -> either Just (const Nothing) . flip runStateT 0 $ for_ xs \x -> do{ j <- get; put (j + 1); when (j == i) (throwError x) } |
2024-12-22 01:04:28 +0100 | <yahb2> | \xs i -> either Just (const Nothing) . flip runStateT 0 $ for_ xs \x -> do{ j <- get; put (j + 1); when (j == i) (throwError x) } ; :: (Eq a, Num a, Foldable t) => t e -> a -> Maybe e |
2024-12-22 01:04:41 +0100 | cptaffe | (~cptaffe@user/cptaffe) (Ping timeout: 265 seconds) |
2024-12-22 01:05:03 +0100 | sprotte24 | (~sprotte24@p200300d16f1a2c0064c6ee858fd5dcfe.dip0.t-ipconnect.de) |
2024-12-22 01:05:09 +0100 | MyNetAz | (~MyNetAz@user/MyNetAz) MyNetAz |
2024-12-22 01:05:16 +0100 | E2Combinator | (~E2Combina@190.180.45.137) (Quit: Client closed) |
2024-12-22 01:05:23 +0100 | <Leary> | EvanR: `Foldable` already has indexing. |
2024-12-22 01:06:47 +0100 | cptaffe | (~cptaffe@user/cptaffe) cptaffe |
2024-12-22 01:10:12 +0100 | housemate | (~housemate@ppp203-122-213-191.static.internode.on.net) (Quit: Nothing to see here. I wasn't there. I take IRC seriously.) |
2024-12-22 01:10:22 +0100 | E2Combinator | (~E2Combina@190.180.45.137) |
2024-12-22 01:13:20 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 01:17:27 +0100 | __monty__ | (~toonn@user/toonn) (Quit: leaving) |
2024-12-22 01:17:47 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 244 seconds) |
2024-12-22 01:23:12 +0100 | <monochrom> | Wait, do you mean one can just do toList and index into that list?! |
2024-12-22 01:23:36 +0100 | <monochrom> | Not very efficient but I guess it counts. |
2024-12-22 01:24:00 +0100 | <monochrom> | Then again Napier functors can have inefficient indexing too. |
2024-12-22 01:28:42 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 01:33:08 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds) |
2024-12-22 01:34:04 +0100 | housemate | (~housemate@ppp203-122-213-191.static.internode.on.net) housemate |
2024-12-22 01:42:31 +0100 | CrunchyFlakes | (~CrunchyFl@31.19.233.78) (Read error: Connection reset by peer) |
2024-12-22 01:44:05 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 01:44:46 +0100 | CrunchyFlakes | (~CrunchyFl@ip1f13e94e.dynamic.kabel-deutschland.de) |
2024-12-22 01:45:45 +0100 | <E2Combinator> | Hi. I have some serious issues tryong to define a wrapper effect in fused-effects, anyone can help with that? |
2024-12-22 01:46:33 +0100 | <E2Combinator> | I have defined the effect as such: |
2024-12-22 01:46:33 +0100 | <E2Combinator> | https://paste.tomsmeding.com/4J7pz5eI |
2024-12-22 01:46:33 +0100 | <E2Combinator> | And it typechecks and all |
2024-12-22 01:47:05 +0100 | <E2Combinator> | I have defined an operation as such: |
2024-12-22 01:47:07 +0100 | <E2Combinator> | resolveMovementStep :: Has UpdateTracking sig m => WilMaze InMovement -> m (WilMaze InMovement) |
2024-12-22 01:47:12 +0100 | <E2Combinator> | And it typechecks and all |
2024-12-22 01:47:36 +0100 | <E2Combinator> | But the moment I try to run resolveMovementStep with an effect carrier stack, I get the following: |
2024-12-22 01:47:48 +0100 | <E2Combinator> | run $ runUpdateTracking $ resolveMovementStep m |
2024-12-22 01:48:28 +0100 | <E2Combinator> | https://paste.tomsmeding.com/pXrMkP7e |
2024-12-22 01:48:40 +0100 | ljdarj | (~Thunderbi@user/ljdarj) (Ping timeout: 265 seconds) |
2024-12-22 01:49:09 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 265 seconds) |
2024-12-22 01:49:09 +0100 | <E2Combinator> | It complains partially about a missing effect signature, but even if I add the Has (Writer Any) constraint, it still fails |
2024-12-22 01:50:07 +0100 | <E2Combinator> | Nvm, I saw the issue. Extraneous constraint in the Algebra instance |
2024-12-22 01:55:45 +0100 | MyNetAz | (~MyNetAz@user/MyNetAz) (Remote host closed the connection) |
2024-12-22 01:59:46 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 02:02:46 +0100 | MyNetAz | (~MyNetAz@user/MyNetAz) MyNetAz |
2024-12-22 02:04:52 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 272 seconds) |
2024-12-22 02:15:05 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 02:15:27 +0100 | ryanbooker | (uid4340@id-4340.hampstead.irccloud.com) ryanbooker |
2024-12-22 02:17:27 +0100 | sprotte24 | (~sprotte24@p200300d16f1a2c0064c6ee858fd5dcfe.dip0.t-ipconnect.de) (Quit: Leaving) |
2024-12-22 02:20:05 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 265 seconds) |
2024-12-22 02:21:17 +0100 | <orangeflu> | Bowuigi, you here? |
2024-12-22 02:27:00 +0100 | <haskellbridge> | <Bowuigi> Yes, also Matrix stores messages when I'm offline |
2024-12-22 02:30:47 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 02:35:17 +0100 | machinedgod | (~machinedg@d108-173-18-100.abhsia.telus.net) (Ping timeout: 244 seconds) |
2024-12-22 02:37:21 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 246 seconds) |
2024-12-22 02:38:08 +0100 | <orangeflu> | ok, so weird thing |
2024-12-22 02:38:14 +0100 | <orangeflu> | been coding some more on that branch today |
2024-12-22 02:38:38 +0100 | <orangeflu> | decided, what the hell, haven't done a cabal test in a few hours, let me make sure i didn't fuck anything up in the meanwhile |
2024-12-22 02:38:49 +0100 | <orangeflu> | that few gigs we were talking about yesterday |
2024-12-22 02:38:54 +0100 | <orangeflu> | disappeared completely |
2024-12-22 02:39:06 +0100 | <orangeflu> | if i run test.asm, it doesn't do that anymore |
2024-12-22 02:39:10 +0100 | <orangeflu> | not sure when it stopped |
2024-12-22 02:39:14 +0100 | housemate | (~housemate@ppp203-122-213-191.static.internode.on.net) (Quit: Nothing to see here. I wasn't there. I take IRC seriously.) |
2024-12-22 02:39:41 +0100 | <orangeflu> | i tried to go back to yesterday's commits but no luck, it simply isn't there |
2024-12-22 02:40:10 +0100 | <orangeflu> | so i'ma just decide its a compiler weirdness and hope it never comes back, but it is weird indeed |
2024-12-22 02:41:07 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 02:42:08 +0100 | <haskellbridge> | <thirdofmay18081814goya> hm, how owuld FRP model something like viewer state? e.g., the current page the user is on in a website |
2024-12-22 02:42:08 +0100 | <orangeflu> | you know what, i might retry some profiling right now since it seems that the compiler decided to behave |
2024-12-22 02:42:15 +0100 | <haskellbridge> | <thirdofmay18081814goya> * would |
2024-12-22 02:43:30 +0100 | sprotte24 | (~sprotte24@p200300d16f1a2c0064c6ee858fd5dcfe.dip0.t-ipconnect.de) |
2024-12-22 02:43:54 +0100 | Tuplanolla | (~Tuplanoll@91-159-69-59.elisa-laajakaista.fi) (Quit: Leaving.) |
2024-12-22 02:45:24 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 244 seconds) |
2024-12-22 02:45:39 +0100 | sprotte24 | (~sprotte24@p200300d16f1a2c0064c6ee858fd5dcfe.dip0.t-ipconnect.de) (Client Quit) |
2024-12-22 02:46:39 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f52b5be3bacf47f1ed3.dip0.t-ipconnect.de) (Ping timeout: 245 seconds) |
2024-12-22 02:50:27 +0100 | mhatta | (~mhatta@www21123ui.sakura.ne.jp) (Quit: ZNC 1.9.1+deb2+b1 - https://znc.in) |
2024-12-22 02:51:05 +0100 | <haskellbridge> | <thirdofmay18081814goya> oh this would be represented as a constant stream that changes contents as the user changes pages, right? |
2024-12-22 02:51:19 +0100 | <haskellbridge> | <thirdofmay18081814goya> uh not "constant" stream, but continuous stream |
2024-12-22 02:52:01 +0100 | mhatta | (~mhatta@www21123ui.sakura.ne.jp) |
2024-12-22 02:52:01 +0100 | <haskellbridge> | <thirdofmay18081814goya> e.g. a stream whose content is the unique ID of the current page |
2024-12-22 02:52:03 +0100 | <haskellbridge> | <thirdofmay18081814goya> right? |
2024-12-22 02:56:25 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 02:59:51 +0100 | weary-traveler | (~user@user/user363627) user363627 |
2024-12-22 03:00:54 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 244 seconds) |
2024-12-22 03:11:46 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 03:11:54 +0100 | <haskellbridge> | <Bowuigi> orangeflu odd stuff, but I'm glad it got solved |
2024-12-22 03:16:24 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 244 seconds) |
2024-12-22 03:18:00 +0100 | sawilagar | (~sawilagar@user/sawilagar) (Ping timeout: 260 seconds) |
2024-12-22 03:22:45 +0100 | housemate | (~housemate@125.63.162.34) housemate |
2024-12-22 03:30:37 +0100 | E2Combinator | (~E2Combina@190.180.45.137) () |
2024-12-22 03:33:04 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 03:33:33 +0100 | housemate | (~housemate@125.63.162.34) (Ping timeout: 265 seconds) |
2024-12-22 03:37:03 +0100 | <orangeflu> | Bowuigi: I don't like that i don't know where it came from, and i still can't make profiling work |
2024-12-22 03:37:54 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds) |
2024-12-22 03:38:13 +0100 | <haskellbridge> | <Bowuigi> Did you update or change any settings? |
2024-12-22 03:39:01 +0100 | <orangeflu> | i disabled test coverage |
2024-12-22 03:39:27 +0100 | <orangeflu> | waaaait |
2024-12-22 03:39:37 +0100 | <orangeflu> | it compiled with profiling |
2024-12-22 03:39:43 +0100 | <orangeflu> | stand-by for results |
2024-12-22 03:42:36 +0100 | <orangeflu> | nvm |
2024-12-22 03:47:14 +0100 | <orangeflu> | idk why it doesn't work. I try to build it wiht -prof, cabal complains i shouldn't do that. not like it matters, it gives an error anyway. Then i do cabal build --enable-profiling and then when i run it, no prog file is generated |
2024-12-22 03:47:28 +0100 | <orangeflu> | How this whole process is supposed to work is hideously explained |
2024-12-22 03:48:26 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 03:50:30 +0100 | <orangeflu> | ok, i ended up doing it |
2024-12-22 03:50:42 +0100 | <orangeflu> | you want the results? not sure how to interpret them |
2024-12-22 03:51:51 +0100 | <haskellbridge> | <Bowuigi> To be honest no idea how to profile either, but if it is a text file just drop it in https://paste.tomsmeding.com |
2024-12-22 03:52:40 +0100 | <haskellbridge> | <Bowuigi> In particular, allocation spikes is what you are looking for |
2024-12-22 03:52:59 +0100 | <haskellbridge> | <thirdofmay18081814goya> in FRP, do we suppose there exists a stream between the user's ability-to-click and buttons? |
2024-12-22 03:53:00 +0100 | <orangeflu> | https://paste.tomsmeding.com/b9owLIrr |
2024-12-22 03:53:41 +0100 | <geekosaur> | generally you need to compile with profiling (cabal will do this with --enable-profiling) and then run with profiling enabled (which is an RTS option: https://downloads.haskell.org/ghc/9.10.1/docs/users_guide/runtime_control.html#rts-profiling) |
2024-12-22 03:53:51 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 265 seconds) |
2024-12-22 03:53:58 +0100 | <orangeflu> | am i reading it correctly when it says it allocated 914 megabytes? |
2024-12-22 03:54:07 +0100 | <orangeflu> | total alloc = 914,690,800 bytes (excludes profiling overheads) |
2024-12-22 03:55:08 +0100 | <orangeflu> | geekosaur: yeah, what i did is i added profiling: True in cabal.project.local, and these arguments to ghc-options: -fprof-auto "-with-rtsopts=-N -p -s -h -i0.1" |
2024-12-22 03:55:12 +0100 | <orangeflu> | and it seems to work now |
2024-12-22 03:57:50 +0100 | machinedgod | (~machinedg@d108-173-18-100.abhsia.telus.net) machinedgod |
2024-12-22 03:57:58 +0100 | <geekosaur> | also note that "total alloc" includes ephemeral allocations which never leave the nursery and can generally be ignored because they're very fast to both allocate and reclaim |
2024-12-22 03:58:24 +0100 | <haskellbridge> | <Bowuigi> thirdofmay18081814goya re:current-page yes, a value that may change as time moves is represented like that |
2024-12-22 03:58:55 +0100 | <haskellbridge> | <Bowuigi> orangeflu the tables on the allocation report show how much time and allocation is used on every function |
2024-12-22 03:58:59 +0100 | <orangeflu> | geekosaur: still seems like a lot, for what the programs does |
2024-12-22 04:00:48 +0100 | <haskellbridge> | <Bowuigi> thirdofmay18081814goya you might want to check the source for reactive-banana or some other FRP UI library, I don't know enough about that, sorry |
2024-12-22 04:01:45 +0100 | <orangeflu> | so what should i take away from this report? that the ST instruction takes a lot of time, since it's in a program where it's used a lot? |
2024-12-22 04:02:01 +0100 | <haskellbridge> | <thirdofmay18081814goya> hm I see ty |
2024-12-22 04:02:34 +0100 | <haskellbridge> | <Bowuigi> st might have a space leak, 961MB for bubble sort is too much lol |
2024-12-22 04:03:42 +0100 | <orangeflu> | yeah, but ST is used a lot in that program |
2024-12-22 04:04:07 +0100 | <orangeflu> | and if haskell allocates and deallocates those EmulatorState everytime i modify the arrays inside |
2024-12-22 04:04:14 +0100 | <orangeflu> | it would make sense to consume that much |
2024-12-22 04:04:20 +0100 | <orangeflu> | right? |
2024-12-22 04:04:24 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 04:04:47 +0100 | <orangeflu> | cause the ST instruction stores something in the memory, which is a 2000 bytes array |
2024-12-22 04:05:04 +0100 | op_4 | (~tslil@user/op-4/x-9116473) (Remote host closed the connection) |
2024-12-22 04:05:06 +0100 | <haskellbridge> | <Bowuigi> Oh could you move to MVector? |
2024-12-22 04:05:13 +0100 | <orangeflu> | I could |
2024-12-22 04:05:18 +0100 | <orangeflu> | already made plans to |
2024-12-22 04:05:29 +0100 | housemate | (~housemate@ppp203-122-213-191.static.internode.on.net) housemate |
2024-12-22 04:05:34 +0100 | op_4 | (~tslil@user/op-4/x-9116473) op_4 |
2024-12-22 04:05:52 +0100 | <orangeflu> | i have an idea though. My emulator has configurable SRAM sizes. Let's see if the total allocation decreases if i give it less total SRAM |
2024-12-22 04:05:53 +0100 | <haskellbridge> | <Bowuigi> Because GHC tries to make stuff mutable on lower layers, but it can't if large parts are modified (as in the case of Array) |
2024-12-22 04:06:14 +0100 | housemate | (~housemate@ppp203-122-213-191.static.internode.on.net) (Max SendQ exceeded) |
2024-12-22 04:07:11 +0100 | housemate | (~housemate@ppp203-122-213-191.static.internode.on.net) housemate |
2024-12-22 04:07:15 +0100 | housemate | (~housemate@ppp203-122-213-191.static.internode.on.net) (Remote host closed the connection) |
2024-12-22 04:07:29 +0100 | <orangeflu> | memory allocation drops to 511 mb if i give it 500 bytes of SRAM instead |
2024-12-22 04:08:11 +0100 | <geekosaur> | Array does carding but the cards are fairly large |
2024-12-22 04:08:22 +0100 | <haskellbridge> | <Bowuigi> The tree below indicates the local (with respect to the siblings of the tree and children) time and allocation usage |
2024-12-22 04:08:26 +0100 | <geekosaur> | 128 elements last I heard? |
2024-12-22 04:08:58 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds) |
2024-12-22 04:09:33 +0100 | <orangeflu> | if i use another assembly file, like one that doesn't write to memory at all, total allocation is 1-2 mb, and changing the memory size doesn't make that much of a difference |
2024-12-22 04:10:09 +0100 | <orangeflu> | geekosaur: carding? |
2024-12-22 04:10:32 +0100 | <geekosaur> | instead of GCing the entire array, it's divided into cards and individual cards are GCd |
2024-12-22 04:11:43 +0100 | <geekosaur> | but f you touch elements in a lot of cards, it's slightly less performant than GCing the whole array; it works best if only nearby elements are modified |
2024-12-22 04:12:02 +0100 | <orangeflu> | but why GC the array in the first place is what i don't understand. Like, i assume the compiler is smart enough to see that i always take the array, modify it and return the copy. does that not imply that it should make it mutable behind the scenes? |
2024-12-22 04:12:33 +0100 | <haskellbridge> | <Bowuigi> Not exactly, the compiler likely can't assume that |
2024-12-22 04:12:35 +0100 | <geekosaur> | if you're not modifying it, why was MVector the alternative? |
2024-12-22 04:13:09 +0100 | <orangeflu> | i am "modifying it", by making a copy of it with the element i want modified changed, and i return that instead |
2024-12-22 04:13:17 +0100 | <haskellbridge> | <Bowuigi> It was being modified, orangeflu refers to copy/mutate semantics, not explicit cloning |
2024-12-22 04:13:32 +0100 | <orangeflu> | yeah |
2024-12-22 04:14:04 +0100 | <haskellbridge> | <Bowuigi> So MVector would help here, as it has better fusion and is supposed to be mutable |
2024-12-22 04:14:44 +0100 | <orangeflu> | let me see if i can make a quick experiment to see how it would work |
2024-12-22 04:15:08 +0100 | <orangeflu> | but it may prove to be difficult because i would need to modify every function for every instruction, may take a while |
2024-12-22 04:15:40 +0100 | <haskellbridge> | <Bowuigi> It is likely rebuilding the emulator state and array, but the only way to know for certain is to read the Core. That is way too far from a begginer topic |
2024-12-22 04:15:41 +0100 | <orangeflu> | and i never worked with monads in this way before |
2024-12-22 04:15:59 +0100 | <orangeflu> | is the Core in haskell? |
2024-12-22 04:18:08 +0100 | <haskellbridge> | <Bowuigi> With "Core" I mean GHC Core, one of the intermediate representations of Haskell code used in GHC, specifically, the one that seems to have the most influence in the compilation result while being functional |
2024-12-22 04:19:33 +0100 | <haskellbridge> | <Bowuigi> Practice with MVector outside of the emulator (and possibly with the strict state monad, the recommendation that was made yesterday) before implementing it, to understand it better |
2024-12-22 04:19:44 +0100 | <geekosaur> | Core is kinda a simplified Haskell, but with annotations for things like strictness of parameters which guide optimization |
2024-12-22 04:19:46 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 04:22:35 +0100 | <orangeflu> | By strict state monad, what do you mean? |
2024-12-22 04:24:36 +0100 | <orangeflu> | ST? |
2024-12-22 04:26:32 +0100 | <geekosaur> | https://downloads.haskell.org/ghc/latest/docs/libraries/mtl-2.3.1-a17d/Control-Monad-State-Strict.… |
2024-12-22 04:26:40 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 244 seconds) |
2024-12-22 04:27:07 +0100 | housemate | (~housemate@ppp203-122-213-191.static.internode.on.net) housemate |
2024-12-22 04:27:18 +0100 | <geekosaur> | ST is not "state" in the same sense, it is an execution context with private state in the form of STRefs and STArrays |
2024-12-22 04:30:08 +0100 | <orangeflu> | i wish i knew what you were trying to say |
2024-12-22 04:30:51 +0100 | <orangeflu> | when i was trying to understand monads, i thought "after i get this, everything else will be easy, this is the hardest thing ever" |
2024-12-22 04:30:52 +0100 | <geekosaur> | the concept behind ST is a bit difficult to understand, yes |
2024-12-22 04:30:55 +0100 | <orangeflu> | apparently not |
2024-12-22 04:32:29 +0100 | housemate | (~housemate@ppp203-122-213-191.static.internode.on.net) (Quit: Nothing to see here. I wasn't there. I take IRC seriously.) |
2024-12-22 04:33:08 +0100 | <geekosaur> | when we talk about threads, we normally talk about CPU threads. ST is a difference concept, a state thread. instead of representing a separate CPU execution environment, it's a separate local state environment. in Haskell this means you have access to mutable data within the thread that can't be accessed outside of it |
2024-12-22 04:35:33 +0100 | <geekosaur> | the best explanation is probably one in the paper linked at the top of the Control.Monad.ST documentation |
2024-12-22 04:36:00 +0100 | <geekosaur> | also, trust me, you haven't by far exhausted the complexities of Haskell |
2024-12-22 04:37:49 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 04:37:50 +0100 | <geekosaur> | rank-N types (which you're on the border of with ST), STM (software transactional memory), type level programming, … the list goes on |
2024-12-22 04:38:29 +0100 | <orangeflu> | you might as well be speaking dutch |
2024-12-22 04:41:16 +0100 | <geekosaur> | that was kinda the point 🙂 |
2024-12-22 04:42:20 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds) |
2024-12-22 04:43:25 +0100 | <orangeflu> | i am already stuck with this vector |
2024-12-22 04:43:43 +0100 | td_ | (~td@i53870903.versanet.de) (Ping timeout: 244 seconds) |
2024-12-22 04:45:03 +0100 | alecs | (~alecs@61.pool85-58-154.dynamic.orange.es) alecs |
2024-12-22 04:45:39 +0100 | td_ | (~td@i5387092A.versanet.de) td_ |
2024-12-22 04:49:24 +0100 | alecs | (~alecs@61.pool85-58-154.dynamic.orange.es) (Ping timeout: 244 seconds) |
2024-12-22 04:49:42 +0100 | <orangeflu> | i can't even create an mvector, it doesn't let me |
2024-12-22 04:53:10 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 04:55:13 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich |
2024-12-22 04:57:44 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 252 seconds) |
2024-12-22 04:59:12 +0100 | <orangeflu> | how do i unwrap from ST? |
2024-12-22 04:59:37 +0100 | <c_wraith> | :t runST |
2024-12-22 04:59:38 +0100 | <lambdabot> | (forall s. ST s a) -> a |
2024-12-22 05:00:15 +0100 | <orangeflu> | i thought so too but it doesnt work |
2024-12-22 05:00:40 +0100 | <c_wraith> | it does if you aren't trying to leak things that you're not supposed to |
2024-12-22 05:00:48 +0100 | <orangeflu> | Couldn't match type: M.MVector s Int with: IO a0 |
2024-12-22 05:00:58 +0100 | <orangeflu> | leak? |
2024-12-22 05:01:14 +0100 | <c_wraith> | ST is designed to prevent mutable values from leaking into pure code. |
2024-12-22 05:01:27 +0100 | <c_wraith> | but if you're getting an error about IO, you're doing something else wrong. |
2024-12-22 05:01:47 +0100 | <orangeflu> | probably because i am running this in main |
2024-12-22 05:04:22 +0100 | L29Ah | (~L29Ah@wikipedia/L29Ah) () |
2024-12-22 05:08:34 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 05:09:12 +0100 | <orangeflu> | i think i made it work somehow |
2024-12-22 05:09:48 +0100 | <orangeflu> | but i had to make like 3 functions just to set a value and return it, and i lost the vector |
2024-12-22 05:11:32 +0100 | dostoevsky | (~dostoevsk@user/dostoevsky) (Quit: Leaving) |
2024-12-22 05:13:07 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 265 seconds) |
2024-12-22 05:13:30 +0100 | <haskellbridge> | <thirdofmay18081814goya> hm |
2024-12-22 05:13:36 +0100 | <haskellbridge> | <thirdofmay18081814goya> what's the right way to think of switches in FRP? |
2024-12-22 05:13:54 +0100 | <haskellbridge> | <thirdofmay18081814goya> e.g. if a switch has two possible targets, do we think of it as a function from one signal to two signals? |
2024-12-22 05:13:56 +0100 | <monochrom> | A stream of booleans? |
2024-12-22 05:14:22 +0100 | <monochrom> | If the two signals are mutually exclusive then it is just one signal of two states. |
2024-12-22 05:14:56 +0100 | <monochrom> | or 3 states if they are {0, 1, neither} |
2024-12-22 05:15:34 +0100 | <haskellbridge> | <thirdofmay18081814goya> hm, I'm not sure I understand. don't we think of a switch as changing the target signal? |
2024-12-22 05:16:00 +0100 | <haskellbridge> | <thirdofmay18081814goya> like network switches |
2024-12-22 05:16:17 +0100 | <monochrom> | A long time ago, Shannon already turned switches into logic gates, so still just booleans. |
2024-12-22 05:17:16 +0100 | <haskellbridge> | <thirdofmay18081814goya> we're talking about e.g. Yampa switches here right? |
2024-12-22 05:18:26 +0100 | <monochrom> | Are they really non-isomorphic to relays? |
2024-12-22 05:18:56 +0100 | <haskellbridge> | <thirdofmay18081814goya> I don't know, here's the type "switch :: SF i (o, Event e) -> (e -> SF i o) -> SF i o" |
2024-12-22 05:19:00 +0100 | <orangeflu> | c_wraith: so, if i understand correctly, everywhere i need to modify the mvector, it needs to return ST s (MVector s Int). Just to read it, i need to be in at least ST s Int. Then how do I reconcile that with getting user input and stuff. I have a bunch of other monads i need to think about in my REPL, that need to take input from the user and so on. But if i escape this ST by running through runST, i |
2024-12-22 05:19:06 +0100 | <orangeflu> | lose the vector, right? |
2024-12-22 05:23:56 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 05:24:27 +0100 | machinedgod | (~machinedg@d108-173-18-100.abhsia.telus.net) (Ping timeout: 276 seconds) |
2024-12-22 05:27:06 +0100 | aforemny | (~aforemny@2001:9e8:6cf6:8000:f088:f772:a53:8f63) (Ping timeout: 246 seconds) |
2024-12-22 05:27:45 +0100 | aforemny | (~aforemny@89.244.199.39) aforemny |
2024-12-22 05:28:35 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 265 seconds) |
2024-12-22 05:30:13 +0100 | <c_wraith> | orangeflu: The point of ST is that you encapsulate *all* the mutation in a single call to runST. You return an immutable value. |
2024-12-22 05:32:43 +0100 | <haskellbridge> | <Bowuigi> orangeflu you have to create the MVector in IO, not in ST |
2024-12-22 05:33:08 +0100 | <haskellbridge> | <Bowuigi> So you allocate the memory in main as usual, but instead of creating an array you create an MVector |
2024-12-22 05:33:21 +0100 | <c_wraith> | Bowuigi: eh? If you want to mutate it in ST, you need to allocate it in ST. |
2024-12-22 05:36:00 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 05:36:01 +0100 | <haskellbridge> | <Bowuigi> The idea was to have an MVector on IO, not on ST |
2024-12-22 05:36:02 +0100 | <orangeflu> | how do i return an immutable value? |
2024-12-22 05:36:30 +0100 | <haskellbridge> | <Bowuigi> What |
2024-12-22 05:36:43 +0100 | <c_wraith> | Eh, I started answering questions starting from "what's the eliminator for ST" |
2024-12-22 05:37:37 +0100 | <c_wraith> | If you're using IO mutable vectors, ignore everything about ST. |
2024-12-22 05:37:37 +0100 | <orangeflu> | c_wraith said "you return an immutable value". So i go in ST or IO, mutate it however i wish based on what the instruction needs to do, then when i remove it from IO, it becomes immutable? |
2024-12-22 05:39:41 +0100 | <haskellbridge> | <Bowuigi> c_wraith Some context, orangeflu is writing an emulator. This emulator has a fixed memory, which used to be in an Array. This caused space leaks, so I and [exa] suggested using an MVector because it provides benefits on this use case |
2024-12-22 05:40:24 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 246 seconds) |
2024-12-22 05:41:13 +0100 | <haskellbridge> | <Bowuigi> orangeflu the idea is to run the modifications on IO only (ST also works but it's not what we want here), that's what the "PrimMonad" stuff means |
2024-12-22 05:41:18 +0100 | <c_wraith> | That's a kind of bad way to avoid space leaks. It's better to write code that uses space invariants properly. But it has enough other benefits that it's still worth doing. |
2024-12-22 05:41:47 +0100 | <c_wraith> | (It's likely to not avoid space leaks) |
2024-12-22 05:43:35 +0100 | <haskellbridge> | <Bowuigi> The Array here was used as if it was a mutable one (it was the original idea, but the name Array was somewhat misleading since it isn't a C array) |
2024-12-22 05:45:26 +0100 | housemate | (~housemate@124.187.109.206) housemate |
2024-12-22 05:49:10 +0100 | xff0x | (~xff0x@p3704193-ipxg12201sapodori.hokkaido.ocn.ne.jp) |
2024-12-22 05:50:33 +0100 | <orangeflu> | well, the idea is to transition to mvectors, but i thought it would be easier. I am also using InputT IO (EmulatorState) in my REPL because i am using haskeline, so not sure how that is going to affect things with mvector. Also, there is also the functionality for reading a file and then ditching the IO after that, before executing |
2024-12-22 05:50:50 +0100 | <orangeflu> | Does that mean now I will need to have IO everywhere? |
2024-12-22 05:51:18 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 265 seconds) |
2024-12-22 05:51:38 +0100 | <haskellbridge> | <Bowuigi> c_wraith you might be able to help more with this, the codebase is in https://github.com/Flu/avr-emulator and the profiling results are in https://paste.tomsmeding.com/b9owLIrr |
2024-12-22 05:51:38 +0100 | <orangeflu> | This seems more trouble than its worth considering I don't even understand how to use, let alone modify all my pure functions into using it atop of my InputT IO stuff |
2024-12-22 05:52:25 +0100 | <haskellbridge> | <Bowuigi> With MVector you need something like IO everywhere yes. Haskell optimization is not for begginners |
2024-12-22 05:52:31 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 05:52:47 +0100 | <haskellbridge> | <Bowuigi> Just like optimization in other languages ofc |
2024-12-22 05:53:42 +0100 | <haskellbridge> | <Bowuigi> There might be a more obvious refactor that we missed tho |