Logs: freenode/#haskell
| 2020-10-08 23:34:58 | → | frdg joins (47b88ff9@pool-71-184-143-249.bstnma.fios.verizon.net) |
| 2020-10-08 23:35:14 | <dminuoso> | It was mostly just "would be nice to have this" cases. |
| 2020-10-08 23:36:00 | × | acarrico quits (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net) (Ping timeout: 272 seconds) |
| 2020-10-08 23:36:44 | → | jedws joins (~jedws@121.209.161.98) |
| 2020-10-08 23:37:07 | <dminuoso> | dolio: At the end this has become a discussion about what particular intutions/mind models we have adapted. My mind model is based on thinking of `Day` and (:.:), or (<*>) and (>>=). One comes with a sequencing of effects, data dependencies, the other does not. |
| 2020-10-08 23:37:21 | <maralorn> | Is there an applicative or selective parsing library? |
| 2020-10-08 23:37:36 | <dminuoso> | maralorn: optparse-applicative is an applicative option parsing library |
| 2020-10-08 23:37:44 | <dminuoso> | https://github.com/J-mie6/ParsleyHaskell |
| 2020-10-08 23:38:14 | <dminuoso> | Is an example of a selective parser combinator library that analyzes and optimizes your parser in TH. |
| 2020-10-08 23:38:18 | × | ClaudiusMaximus quits (~claude@unaffiliated/claudiusmaximus) (Quit: ->) |
| 2020-10-08 23:38:53 | → | acarrico joins (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net) |
| 2020-10-08 23:39:08 | <maralorn> | I think you can‘t have a lift instance for monadic parsers, is that right? |
| 2020-10-08 23:40:32 | <maralorn> | Wait that repo has no README and is not on hackage? :-( |
| 2020-10-08 23:40:39 | <dminuoso> | dolio: So what you mentioned about non-commutative applicatives, I realized my mistake. So I'd say you still have conceptual parallel branching, but the combination of results has some sequencing yes. |
| 2020-10-08 23:40:40 | × | conal_ quits (~conal@66.115.157.46) (Quit: Computer has gone to sleep.) |
| 2020-10-08 23:40:55 | <dminuoso> | But based on that, I would not go as far as saying that "sequencing is the defining characteristic of applicative" |
| 2020-10-08 23:41:30 | <dminuoso> | Consider: |
| 2020-10-08 23:41:54 | <dolio> | The whole difference between `f <*> x` and `x <**> f` in a non-commutative Applicative is that it won't in general be combining the same 'results'. |
| 2020-10-08 23:41:55 | <dminuoso> | We could think of Applicative as being desribed by `f a -> f b -> f (a, b)` as its signature method |
| 2020-10-08 23:42:12 | <dminuoso> | So yeah, there's a clear ordering in the tuple, but the core essence lies in what happens with the `f` |
| 2020-10-08 23:42:18 | <ghoulguy> | If we wanted to speculate on the defining characteristic we could start by staring at the free structure: http://hackage.haskell.org/package/free-5.1.4/docs/Control-Applicative-Free.html#t:Ap |
| 2020-10-08 23:42:56 | <dminuoso> | So `f a -> f b -> f (a, b)` suggests potential branching as opposed to linear data dependencies. static effects as opposed to dynamic effects. |
| 2020-10-08 23:43:02 | <ghoulguy> | it's a sequence of primitives |
| 2020-10-08 23:43:10 | <ghoulguy> | the branching doesn't matter because of the associative-like law |
| 2020-10-08 23:43:37 | <ghoulguy> | I'm late to to the party so you might already be past that |
| 2020-10-08 23:44:32 | <ghoulguy> | it's an ordered sequence of some primitives combined with a pure function to make all the type-indexes match up |
| 2020-10-08 23:44:45 | × | xff0x quits (~fox@2001:1a81:53a8:5900:4dd1:b846:131b:3964) (Ping timeout: 272 seconds) |
| 2020-10-08 23:45:15 | → | xff0x joins (~fox@2001:1a81:53a8:5900:18dc:5fd3:ab0c:ba1c) |
| 2020-10-08 23:45:24 | <dminuoso> | sure, that's just paraphrasing what dolio just said though with more elaborate terms. :) |
| 2020-10-08 23:45:25 | × | proofofme quits (~proofofme@184-96-74-65.hlrn.qwest.net) (Remote host closed the connection) |
| 2020-10-08 23:45:33 | <ghoulguy> | oh, maybe that means dolio is right! |
| 2020-10-08 23:45:56 | × | MVQq quits (~anja@198.254.202.72) (Quit: q) |
| 2020-10-08 23:46:09 | <dminuoso> | Well, you are still free to interpret these in parallel |
| 2020-10-08 23:46:24 | <dminuoso> | Or you could interpret the right first, then the left.. |
| 2020-10-08 23:46:30 | → | MarcelineVQ joins (~anja@198.254.202.72) |
| 2020-10-08 23:46:39 | <dminuoso> | There's nothing about it that forces you into an effect order |
| 2020-10-08 23:46:56 | <dminuoso> | Yes, at the end you have a particular ordering in which you combine the results again |
| 2020-10-08 23:47:12 | <dminuoso> | Ap could have also been defined as |
| 2020-10-08 23:47:16 | <dolio> | If Applicatives are 'about' parallelism, why are there so many examples where you can't do them in parallel, because the order matters? |
| 2020-10-08 23:47:25 | <dminuoso> | Ap :: f a -> Ap f b -> Ap f (a, b) |
| 2020-10-08 23:47:35 | <ghoulguy> | Some applicatives allow you to work in parallel, but that's not inherent to applicatives |
| 2020-10-08 23:47:47 | <dminuoso> | dolio: Because most of the time you have a Monad instance, and then the coherence laws matter. |
| 2020-10-08 23:47:50 | <dolio> | Shouldn't those be illegal? |
| 2020-10-08 23:48:01 | <dminuoso> | And it's the coherence laws that force the Applicative to have the Monad semantics. |
| 2020-10-08 23:48:14 | <dminuoso> | And the monad itself is inherently sequenced because of that data dependency in (>>=) |
| 2020-10-08 23:48:42 | <dminuoso> | dolio: That's a bit more extreme than what I suggested, but yeah, that's the crux of it! |
| 2020-10-08 23:48:57 | <dminuoso> | They are just trivial instances induced by the monad |
| 2020-10-08 23:48:59 | <dolio> | What's the proof that there area no non-monad Applicatives where ordering matters? |
| 2020-10-08 23:49:38 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2020-10-08 23:49:45 | <dminuoso> | Look, I think you're taking this a bit too exact. |
| 2020-10-08 23:50:02 | <dminuoso> | % :t (<*>) |
| 2020-10-08 23:50:03 | <yahb> | dminuoso: Applicative f => f (a -> b) -> f a -> f b |
| 2020-10-08 23:50:31 | <dminuoso> | This f has no sequencing built into its type |
| 2020-10-08 23:50:46 | <dminuoso> | And if we stare at Day we see this deeper again |
| 2020-10-08 23:50:49 | <c_wraith> | There are monads where the order doesn't matter outside of the data dependency. Maybe, for instance. |
| 2020-10-08 23:50:51 | <dolio> | I think I used one recently, actually. It was basically state composed with writer. |
| 2020-10-08 23:50:51 | <dminuoso> | % data Day f g a where Day :: f x -> g y -> (x -> y -> a) -> Day f g a |
| 2020-10-08 23:50:52 | <yahb> | dminuoso: |
| 2020-10-08 23:50:58 | <ghoulguy> | Monad doesn't even enforce an "effect order" which is how we get the reverse state examples |
| 2020-10-08 23:51:05 | <dminuoso> | ghoulguy: Of course they do! |
| 2020-10-08 23:51:07 | <dminuoso> | % :t (>>=) |
| 2020-10-08 23:51:07 | <yahb> | dminuoso: Monad m => m a -> (a -> m b) -> m b |
| 2020-10-08 23:51:13 | <dminuoso> | It's buried right into the type here. |
| 2020-10-08 23:51:28 | <dolio> | Also the one people use that collects multiple error messages. |
| 2020-10-08 23:51:29 | <dminuoso> | You cant run `m b` without having an `a` to begin with |
| 2020-10-08 23:51:29 | <c_wraith> | Reader and Identity for the trivial examples |
| 2020-10-08 23:51:45 | <c_wraith> | dminuoso: Proxy? |
| 2020-10-08 23:51:54 | <ghoulguy> | dminuoso: who said I had to "run" m a to get an a? |
| 2020-10-08 23:52:07 | <ghoulguy> | It's my m |
| 2020-10-08 23:52:33 | <dolio> | There were people a while back talking about a sub-monad of IO that could have its operations re-ordered, too. |
| 2020-10-08 23:52:49 | <dolio> | ACIO or something. |
| 2020-10-08 23:53:05 | <c_wraith> | > undefined >>= undefined :: Proxy () |
| 2020-10-08 23:53:08 | <lambdabot> | Proxy |
| 2020-10-08 23:53:09 | → | g-belmonte joins (~g-belmont@2804:14c:8786:9312:3638:eaf5:dc36:146d) |
| 2020-10-08 23:53:35 | <ghoulguy> | dminuoso: I think you're making too much out of the data dependency suggested by the type of (>>=) and the lack of that same obvious data dependency in (<*>) |
| 2020-10-08 23:53:37 | <c_wraith> | no values of a, b, Proxy a, or Proxy b |
| 2020-10-08 23:53:47 | <c_wraith> | (as inputs, anyway) |
| 2020-10-08 23:53:57 | <dminuoso> | ghoulguy: Let's take another approach then. |
| 2020-10-08 23:54:10 | <dminuoso> | Can we agree that the signature method of Monad is `m :.: m ~> m` ? |
| 2020-10-08 23:54:27 | × | ericsagnes quits (~ericsagne@2405:6580:0:5100:1c60:69e9:f30b:d7e8) (Ping timeout: 260 seconds) |
| 2020-10-08 23:54:31 | <dminuoso> | And equivalently the signature method of Applicative is: m `Day` m ~> m ? |
| 2020-10-08 23:54:50 | <dminuoso> | (Perhaps I shouldnt have used backticks in the first example, that seems mildly confusing) |
| 2020-10-08 23:55:21 | <maralorn> | :t Day |
| 2020-10-08 23:55:23 | <lambdabot> | error: Data constructor not in scope: Day |
| 2020-10-08 23:55:28 | <dminuoso> | % data Day f g a where Day :: f x -> g y -> (x -> y -> a) -> Day f g a |
| 2020-10-08 23:55:28 | <yahb> | dminuoso: |
| 2020-10-08 23:55:33 | <maralorn> | % :t Day |
| 2020-10-08 23:55:34 | <yahb> | maralorn: f x -> g y -> (x -> y -> a) -> Day f g a |
| 2020-10-08 23:56:07 | <maralorn> | Why is it called Day? |
| 2020-10-08 23:56:28 | <dminuoso> | maralorn: It's named after Brian Day who introduced the day convolution. |
| 2020-10-08 23:56:45 | <maralorn> | huh |
| 2020-10-08 23:56:47 | × | falafel quits (~falafel@2605:e000:1527:d491:1ccf:5c8d:7928:e9cc) (Ping timeout: 260 seconds) |
| 2020-10-08 23:57:58 | <dminuoso> | ghoulguy: The abstract, handwaving, sequencing (of effects) semantics are buried into (:.:). If we think of functors as effects in Haskell, the (associative) composition of two functors is almost literally the sequencing of two effects. |
| 2020-10-08 23:58:01 | → | conal joins (~conal@66.115.157.46) |
| 2020-10-08 23:59:39 | <dolio> | You know, GHC does not guarantee that IORef reads/writes appear to happen in a certain order, or even a possible interleaving of orders. |
| 2020-10-08 23:59:44 | <dolio> | I made a model of it in Agda. |
| 2020-10-09 00:00:01 | × | frank001 quits (~frank001@178.162.212.214) () |
| 2020-10-09 00:00:11 | <nshepperd1> | you mean concurrent read/writes? |
| 2020-10-09 00:00:17 | <dolio> | Yeah. |
| 2020-10-09 00:00:23 | <dminuoso> | dolio: Heh, Im waiting for conal to appear and make some note about "IO monad is not even wrong because it has no denotation". :p |
All times are in UTC.