Newest at the top
2025-01-31 01:26:02 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-01-31 01:26:01 +0100 | <euouae> | I think I imagine state different from State or whatever |
2025-01-31 01:25:38 +0100 | <euouae> | now x <- [1,1,1] does not have enough information for you to distinguish one 1 from another 1, even though they're positionally different |
2025-01-31 01:25:24 +0100 | <dminuoso> | euouae: But Im asking about where that state machine is. What's the state here? |
2025-01-31 01:25:01 +0100 | <euouae> | In `do x <- [1,2,3];` you're getting a slice of that funky composability |
2025-01-31 01:24:57 +0100 | <dminuoso> | In the above example, `x` represents some non-deterministic choice of [1,2,3] |
2025-01-31 01:24:01 +0100 | <dminuoso> | The non-determinism approach has the benefit of accurately modelling non-deterministic algorithms. |
2025-01-31 01:23:24 +0100 | <dminuoso> | euouae: `do x <- [1,2,3]; ...` -> how do you obtain the state? |
2025-01-31 01:23:18 +0100 | <euouae> | As long as I can squeeze real-world results from my intuition I'm not too bothered by its rough edges |
2025-01-31 01:23:07 +0100 | <dminuoso> | euouae: So here's why your state machine logic does not quite work out: |
2025-01-31 01:23:01 +0100 | geekosaur | wonders if it's the same viewpoint used with the comonad |
2025-01-31 01:22:08 +0100 | <dminuoso> | Im not sure about the exact mental gymnastics required to see the state machine, but thats probably because Im flexed very differently |
2025-01-31 01:21:37 +0100 | <dminuoso> | I mean if you insist on that state machine model, perhaps you could think of it as a non-deterministic state machine (along the lines of an NFA) |
2025-01-31 01:20:44 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) bitdex |
2025-01-31 01:20:41 +0100 | <euouae> | anyway, it's been said that everything can be considered a state machine, it's just a mental mode I have... I'm just glad I put it to some test and it didn't immediately collapse |
2025-01-31 01:20:08 +0100 | <euouae> | a composable state machine, as I said above |
2025-01-31 01:20:02 +0100 | <euouae> | It is no less a state machine however |
2025-01-31 01:19:52 +0100 | <dminuoso> | euouae: But its that *funkily* behavior that is the core essence of that instance. |
2025-01-31 01:19:23 +0100 | <geekosaur> | as dminuoso said, it's acting as a "poor man's set" (for technical reasons we can't actually make a Set a Monad); all the answers are equally ranked, their position in the list isn't relevant |
2025-01-31 01:19:09 +0100 | <euouae> | Here's how lists are state machines: No input variable, only state; its output is the state. They compose funkily, but still. |
2025-01-31 01:18:34 +0100 | <dminuoso> | And >>= lets you take a further non-determistic choice |
2025-01-31 01:18:24 +0100 | ec | (~ec@gateway/tor-sasl/ec) ec |
2025-01-31 01:18:11 +0100 | <dminuoso> | euouae: Say if we imagine a chess computer, we could think of [move1, move2, move3, move4] as not a collection of possibilities, but rather some non-deterministic choice of *one* move. |
2025-01-31 01:17:35 +0100 | down200 | (~down200@shell.lug.mtu.edu) down200 |
2025-01-31 01:15:52 +0100 | <geekosaur> | so, the list monad models a computation that gives you all possible solutions, whereas a Maybe version of the same computation gives you at most one solution (and can be thought of as "first solution, if any") |
2025-01-31 01:15:24 +0100 | monochrm | monochrom |
2025-01-31 01:15:24 +0100 | monochrom | (trebla@216.138.220.146) (Ping timeout: 260 seconds) |
2025-01-31 01:15:11 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds) |
2025-01-31 01:14:31 +0100 | <dminuoso> | (I say squinting because lists are not sets and have a bit more structure) |
2025-01-31 01:13:27 +0100 | monochrm | (trebla@216.138.220.146) |
2025-01-31 01:13:19 +0100 | <euouae> | if you can elaborate? |
2025-01-31 01:13:12 +0100 | <dminuoso> | The monad instance of [] roughly models non-determinism (with a bit of squinting) |
2025-01-31 01:12:50 +0100 | <dminuoso> | euouae: [] seems to breaks a state machine viewpoint. |
2025-01-31 01:12:10 +0100 | down200 | (~down200@shell.lug.mtu.edu) (Ping timeout: 244 seconds) |
2025-01-31 01:12:02 +0100 | <euouae> | well sure, adopting just one is good enough for me. I'll adopt more if the need arises |
2025-01-31 01:11:39 +0100 | <dminuoso> | Though Im a flexible, and I have some alternate intuitions that I can switch to depending on the problem. |
2025-01-31 01:10:43 +0100 | <euouae> | and it sort of occurred to me that a lot of uses of do/>>= are doing basically stuff like that |
2025-01-31 01:10:39 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-01-31 01:10:34 +0100 | <dminuoso> | The mental model I have settled on over the years is that `Monads` model sequencing. |
2025-01-31 01:10:25 +0100 | <euouae> | obviously it's both tiresome to manually typecheck everything when reading code & provides no intuition. the megaparsec code I saw earlier with a bunch of >>= inside a do was clear in what it was doing: it was combining a bunch of parser combinators, starting from some initial string-to-be-parsed, and outputted either a parsed data structure or parser error |
2025-01-31 01:10:04 +0100 | <dminuoso> | euouae: Fair enough. |
2025-01-31 01:08:58 +0100 | <euouae> | dminuoso: I'm not trying to summarize all monads or anything of the short, just to adopt a mental mode |
2025-01-31 01:08:34 +0100 | alfiee | (~alfiee@user/alfiee) (Ping timeout: 260 seconds) |
2025-01-31 01:05:18 +0100 | rstromlund | (~user@user/rstromlund) (Ping timeout: 252 seconds) |
2025-01-31 01:04:03 +0100 | alfiee | (~alfiee@user/alfiee) alfiee |
2025-01-31 01:02:54 +0100 | <monochrom> | That one I agree with you. It's the equivalent of a biology tutorial saying "natural selection is described as survival of fittest" |
2025-01-31 01:01:44 +0100 | <dminuoso> | As you could gradually introduce more instances and different "flavours" |
2025-01-31 01:01:22 +0100 | <dminuoso> | If Monad tutorials started with just proclamining `Monads are just IO`, this would be a feasible strategy. |
2025-01-31 01:01:00 +0100 | <dminuoso> | monochrom: Sure, but that particular wikibooks article is not about promoting any learning process. |
2025-01-31 01:00:41 +0100 | <monochrom> | Consider how "numbers" are taught beginning with natural numbers and, eventually, if you go to math grad school, ending with algebraic number fields. Not the other way round. |