Newest at the top
2024-12-22 05:49:10 +0100 | xff0x | (~xff0x@p3704193-ipxg12201sapodori.hokkaido.ocn.ne.jp) |
2024-12-22 05:45:26 +0100 | housemate | (~housemate@124.187.109.206) housemate |
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:41:47 +0100 | <c_wraith> | (It's likely to not avoid space leaks) |
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: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:40:24 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 246 seconds) |
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: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:37:37 +0100 | <c_wraith> | If you're using IO mutable vectors, ignore everything about ST. |
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:36:30 +0100 | <haskellbridge> | <Bowuigi> What |
2024-12-22 05:36:02 +0100 | <orangeflu> | how do i return an immutable value? |
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:00 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
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: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:32:43 +0100 | <haskellbridge> | <Bowuigi> orangeflu you have to create the MVector in IO, not in ST |
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:28:35 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 265 seconds) |
2024-12-22 05:27:45 +0100 | aforemny | (~aforemny@89.244.199.39) aforemny |
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:24:27 +0100 | machinedgod | (~machinedg@d108-173-18-100.abhsia.telus.net) (Ping timeout: 276 seconds) |
2024-12-22 05:23:56 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 05:19:06 +0100 | <orangeflu> | lose the vector, right? |
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: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:18:26 +0100 | <monochrom> | Are they really non-isomorphic to relays? |
2024-12-22 05:17:16 +0100 | <haskellbridge> | <thirdofmay18081814goya> we're talking about e.g. Yampa switches here right? |
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:16:00 +0100 | <haskellbridge> | <thirdofmay18081814goya> like network switches |
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:14:56 +0100 | <monochrom> | or 3 states if they are {0, 1, neither} |
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:13:56 +0100 | <monochrom> | A stream of booleans? |
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:36 +0100 | <haskellbridge> | <thirdofmay18081814goya> what's the right way to think of switches in FRP? |
2024-12-22 05:13:30 +0100 | <haskellbridge> | <thirdofmay18081814goya> hm |
2024-12-22 05:13:07 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) (Ping timeout: 265 seconds) |
2024-12-22 05:11:32 +0100 | dostoevsky | (~dostoevsk@user/dostoevsky) (Quit: Leaving) |
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:09:12 +0100 | <orangeflu> | i think i made it work somehow |
2024-12-22 05:08:34 +0100 | merijn | (~merijn@128-137-045-062.dynamic.caiway.nl) merijn |
2024-12-22 05:04:22 +0100 | L29Ah | (~L29Ah@wikipedia/L29Ah) () |
2024-12-22 05:01:47 +0100 | <orangeflu> | probably because i am running this in main |
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:14 +0100 | <c_wraith> | ST is designed to prevent mutable values from leaking into pure code. |
2024-12-22 05:00:58 +0100 | <orangeflu> | leak? |
2024-12-22 05:00:48 +0100 | <orangeflu> | Couldn't match type: M.MVector s Int with: IO a0 |
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 |