<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Aha-one-liners</title>
	<atom:link href="http://therning.org/magnus/archives/324/feed" rel="self" type="application/rss+xml" />
	<link>http://therning.org/magnus/archives/324</link>
	<description>Incoherent mumblings</description>
	<lastBuildDate>Tue, 24 Aug 2010 06:00:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Ben</title>
		<link>http://therning.org/magnus/archives/324/comment-page-1#comment-89630</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Sun, 25 Nov 2007 22:09:07 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/324#comment-89630</guid>
		<description>&lt;p&gt;&lt;code&gt;liftM dec . mapM (flip M.lookup decodeMap)&lt;/code&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><code>liftM dec . mapM (flip M.lookup decodeMap)</code></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Magnus</title>
		<link>http://therning.org/magnus/archives/324/comment-page-1#comment-83624</link>
		<dc:creator>Magnus</dc:creator>
		<pubDate>Wed, 24 Oct 2007 08:20:38 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/324#comment-83624</guid>
		<description>&lt;p&gt;&lt;em&gt;mnislaih&lt;/em&gt;, I took the liberty of deleting the &quot;failed&quot; comments.  I know that markdown isn&#039;t the most commonly used markup, but it deserves to be. :)  The preview functionality is your friend.  On to the contents of your comment.  Using &lt;code&gt;fmap&lt;/code&gt; or &lt;code&gt;&lt;$&gt;&lt;/code&gt; would indeed make it even shorter and sweeter.  I suspect I&#039;ll have to play a bit more with Haskell, and read up on what &lt;code&gt;Control.Applicative&lt;/code&gt; has to offer.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Ricardo&lt;/em&gt;, I suspect there are two back-ticks missing, right?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><em>mnislaih</em>, I took the liberty of deleting the &#8220;failed&#8221; comments.  I know that markdown isn&#8217;t the most commonly used markup, but it deserves to be. <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   The preview functionality is your friend.  On to the contents of your comment.  Using <code>fmap</code> or <code>&lt;$&gt;</code> would indeed make it even shorter and sweeter.  I suspect I&#8217;ll have to play a bit more with Haskell, and read up on what <code>Control.Applicative</code> has to offer.</p>

<p><em>Ricardo</em>, I suspect there are two back-ticks missing, right?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Greg M</title>
		<link>http://therning.org/magnus/archives/324/comment-page-1#comment-83614</link>
		<dc:creator>Greg M</dc:creator>
		<pubDate>Wed, 24 Oct 2007 04:07:29 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/324#comment-83614</guid>
		<description>&lt;p&gt;That is a truly beautiful thing.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>That is a truly beautiful thing.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Kefer</title>
		<link>http://therning.org/magnus/archives/324/comment-page-1#comment-83519</link>
		<dc:creator>Kefer</dc:creator>
		<pubDate>Tue, 23 Oct 2007 19:01:05 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/324#comment-83519</guid>
		<description>&lt;p&gt;re: I can write my function as if failure doesn’t exist.&lt;/p&gt;

&lt;p&gt;Right! The title of the paper says it all: &quot;How to convert failure into a list of successes.&quot;&lt;/p&gt;

&lt;p&gt;Maybe is like the list monad except that (:) on anything other than [] is a no-op.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>re: I can write my function as if failure doesn’t exist.</p>

<p>Right! The title of the paper says it all: &#8220;How to convert failure into a list of successes.&#8221;</p>

<p>Maybe is like the list monad except that (:) on anything other than [] is a no-op.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Evan M</title>
		<link>http://therning.org/magnus/archives/324/comment-page-1#comment-83509</link>
		<dc:creator>Evan M</dc:creator>
		<pubDate>Tue, 23 Oct 2007 18:33:01 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/324#comment-83509</guid>
		<description>&lt;p&gt;You could also use &lt;code&gt;mapM&lt;/code&gt; in place of your combination of &lt;code&gt;sequence&lt;/code&gt; and &lt;code&gt;map&lt;/code&gt;.
