Logs: freenode/#haskell
| 2021-03-12 17:46:00 | <koz_> | Once you're more comfortable, read the pipes tutorial. |
| 2021-03-12 17:46:03 | <fendor> | if your test-suite succeeded, than there is a semi-random change your test-suite would not protext you against |
| 2021-03-12 17:46:09 | × | sord937 quits (~sord937@gateway/tor-sasl/sord937) (Quit: sord937) |
| 2021-03-12 17:46:13 | × | royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Quit: Connection closed) |
| 2021-03-12 17:46:17 | <michaelh> | koz_: Cool, got it |
| 2021-03-12 17:46:32 | → | royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) |
| 2021-03-12 17:46:46 | <koz_> | fendor: Are you talking about property testing? |
| 2021-03-12 17:46:55 | <koz_> | Because that's the closest analogy I can think of to what you're describing. |
| 2021-03-12 17:47:54 | <sm[m]> | I guess "forces full evaluation (before the next step in the do block)" is what I meant by sequentiality |
| 2021-03-12 17:48:07 | <sparsity> | the basic problem with monadic streaming (the lack of commutativity between the monad and the applicative during traversal) can be avoided by using a "scanner" which does the mapAccumL part of traverse, ie, the State monad part, but without trying to commute this Applicative with the list monad |
| 2021-03-12 17:48:19 | <koz_> | sm[m]: Yeah, in _that_ case, sure. |
| 2021-03-12 17:48:33 | <koz_> | sparsity: Or you can just use pipes and never have to think about this ever again. |
| 2021-03-12 17:48:38 | × | borne quits (~fritjof@2a06:8782:ffbb:1337:e811:68d9:a46:a27f) (Ping timeout: 264 seconds) |
| 2021-03-12 17:48:39 | <sparsity> | ie scanners, by restricting the applicative during traversal to State, can manage to do the streaming that is impossible in monadic lists using traverse |
| 2021-03-12 17:48:43 | <koz_> | (like, you're not wrong, but why make your own life harder) |
| 2021-03-12 17:49:01 | <sparsity> | i would argue a scanner is orders of magnitude more somple than conduit |
| 2021-03-12 17:49:04 | × | vavagee quits (~vavagee@122.172.247.204) () |
| 2021-03-12 17:49:04 | × | ixlun quits (~user@109.249.184.132) (Read error: Connection reset by peer) |
| 2021-03-12 17:49:22 | × | ezrakilty quits (~ezrakilty@75-172-115-167.tukw.qwest.net) (Ping timeout: 276 seconds) |
| 2021-03-12 17:49:42 | <koz_> | sparsity: Can you kindly read what I wrote? I didn't mention conduit anywhere. |
| 2021-03-12 17:49:43 | <sparsity> | it also follows the cannonical formalism of the classes of the Haskell Prelude |
| 2021-03-12 17:49:53 | <koz_> | sparsity: YMMV. |
| 2021-03-12 17:49:54 | <sparsity> | sorry, i confuse pipes and conduit |
| 2021-03-12 17:50:04 | → | ixlun joins (~user@109.249.184.132) |
| 2021-03-12 17:50:05 | × | carlomagno quits (~cararell@148.87.23.12) (Remote host closed the connection) |
| 2021-03-12 17:50:11 | <koz_> | I don't think I agree, and arguments from canonicity don't persuade me. |
| 2021-03-12 17:50:17 | <fendor> | koz_, no, property testing does not modify the initial source-coude |
| 2021-03-12 17:50:18 | <koz_> | The Prelude is not so brilliant that we should constantly ape it. |
| 2021-03-12 17:50:20 | <fendor> | *code |
| 2021-03-12 17:50:25 | <koz_> | fendor: Then I dunno. |
| 2021-03-12 17:50:47 | <koz_> | And having to detect the condition you describe _manually_ is annoying and manual labour of exactly the kind I never want to engage in. |
| 2021-03-12 17:50:48 | <sparsity> | koz_: the fundamental classes of the haskell prelude are very solid foundations |
| 2021-03-12 17:50:57 | × | royal_screwup21 quits (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) (Ping timeout: 246 seconds) |
| 2021-03-12 17:51:00 | <koz_> | sparsity: You mean like Alternative, whose laws are _still_ under debate? |
| 2021-03-12 17:51:02 | <sparsity> | the fact they dont extend to the monadic setting is what your discussing |
| 2021-03-12 17:51:04 | <fendor> | A library I found was https://hackage.haskell.org/package/MuCheck which is old and it seems not really easy to use |
| 2021-03-12 17:51:14 | <koz_> | Or MonadPlus, which only exists because of hysterical raisins now? |
| 2021-03-12 17:51:14 | → | monadmatt joins (~user@119-17-128-101.771180.mel.nbn.aussiebb.net) |
| 2021-03-12 17:51:21 | <koz_> | Or MonadZip which is pointlessly over-constrained? |
| 2021-03-12 17:51:26 | <sparsity> | just Traverse |
| 2021-03-12 17:51:33 | <koz_> | You mean Traversable? |
| 2021-03-12 17:51:39 | <sparsity> | yes |
| 2021-03-12 17:51:50 | <sparsity> | thats where the Applicative and the Monad which dont commute in monadic streaming occur |
| 2021-03-12 17:52:05 | <koz_> | Yes, Traversable is good. No, I don't think this is a suitable solution, or any simpler. |
| 2021-03-12 17:52:08 | <koz_> | YMMV. |
| 2021-03-12 17:52:19 | → | carlomagno joins (~cararell@148.87.23.12) |
| 2021-03-12 17:52:22 | <koz_> | You're literally asking for people to think this through _every time thye encounter it_ with no compiler assistance. |
| 2021-03-12 17:52:29 | <koz_> | As opposed to 'use a library and never think about this again'. |
| 2021-03-12 17:52:35 | <sparsity> | which is what is solved using a scanner, which just does the State applicative traversal for implementing MapAccumL which bares resemblance to scan, hence "scanner" |
| 2021-03-12 17:52:38 | <koz_> | I find this creates pointless effort, and is needlessly a trap. |
| 2021-03-12 17:52:47 | <koz_> | Again though, YMMV. |
| 2021-03-12 17:52:56 | <koz_> | If you wanna create work for yourself, you do that. |
| 2021-03-12 17:53:01 | <koz_> | I won't, nor will I recommend it to anyone. |
| 2021-03-12 17:53:39 | → | vavagee_ joins (~vavagee@122.172.247.204) |
| 2021-03-12 17:54:07 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-03-12 17:54:24 | <sparsity> | the idea is that the classes of the Haskell Prelude are *not* written for monads, eg FunctorM which has an instance for monadic lists. so you never encounter this lack of commutativity between the applicative and the monad, in the non-monadic setting |
| 2021-03-12 17:54:38 | → | borne joins (~fritjof@2a06:8782:ffbb:1337:e811:68d9:a46:a27f) |
| 2021-03-12 17:54:48 | <sparsity> | as soon as you try to traverse the monadic list, you run into the problem, and scanners become motivated |
| 2021-03-12 17:54:57 | <sparsity> | its quite natural |
| 2021-03-12 17:55:09 | × | Kaiepi quits (~Kaiepi@47.54.252.148) (Ping timeout: 264 seconds) |
| 2021-03-12 17:55:44 | <sparsity> | the only reason Scanner isnt already part of the Prelude, is beacuse it lacks these monadic variants |
| 2021-03-12 17:55:55 | × | usr25 quits (~usr25@unaffiliated/usr25) (Quit: Leaving) |
| 2021-03-12 17:55:56 | → | royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) |
| 2021-03-12 17:56:12 | × | monadmatt quits (~user@119-17-128-101.771180.mel.nbn.aussiebb.net) (Ping timeout: 246 seconds) |
| 2021-03-12 17:56:19 | <sparsity> | when you go to the monadic setting, Scanner appears between Functor and Traversable |
| 2021-03-12 17:57:08 | → | Kaiepi joins (~Kaiepi@47.54.252.148) |
| 2021-03-12 17:57:28 | <sparsity> | really, traversable is totally hampered in the monadic setting by the lack of commutativity of the applicative used in traversal, and the monad in the monadic list-like thing being traversed |
| 2021-03-12 17:58:00 | <sparsity> | so that in the monadic setting scanning, or only using the State monad for Traverse, becomes a reasonable alternative |
| 2021-03-12 17:58:22 | <sparsity> | the user can implement this, while they would not be able to implement TraversableM |
| 2021-03-12 17:58:34 | × | zebrag quits (~inkbottle@aaubervilliers-654-1-101-29.w86-212.abo.wanadoo.fr) (Quit: Konversation terminated!) |
| 2021-03-12 17:58:45 | × | alx741 quits (~alx741@186.178.108.206) (Ping timeout: 264 seconds) |
| 2021-03-12 17:58:55 | → | zebrag joins (~inkbottle@aaubervilliers-654-1-101-29.w86-212.abo.wanadoo.fr) |
| 2021-03-12 17:59:01 | → | Gurkenglas joins (~Gurkengla@unaffiliated/gurkenglas) |
| 2021-03-12 17:59:09 | × | zgrep quits (~zgrep@ircpuzzles/2015/april-fools/sixth/zgrep) (Quit: It's a quitter's world.) |
| 2021-03-12 17:59:18 | <sparsity> | scannerM :: Monad m => (s -> a -> m (b,s)) -> s -> t m a -> m (t m b,s) |
| 2021-03-12 18:00:05 | × | coot quits (~coot@37.30.55.141.nat.umts.dynamic.t-mobile.pl) (Quit: coot) |
| 2021-03-12 18:00:19 | <sparsity> | implementing (and understanding) one class seems much easier than contending with the whole of the Pipes or Conduit source code |
| 2021-03-12 18:00:37 | → | zgrep joins (~zgrep@ircpuzzles/2015/april-fools/sixth/zgrep) |
| 2021-03-12 18:01:11 | <sparsity> | though i think obviously its more limmeted in utility, i struggle to understand how, I think perhaps it is due to branching combinators |
| 2021-03-12 18:02:24 | × | vavagee_ quits (~vavagee@122.172.247.204) () |
| 2021-03-12 18:02:38 | → | psygate joins (~psygate@unaffiliated/psygate) |
| 2021-03-12 18:05:15 | × | dyeplexer quits (~lol@unaffiliated/terpin) (Remote host closed the connection) |
| 2021-03-12 18:06:57 | → | heatsink joins (~heatsink@2600:1700:bef1:5e10:c79:3d13:d977:c947) |
| 2021-03-12 18:07:01 | <koz_> | I have foo :: [Int] and gap :: Int. Furthermore, foo is non-empty, positive and increasing. I wanna do something like this: grab first element of foo (let's call it x), then drop all subsequent elements that are smaller than (x + gap), then 'send out' x, grab the next element, and keep doing that for the whole list. |
| 2021-03-12 18:07:17 | <koz_> | What's an idiomatic way of writing this without resorting to manual recursion? |
| 2021-03-12 18:08:50 | <sparsity> | seems almost like a builder... folding with reconstructions functions, but including the possibility to discard values |
| 2021-03-12 18:10:11 | <sparsity> | you cant use anything over Foldable for your idomaticness, since traversable is shape preserving i think |
| 2021-03-12 18:11:03 | → | alx741 joins (~alx741@186.178.108.206) |
| 2021-03-12 18:11:04 | × | gentauro quits (~gentauro@unaffiliated/gentauro) (Read error: Connection reset by peer) |
| 2021-03-12 18:11:56 | → | gentauro joins (~gentauro@unaffiliated/gentauro) |
| 2021-03-12 18:12:02 | × | heatsink quits (~heatsink@2600:1700:bef1:5e10:c79:3d13:d977:c947) (Ping timeout: 264 seconds) |
| 2021-03-12 18:12:11 | <sparsity> | i guess you could traverse using Maybe and then do catMaybes after and hope for fusion |
| 2021-03-12 18:14:16 | <sparsity> | which is nice idiomatically as it allows for the use of a "carry" from traverse using State (mapAccum) |
| 2021-03-12 18:14:26 | → | xelxebar_ joins (~xelxebar@gateway/tor-sasl/xelxebar) |
| 2021-03-12 18:15:41 | kaletaa_ | is now known as kaletaa |
| 2021-03-12 18:15:50 | × | xelxebar quits (~xelxebar@gateway/tor-sasl/xelxebar) (Ping timeout: 268 seconds) |
| 2021-03-12 18:17:16 | → | heatsink joins (~heatsink@2600:1700:bef1:5e10:c79:3d13:d977:c947) |
| 2021-03-12 18:17:17 | × | borne quits (~fritjof@2a06:8782:ffbb:1337:e811:68d9:a46:a27f) (Ping timeout: 272 seconds) |
| 2021-03-12 18:19:32 | × | rj quits (~x@gateway/tor-sasl/rj) (Ping timeout: 268 seconds) |
| 2021-03-12 18:21:14 | <monochrom> | The sequence is increasing, so dropWhile is as good as filter. |
All times are in UTC.