Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 519 520 521 522 523 524 525 526 527 528 529 .. 5022
502,152 events total
2020-10-08 23:02:48 <phadej> there is no "cabal" (lowercase ;)
2020-10-08 23:03:07 <monochrom> We mean cabal-install.
2020-10-08 23:03:24 <phadej> stack doesn't sit on top of cabal-install
2020-10-08 23:03:28 <dminuoso> maralorn: My largest revelation was to see how Applicative and Monad were related. How Monad has a very deep sense of "sequencing" in all its definitions (in a very handwaving sense), while Applicative has a sort of "diamond" branching notion to it.
2020-10-08 23:03:33 <maralorn> phadej: So are they Cabal-files or cabal-install-files?^^
2020-10-08 23:03:40 <phadej> maralorn: Cabal-files
2020-10-08 23:03:55 <dminuoso> It made me realize how the Applicative superclass constraint of Monad feels somewhat wrong, because it suggests a relationship that feels more accidental
2020-10-08 23:03:58 <monochrom> The confusion comes from the executable name "cabal".
2020-10-08 23:04:19 <phadej> it would be very painful if we had two (or more!) non-interoptible package specification formats
2020-10-08 23:05:06 <dolio> dminuoso: But do you know that arrows are also related?
2020-10-08 23:05:17 <dminuoso> dolio: What do you mean?
2020-10-08 23:05:46 <maralorn> dminuoso: I have seen one or two talks about how you can not introspect a Monad, because in a bind anything can happen.
2020-10-08 23:05:48 <phadej> dminuoso: it is "accidental", but also always true in the *specific category* of Haskell
2020-10-08 23:05:51 <phadej> types
2020-10-08 23:05:52 × dhouthoo quits (~dhouthoo@ptr-eiv6509pb4ifhdr9lsd.18120a2.ip6.access.telenet.be) (Quit: WeeChat 2.9)
2020-10-08 23:06:27 <dolio> dminuoso: Arrows are monoids with respect to profunctor composition (plus an extra thing).
2020-10-08 23:06:46 <dminuoso> dolio: Arrow is the one abstraction I've never really understood. :)
2020-10-08 23:06:47 × leungbk quits (~user@2605:e000:1315:706:1e77:a69f:2d77:7de4) (Ping timeout: 240 seconds)
2020-10-08 23:06:57 <dolio> https://homepages.inf.ed.ac.uk/cheunen/publications/2006/arrows/arrows.pdf
2020-10-08 23:06:58 <maralorn> So for me Functor and Aplicative feel kinda close, whereas Monads are really heavy weight.
2020-10-08 23:07:07 <phadej> Arrows are very ad-hoc abstraction
2020-10-08 23:07:33 <phadej> the `arr` doesn't fit.
2020-10-08 23:07:37 <dminuoso> maralorn: The relationship Im getting at, is that each Monad induces a trivial Applicative instance, rather than "Applicative being a sort of precursor to Monad"
2020-10-08 23:08:44 <dminuoso> dolio: Cheers! A very brief skim suggests this should be readable with my expertise. Ill crunch that on the weekend
2020-10-08 23:09:33 <maralorn> dminuoso: I am not sure I understand. Each Monoid induces a trivial Semigroup instance sounds to me nearly equivalent to "Semigroup being a sort of precursor to Monoid"
2020-10-08 23:09:46 siloxid joins (~user@unaffiliated/siloxid)
2020-10-08 23:09:58 <phadej> maralorn: not true.
2020-10-08 23:10:02 <dolio> It won't make arrows any more relevant, but it's an amusing fact.
2020-10-08 23:10:08 <phadej> Monoid is "Semigroup + unit"
2020-10-08 23:10:19 <phadej> but (<*>) and (>>=) are very different
2020-10-08 23:10:43 × Tuplanolla quits (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) (Ping timeout: 260 seconds)
2020-10-08 23:10:46 <phadej> or liftA2 (,) and join -- if you look for more "categorical" members
2020-10-08 23:10:49 <maralorn> Ah, okay.
2020-10-08 23:11:07 <monochrom> What is "precursor"? Does it carry a historical view, or is it simply logical subsumption?
2020-10-08 23:11:34 <monochrom> or something a bit different from both?
2020-10-08 23:11:54 <maralorn> You are saying we could give a different applicative instance for a Monad, but having another semigroup for a monoid would just violate the definition.
2020-10-08 23:12:04 <dminuoso> monochrom: Just a handwaving term
2020-10-08 23:12:11 <phadej> maralorn: in Haskell no
2020-10-08 23:12:43 × revprez_1nzio quits (~revprez_a@pool-108-49-213-40.bstnma.fios.verizon.net) (Ping timeout: 260 seconds)
2020-10-08 23:12:57 redmynk joins (~redmynk@2804:1b2:180:5c13:a8b7:4418:5b7e:8baa)
2020-10-08 23:13:23 <maralorn> phadej: Because of the choosen hierarchy and the laws to combine them?
2020-10-08 23:13:24 <dolio> But there are other semigroup structures on various monoids. They're just not the one used in the monoid.
2020-10-08 23:13:27 <phadej> but I think that in some category there could be Applicative-like things and Monad-like things for some functor, which aren't compatible
2020-10-08 23:13:31 revprez_anzio joins (~revprez_a@pool-108-49-213-40.bstnma.fios.verizon.net)
2020-10-08 23:14:00 <phadej> dolio: monoid is (carrier set, <>, mempty)
2020-10-08 23:14:14 <dminuoso> maralorn: What Im about to say requires some long thinking and building up intuition to make real sense, so take this with a grain of salt and not too literally.
2020-10-08 23:14:14 <dolio> I know what a monoid is.
2020-10-08 23:15:24 <phadej> there are different applicative strucures for `f` in Haskell too, ZipList and ordinary [] instance
2020-10-08 23:15:44 <dminuoso> maralorn: Monad is somehow about `sequencing` (and I mean this more abstract than just effects). Applicative otoh is rather a diamond that branches in parallel and joins again.
2020-10-08 23:15:45 <phadej> but having them different won't be very good idea
2020-10-08 23:16:15 <phadej> i.e. if Applicative weren't superclass of Monad, and Applicative [] were ZipList like
2020-10-08 23:16:26 <maralorn> I have to say in the last few weeks I kinda got the impression, that having a monoid class was a mistake. I have observed multiple occasions where people assumed the wrong of multiple possible monoid instances for some type and got subtle bugs because of that.
2020-10-08 23:16:44 <dminuoso> maralorn: The fact that Applicative usually carries "sequencing semantics" arises from the fact that the superclass constraint demands the Applicative instance and Monad instance be coherent. So as long as we have a Monad instance, the Applicative diamond is a sort of "go left side, and *then* to right side, and *then* join together"
2020-10-08 23:17:09 <dminuoso> These coherence rules exist for good reasons, but they do lead to Applicative looking too much like Monad most of the time.
2020-10-08 23:17:18 <dolio> No, Applicative is about sequencing, because it's not commutative.
2020-10-08 23:19:40 <dminuoso> dolio: Can you elaborate?
2020-10-08 23:19:50 <phadej> it can be commutative though :)
2020-10-08 23:20:19 <maralorn> e.g. (<>) :: (a -> a) -> (a -> a)
2020-10-08 23:20:39 <phadej> f <*> x can be (&) <$> x <*> f
2020-10-08 23:21:33 <dolio> Monads can be commutative.
2020-10-08 23:21:59 <phadej> you cannot really do `k` "first" in `m >>= k`
2020-10-08 23:22:05 <phadej> there is dependency
2020-10-08 23:22:14 <phadej> and I think that's what is dminuoso is after
2020-10-08 23:22:27 <phadej> being too pedantic doens't help
2020-10-08 23:22:59 <dminuoso> As a particular example, Haxl is a real-world example of how Applicatives let you explore parallel code.
2020-10-08 23:24:12 <dolio> It is an over-generalization to say that Applicative is "about" the use case of haxl.
2020-10-08 23:24:31 <phadej> I don't think it's too far fetched
2020-10-08 23:24:42 snakemas1 joins (~snakemast@213.100.206.23)
2020-10-08 23:24:55 <phadej> most intersting Applicative usages are exploiting the interspectability of Applicative computations
2020-10-08 23:24:58 × nineonine quits (~nineonine@216.81.48.202) (Remote host closed the connection)
2020-10-08 23:25:11 <phadej> haxl is very aggressive, so in a sense a good example
2020-10-08 23:25:27 <phadej> optparse-applicative is another one, less controversial maybe
2020-10-08 23:26:07 <dminuoso> Overall, Applicative seems very underused. Mostly, we just use the convenient interface of `ap` but with Monad semantics.
2020-10-08 23:26:34 <dminuoso> At least for non-library writers.
2020-10-08 23:27:22 <phadej> there aren't many non-Monad Applicatives
2020-10-08 23:27:28 <dminuoso> It's pretty much that coherence law I referenced earlier that mostly puts Applicative into the shadows
2020-10-08 23:27:30 leungbk joins (~user@cpe-104-33-52-83.socal.res.rr.com)
2020-10-08 23:27:36 <maralorn> There should be a significant difference between applicative parsers and monodal parsers, right?
2020-10-08 23:27:57 <maralorn> An applicative parser might be much better optimizable?
2020-10-08 23:27:58 × leungbk quits (~user@cpe-104-33-52-83.socal.res.rr.com) (Remote host closed the connection)
2020-10-08 23:28:06 <phadej> maralorn: Applicative parsers is regex-applicative
2020-10-08 23:28:10 <dolio> Anyhow, the commutative point is that Applicative allows for things where `f <*> x` is not the same as `x <**> f` (assuming I got that right). This means that there is a well-defined sequence that the operations have been combined in, even if the semantics decide that is irrelevant.
2020-10-08 23:28:13 <dminuoso> maralorn: Better yet, parsers based on selective functors!
2020-10-08 23:28:27 <dminuoso> (selective functors are a breed between monadic and applicative)
2020-10-08 23:28:43 <dminuoso> With selective parsers, you get static analyzability but dynamic choices of subsequent effects. :)
2020-10-08 23:29:02 <phadej> with observable equality (to recognise recursion) you get CFG (check Earley)
2020-10-08 23:29:05 × snakemas1 quits (~snakemast@213.100.206.23) (Ping timeout: 240 seconds)
2020-10-08 23:30:25 × frdg quits (47b88ff9@pool-71-184-143-249.bstnma.fios.verizon.net) (Remote host closed the connection)
2020-10-08 23:30:42 <dminuoso> If I can convince my employer to spend a few weeks, I'd love to make a optparse-selective.
2020-10-08 23:32:31 <dminuoso> dolio: I see, well, I'd rather consider that a case of "associativity" than "sequencing" in some abtract sense.
2020-10-08 23:32:44 <dolio> I'm not even sure the characterization makes sense with Haxl, because the 'join' part is monad, right?
2020-10-08 23:33:01 <phadej> dminuoso: what would you need selective power for there?
2020-10-08 23:33:12 <dolio> Sequences are the primordial associative structure.
2020-10-08 23:33:39 × GyroW_ quits (~GyroW@unaffiliated/gyrow) (Quit: Someone ate my pie)
2020-10-08 23:33:55 GyroW joins (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be)
2020-10-08 23:33:55 × GyroW quits (~GyroW@ptr-48ujrfd1ztq5fjywfw3.18120a2.ip6.access.telenet.be) (Changing host)
2020-10-08 23:33:55 GyroW joins (~GyroW@unaffiliated/gyrow)
2020-10-08 23:34:27 <dolio> Anyhow, I could maybe agree that Applicative is about sequences of things, and Monad is about nested things, and what Haxl does is take advantage that you can parallelize sequences of things.
2020-10-08 23:34:43 <dminuoso> phadej: Oh just parsing differently depending on previous flags. Nothing too fancy really
2020-10-08 23:34:54 vicfred joins (~vicfred@unaffiliated/vicfred)

All times are in UTC.