I think of it as &quot;map, sequenced within the monad&quot;.  If you think about how IO would use it (&quot;do each of these operations in sequence, collecting the results&quot;) it makes the translation into the Maybe monad more obvious.&lt;/p&gt;

&lt;p&gt;I&#039;d maybe write your code as as:
&lt;code&gt;decode = liftM dec . mapM (flip M.lookup decodeMap)&lt;/code&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You could also use <code>mapM</code> in place of your combination of <code>sequence</code> and <code>map</code>.
I think of it as &#8220;map, sequenced within the monad&#8221;.  If you think about how IO would use it (&#8220;do each of these operations in sequence, collecting the results&#8221;) it makes the translation into the Maybe monad more obvious.</p>

<p>I&#8217;d maybe write your code as as:
<code>decode = liftM dec . mapM (flip M.lookup decodeMap)</code></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Burgers</title>
		<link>http://therning.org/magnus/archives/324/comment-page-1#comment-83501</link>
		<dc:creator>Bryan Burgers</dc:creator>
		<pubDate>Tue, 23 Oct 2007 17:14:58 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/324#comment-83501</guid>
		<description>&lt;p&gt;Actually, that &#039;sequence $ map (...) ...&#039; bit is used quite frequently for mapping, when the function of map results in a monadic value. The prelude defines &#039;mapM&#039; for this situation.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Actually, that &#8216;sequence $ map (&#8230;) &#8230;&#8217; bit is used quite frequently for mapping, when the function of map results in a monadic value. The prelude defines &#8216;mapM&#8217; for this situation.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: mnislaih</title>
		<link>http://therning.org/magnus/archives/324/comment-page-1#comment-83495</link>
		<dc:creator>mnislaih</dc:creator>
		<pubDate>Tue, 23 Oct 2007 13:56:09 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/324#comment-83495</guid>
		<description>&lt;p&gt;Sorry, but it is not trivial at all to get the formatting right.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mapM f = sequence . map f&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;liftM&lt;/code&gt; can be replaced by the more abstract &lt;code&gt;fmap&lt;/code&gt;, or even better: the applicative combinator &lt;code&gt;&lt;$&gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And we can strip &lt;code&gt;flip&lt;/code&gt; by using a section:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dec &lt;$&gt; mapM (&lt;/code&gt;`&lt;code&gt;M.lookup&lt;/code&gt;` &lt;code&gt;decodeMap) s&lt;/code&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Sorry, but it is not trivial at all to get the formatting right.</p>

<p><code>mapM f = sequence . map f</code></p>

<p><code>liftM</code> can be replaced by the more abstract <code>fmap</code>, or even better: the applicative combinator <code>&lt;$&gt;</code>.</p>

<p>And we can strip <code>flip</code> by using a section:</p>

<p><code>dec &lt;$&gt; mapM (</code>`<code>M.lookup</code>` <code>decodeMap) s</code></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Ricardo Herrmann</title>
		<link>http://therning.org/magnus/archives/324/comment-page-1#comment-83482</link>
		<dc:creator>Ricardo Herrmann</dc:creator>
		<pubDate>Tue, 23 Oct 2007 13:28:12 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/324#comment-83482</guid>
		<description>&lt;p&gt;A bit of syntax sugar: (flip M.lookup decodeMap) -&gt; (&lt;code&gt;M.lookup&lt;/code&gt; decodeMap)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>A bit of syntax sugar: (flip M.lookup decodeMap) -&gt; (<code>M.lookup</code> decodeMap)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: she</title>
		<link>http://therning.org/magnus/archives/324/comment-page-1#comment-83469</link>
		<dc:creator>she</dc:creator>
		<pubDate>Tue, 23 Oct 2007 08:14:11 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/324#comment-83469</guid>
		<description>&lt;p&gt;Easy? It does not look easy at all to me&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Easy? It does not look easy at all to me</p>]]></content:encoded>
	</item>
</channel>
</rss>
