tag:blogger.com,1999:blog-1777990983847811806.post637262120310781429..comments2024-03-16T16:29:29.582-07:00Comments on Haskell for all: How to build library-agnostic streaming sourcesGabriella Gonzalezhttp://www.blogger.com/profile/01917800488530923694noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-1777990983847811806.post-76996262926863786642016-02-17T20:14:59.710-08:002016-02-17T20:14:59.710-08:00It boils down to this example: http://lpaste.net/1...It boils down to this example: http://lpaste.net/152719<br /><br />Notice how if you use `Monoid` you can end up with multiple `Monoid` constraints but if you use `MonadPlus` you always get just one constraint.<br /><br />Haskell does not (easily) let you specify a constraint like:<br /><br /> (forall a . Monoid (m a)) => ...<br /><br />... which is why the `Monoid` class does not work well for this sort of thing. It actually *is* possible to abuse Haskell's type system to encode such a constraint using Edward's `constraints` package, but it's far easier and more readable to just use `MonadPlus`.Gabriella Gonzalezhttps://www.blogger.com/profile/01917800488530923694noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-59870192992323183492016-02-16T21:05:35.432-08:002016-02-16T21:05:35.432-08:00Why not return a Monoid instead?Why not return a Monoid instead?Anonymoushttps://www.blogger.com/profile/04733082037775024745noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-75684025950920609252016-02-14T16:25:47.321-08:002016-02-14T16:25:47.321-08:00This comment has been removed by the author.MitchellSaladhttps://www.blogger.com/profile/11322780873462711780noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-90716841433664889542014-12-03T13:47:08.276-08:002014-12-03T13:47:08.276-08:00I was wondering why this wasn't working for me...I was wondering why this wasn't working for me until I realized I was using an older version of pipes. Make sure to upgrade to pipes 4.1.3 before trying this.Anonymoushttps://www.blogger.com/profile/10895370605861428081noreply@blogger.com