tag:blogger.com,1999:blog-7548736674449953374.post5406140203683831707..comments2012-10-28T01:51:03.596+02:00Comments on Nothing Personal: Programming with effects – the story so farPatai Gergelyhttp://www.blogger.com/profile/02405133490768813514noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-7548736674449953374.post-41435121548676805892010-04-20T09:16:02.085+02:002010-04-20T09:16:02.085+02:00It’s probably the best solution if you simply reus...It’s probably the best solution if you simply reuse ideas worth reusing. This post was not intended to be a tutorial, after all, and it skims over some details, e.g. the <a href="http://www.reddit.com/r/haskell/comments/bp4a8/programming_with_effects_the_story_so_far/c0ocu77" rel="nofollow">possible further division of the classes</a> or the issue with the alternative MonadPlus laws mentioned above. Also, equating applicative functors with parallel composition requires quite a bit of handwaving (since effects from the two boxes are not necessarily independent; this is closely related to the issue of commutativity), even if I think that’s the essence of the Applicative class.<br /><br />By the way, I do plan to write a follow-up post to clarify the applicative-parallel-commutative part of the story.Patai Gergelyhttps://www.blogger.com/profile/02405133490768813514noreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-67339340013592027522010-04-19T03:46:15.525+02:002010-04-19T03:46:15.525+02:00These are some fantastic insights. Would it be OK...These are some fantastic insights. Would it be OK if I include some of this material in an upcoming second edition of the Typeclassopedia? Or would you consider writing something about it to contribute yourself?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-35428985669922405982010-04-16T21:24:32.745+02:002010-04-16T21:24:32.745+02:00Yes, I understood. Note that a combinator with tha...Yes, I understood. Note that a combinator with that signature would have to be able to undo function application – how else could it supply inputs to the two constituents? ArrowChoice is a different story, since it’s about multiplexing.Patai Gergelyhttps://www.blogger.com/profile/02405133490768813514noreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-39254114233291967142010-04-16T09:12:18.836+02:002010-04-16T09:12:18.836+02:00To be clear, I meant something like:
cat (a -> ...To be clear, I meant something like:<br />cat (a -> b) x -> cat a x -> cat b xSjoerd Visscherhttps://www.blogger.com/profile/10698430967044536619noreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-52538295688857873682010-04-16T08:48:03.486+02:002010-04-16T08:48:03.486+02:00No, because Applicative doesn’t allow us to make r...No, because Applicative doesn’t allow us to make run-time choice between effects, while that’s exactly the contribution of ArrowChoice. Also, they being duals of each other, the former acts on products, while the latter on sums.Patai Gergelyhttps://www.blogger.com/profile/02405133490768813514noreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-87384396027342702342010-04-13T17:19:37.729+02:002010-04-13T17:19:37.729+02:00Since Arrow is Applicative applied to the target t...Since Arrow is Applicative applied to the target type of category arrows, I wonder if ArrowChoice is Applicative applied to the source type of category arrows.Sjoerd Visscherhttps://www.blogger.com/profile/10698430967044536619noreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-26618232794168114252010-04-13T11:36:02.691+02:002010-04-13T11:36:02.691+02:00Tuple fusion for arrows? That would be nice indeed...Tuple fusion for arrows? That would be nice indeed, because it could be used for any arrow, not just <a href="http://lambda-the-ultimate.org/node/3659" rel="nofollow">CCAs</a>.Patai Gergelyhttps://www.blogger.com/profile/02405133490768813514noreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-45269985012424412112010-04-12T15:58:46.399+02:002010-04-12T15:58:46.399+02:00It might be interesting to do an implementation of...It might be interesting to do an implementation of the arrow syntax with the applicative and category classes. It might even be faster too, as it doesn't require all those tuples.Sjoerd Visscherhttps://www.blogger.com/profile/10698430967044536619noreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-32920330848950427822010-04-12T11:00:27.057+02:002010-04-12T11:00:27.057+02:00WrappedArrow can be used to provide an Applicative...<a href="http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.2.0.0/Control-Applicative.html#t%3AWrappedArrow" rel="nofollow">WrappedArrow</a> can be used to provide an Applicative interface to any arrow, and it contains basically the same code as the solution in Jake’s comment.<br /><br />As for the MonadPlus laws, now I remember seeing them long ago, but forgot the specifics. Thanks for the pointer!Patai Gergelyhttps://www.blogger.com/profile/02405133490768813514noreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-21823845844301108122010-04-12T03:41:50.312+02:002010-04-12T03:41:50.312+02:00@Sjoerd:
I managed to come up with this. I haven&...@Sjoerd:<br /><br />I managed to come up with this. I haven't verified any laws, but the types are correct.<br /><br />fmap f a = arr f . a<br />pure = arr . const<br />f <*> g = (arr.uncurry) ($) <<< f &&& gUnknownhttps://www.blogger.com/profile/09019947214862464461noreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-17477710877118810962010-04-12T03:28:53.601+02:002010-04-12T03:28:53.601+02:00MonadPlus has laws relating it with Monad which Al...MonadPlus has laws relating it with Monad which Alternative does not, so they are not exactly equivalent. Unfortunately, nobody can decide what those laws should be, and there is a proposal to split MonadPlus into three different classes. I wonder where ArrowPlus falls regarding laws.<br /><br />http://www.haskell.org/haskellwiki/MonadPlus_reform_proposalUnknownhttps://www.blogger.com/profile/09019947214862464461noreply@blogger.comtag:blogger.com,1999:blog-7548736674449953374.post-30927661484275956782010-04-11T22:49:43.078+02:002010-04-11T22:49:43.078+02:00Is it possible to provide an Applicative instance ...Is it possible to provide an Applicative instance for every Arrow?Sjoerd Visscherhttps://www.blogger.com/profile/10698430967044536619noreply@blogger.com