Newest at the top
| 2025-12-02 16:27:15 +0100 | <tomsmeding> | because ListT "means" that you're doing nondeterminism and you want all possible results, and that's very much not what you're doing |
| 2025-12-02 16:26:48 +0100 | <kuribas> | tomsmeding: actually I _can_ use ListT for this, why don't you like it? |
| 2025-12-02 16:26:14 +0100 | machinedgod | (~machinedg@d75-159-126-101.abhsia.telus.net) machinedgod |
| 2025-12-02 16:25:40 +0100 | <tomsmeding> | (if you really want) |
| 2025-12-02 16:25:34 +0100 | <tomsmeding> | if you know that the monoid will be some kind of list, you can optimise with a mutable vector, for example |
| 2025-12-02 16:23:42 +0100 | <tomsmeding> | I don't think you can fix this problem in general, it depends on the particular complexity of your <> |
| 2025-12-02 16:23:29 +0100 | <tomsmeding> | I guess you can bake the Endo trick in the monad to re-associate the <> calls if you want, but then that would work only for monoids that want to associate to the right |
| 2025-12-02 16:22:44 +0100 | <tomsmeding> | looks like <> |
| 2025-12-02 16:22:31 +0100 | <tomsmeding> | this thing? https://hackage.haskell.org/package/monad-chronicle-1.1/docs/Control-Monad-Chronicle.html#t:Chroni… |
| 2025-12-02 16:22:24 +0100 | <merijn> | something existed that was a better Writter beyond just strict :p |
| 2025-12-02 16:22:12 +0100 | <kuribas> | Hmm right, ListT cannot be used for coroutines. |
| 2025-12-02 16:22:04 +0100 | <merijn> | I was thinking something like Chronicle or seomthing? |
| 2025-12-02 16:22:02 +0100 | <tomsmeding> | (C.M.T.Writer.CPS is just a state monad) |
| 2025-12-02 16:21:39 +0100 | <tomsmeding> | if your <> is expensive, you're out of luck |
| 2025-12-02 16:21:29 +0100 | <tomsmeding> | it still can't do better than just using <> on your things |
| 2025-12-02 16:21:17 +0100 | <tomsmeding> | merijn: that's just for strictness, if you mean Control.Monad.Trans.Writer.CPS |
| 2025-12-02 16:21:05 +0100 | <merijn> | There was an optimised writer somewhere too |
| 2025-12-02 16:21:04 +0100 | <kuribas> | yeah |
| 2025-12-02 16:20:57 +0100 | <tomsmeding> | but DList or an Endo wrapper or something else can fix that |
| 2025-12-02 16:20:44 +0100 | <tomsmeding> | the problem with writer is that it just <>'s your lists, and probably in the wrong order, so you're going to get O(n^2) behaviour |
| 2025-12-02 16:20:06 +0100 | <tomsmeding> | or execWriterT (mapM_ _ input) [] |
| 2025-12-02 16:19:32 +0100 | <kuribas> | I suppose the mapAccumL is easier to understand. |
| 2025-12-02 16:19:32 +0100 | <tomsmeding> | meh it's not in base |
| 2025-12-02 16:19:14 +0100 | <lambdabot> | Suggested fix: |
| 2025-12-02 16:19:14 +0100 | <lambdabot> | Variable not in scope: concatMapM |
| 2025-12-02 16:19:14 +0100 | <lambdabot> | error: [GHC-88464] |
| 2025-12-02 16:19:12 +0100 | <tomsmeding> | :t concatMapM |
| 2025-12-02 16:18:59 +0100 | <tomsmeding> | it creates entirely the wrong intuition for what you're trying to do |
| 2025-12-02 16:18:45 +0100 | <tomsmeding> | please don't use ListT for this |
| 2025-12-02 16:18:37 +0100 | <tomsmeding> | okay I get it now |
| 2025-12-02 16:18:35 +0100 | <tomsmeding> | _right_ |
| 2025-12-02 16:18:28 +0100 | <tomsmeding> | oh but the `col <- input` does do the mapping |
| 2025-12-02 16:18:20 +0100 | <kuribas> | I mean, this is concatMap, with effects, no? |
| 2025-12-02 16:17:34 +0100 | <tomsmeding> | that's not what ListT does |
| 2025-12-02 16:17:31 +0100 | <tomsmeding> | that's what a writer monad does |
| 2025-12-02 16:17:27 +0100 | <tomsmeding> | isn't what you are trying to do, outputting lists of things at various points in the computation, and then at the end you want the concatenated list of all of those? |
| 2025-12-02 16:16:56 +0100 | <kuribas> | tomsmeding: That would mean another monad in the stack, no? |
| 2025-12-02 16:15:58 +0100 | <tomsmeding> | kuribas: are you sure you're not confusing ListT for a writer monad? |
| 2025-12-02 16:15:53 +0100 | <kuribas> | right, sorry... |
| 2025-12-02 16:15:10 +0100 | <kuribas> | hmm, missing a "lift". |
| 2025-12-02 16:15:09 +0100 | <tomsmeding> | and where fromList is toList? |
| 2025-12-02 16:14:36 +0100 | <kuribas> | ah input should be "fromFoldable input" |
| 2025-12-02 16:14:07 +0100 | <kuribas> | tomsmeding: fromFoldable and fromList |
| 2025-12-02 16:13:24 +0100 | <tomsmeding> | oh |
| 2025-12-02 16:13:18 +0100 | <tomsmeding> | kuribas: I don't see any ListT? |
| 2025-12-02 16:10:36 +0100 | <kuribas> | tomsmeding: the ListT version would look something like this (untested) https://gist.github.com/kuribas/bfeb96b35699d6a4f64b50f4732d62b9 |
| 2025-12-02 16:09:31 +0100 | vanishingideal | (~vanishing@user/vanishingideal) vanishingideal |
| 2025-12-02 16:00:59 +0100 | tt123160 | (~tt1231@2603:6010:8700:4a81:a4f6:acff:fe95:3803) tt1231 |
| 2025-12-02 15:54:31 +0100 | CiaoSen | (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 255 seconds) |
| 2025-12-02 15:53:19 +0100 | <kuribas> | I mean I can use this over ListT or Streamly |