tag:blogger.com,1999:blog-1777990983847811806.post4610213672040907175..comments2022-11-30T06:29:44.811-08:00Comments on Haskell for all: How to desugar Haskell codeGabriella Gonzalezhttp://www.blogger.com/profile/01917800488530923694noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-1777990983847811806.post-90884691875912700492017-06-23T20:26:41.995-07:002017-06-23T20:26:41.995-07:00Desugaring the do notation is not as simple as sho...Desugaring the do notation is not as simple as shown here because of `fail`. See https://wiki.haskell.org/MonadFail_Proposal for details. Here is the relevant excerpt:<br /><br />"<br />Currently, the <- symbol is unconditionally desugared as follows:<br /><br />do pat <- computation<br /><br />becomes<br /><br />let f pat = more<br /> f _ = fail "..."<br />in computation >>= f<br />"Ryan Mulliganhttps://www.blogger.com/profile/01470099198833585582noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-12035728310227443292015-10-23T04:07:07.932-07:002015-10-23T04:07:07.932-07:00s/deniok/deni-ok/s/deniok/deni-ok/migmithttps://www.blogger.com/profile/06981055611018991476noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-64161682138125565672015-10-23T04:00:31.312-07:002015-10-23T04:00:31.312-07:00Thanks to deniok@lj:
Prelude> (\True y -> (...Thanks to deniok@lj:<br /><br />Prelude> (\True y -> ()) False `seq` 5<br />5<br />Prelude> (\True -> \y -> ()) False `seq` 5<br />*** Exception: :3:2-18: Non-exhaustive patterns in lambdamigmithttps://www.blogger.com/profile/06981055611018991476noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-13091075477158893462015-02-10T14:26:00.966-08:002015-02-10T14:26:00.966-08:00if b then e1 else e2
-- ... is equivalent to:
cas...if b then e1 else e2<br /><br />-- ... is equivalent to:<br />case b of<br /> True -> e1<br /> False -> e2Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-16727760697022844762014-10-29T08:22:16.909-07:002014-10-29T08:22:16.909-07:00Interesting! This is pretty close to 'free the...Interesting! This is pretty close to 'free theorem equivalence' - I noticed your Morte could likely encode a free groupoid. These should cover a lot of it, and be sure to read the comments in each of the first two:<br />https://golem.ph.utexas.edu/category/2012/09/where_do_monads_come_from.html<br />https://golem.ph.utexas.edu/category/2008/01/mark_weber_on_nerves_of_catego.html<br />http://arxiv.org/pdf/1101.3064.pdf<br />http://www.frontiersinai.com/turingfiles/March/03Tessonconservatives-LATA2012.pdf<br /><br /><br />Anonymoushttps://www.blogger.com/profile/17709066838630909931noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-77617749573474724482014-10-28T06:04:10.403-07:002014-10-28T06:04:10.403-07:00You're right. I added a caveat mentioning tha...You're right. I added a caveat mentioning that this is not completely true because of let generalization.Gabriella Gonzalezhttps://www.blogger.com/profile/01917800488530923694noreply@blogger.comtag:blogger.com,1999:blog-1777990983847811806.post-13758893566489260652014-10-27T06:43:17.964-07:002014-10-27T06:43:17.964-07:00“Non-recursive lets are equivalent to lambdas:” Th...“Non-recursive lets are equivalent to lambdas:” This is true superficially, but intermediate languages (like Core) still have non-recursive lets, as they have to be treated quite differently by an optimizing compiler: Not much is known about a lambda-abstracted variable, but a let-bound value is known completely.Anonymousnoreply@blogger.com