<?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: Prettier functions for wrapping and wrapping</title>
	<atom:link href="http://conal.net/blog/posts/prettier-functions-for-wrapping-and-wrapping/feed" rel="self" type="application/rss+xml" />
	<link>http://conal.net/blog/posts/prettier-functions-for-wrapping-and-wrapping</link>
	<description>Inspirations &#38; experiments, mainly about denotative/functional programming in Haskell</description>
	<lastBuildDate>Sat, 26 Sep 2020 21:06:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.17</generator>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; Another angle on zippers</title>
		<link>http://conal.net/blog/posts/prettier-functions-for-wrapping-and-wrapping#comment-272</link>
		<dc:creator><![CDATA[Conal Elliott &#187; Blog Archive &#187; Another angle on zippers]]></dc:creator>
		<pubDate>Fri, 30 Jul 2010 02:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=68#comment-272</guid>
		<description><![CDATA[&lt;p&gt;[...] inO is from Control.Compose, and is defined using the ideas from Prettier functions for wrapping and wrapping and the notational improvement from Matt Hellige&#8217;s Pointless [...]&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] inO is from Control.Compose, and is defined using the ideas from Prettier functions for wrapping and wrapping and the notational improvement from Matt Hellige&#8217;s Pointless [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/prettier-functions-for-wrapping-and-wrapping#comment-271</link>
		<dc:creator><![CDATA[conal]]></dc:creator>
		<pubDate>Tue, 09 Mar 2010 18:16:41 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=68#comment-271</guid>
		<description><![CDATA[&lt;p&gt;In December of 2008, Matt Hellige suggested a notational refinement that I&#039;ve been using &amp; enjoying in my day-to-day programming ever since.  See his post &lt;em&gt;&lt;a href=&quot;http://matt.immute.net/content/pointless-fun&quot; rel=&quot;nofollow&quot;&gt;Pointless Fun&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Above, I suggested redefining &lt;code&gt;inO&lt;/code&gt; to &quot;say what I mean plainly: &lt;code&gt;inO&lt;/code&gt; applies &lt;code&gt;unO&lt;/code&gt; to the argument and &lt;code&gt;O&lt;/code&gt; to the result.&quot;&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;inO = result O . argument unO&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Matt&#039;s idea is to package up this pattern of use of &lt;code&gt;result&lt;/code&gt; and &lt;code&gt;argument&lt;/code&gt; and give it a name.
And not just any name, but an infix operator that looks like an arrow and is right-associative, to mimic the notation of function types.&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;&lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;infixr&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;2&lt;/span&gt; ~&gt;
f ~&gt; g = argument f . result g&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Now &lt;code&gt;inO&lt;/code&gt;, &lt;code&gt;inO2&lt;/code&gt;, etc have lovely, simple definitions:&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;inO  = unO ~&gt; O
inO2 = unO ~&gt; inO
inO3 = unO ~&gt; inO2
&lt;span style=&quot;color: #5d478b; font-style: italic;&quot;&gt;-- ...&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Written out,&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;inO3 = unO ~&gt; unO ~&gt; unO ~&gt; O&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;which can be read as saying that the semantic editor combinator &lt;code&gt;inO3&lt;/code&gt; passes three arguments through &lt;code&gt;unO&lt;/code&gt; before invoking a given editor and then the editor&#039;s result through &lt;code&gt;O&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This notational technique can be used in many other ways besides stripping and restoring &lt;code&gt;newtype&lt;/code&gt; constructors.
Matt&#039;s examples include use of &lt;code&gt;id&lt;/code&gt; when arguments and/or results do not need transforming.&lt;/p&gt;

&lt;p&gt;Afterthought:
SECs built up with &lt;code&gt;(~&gt;)&lt;/code&gt; (or explicitly with &lt;code&gt;result&lt;/code&gt; and &lt;code&gt;argument&lt;/code&gt;) remind me vaguely of method combination in some object systems, like CLOS, but in a functional style -- where &lt;em&gt;after&lt;/em&gt; and &lt;em&gt;before&lt;/em&gt; methods combine with inherited methods via function composition rather than sequential execution.  Even this apparent difference diminishes if one considers a standard denotational semantics of sequential execution &lt;em&gt;as&lt;/em&gt; function composition.  For instance, a denotational semantics for method combination might be written elegantly in terms of &lt;code&gt;argument&lt;/code&gt;, &lt;code&gt;result&lt;/code&gt;, and &lt;code&gt;(~&gt;)&lt;/code&gt;.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>In December of 2008, Matt Hellige suggested a notational refinement that I&#8217;ve been using &amp; enjoying in my day-to-day programming ever since.  See his post <em><a href="http://matt.immute.net/content/pointless-fun" rel="nofollow">Pointless Fun</a></em>.</p>

<p>Above, I suggested redefining <code>inO</code> to &#8220;say what I mean plainly: <code>inO</code> applies <code>unO</code> to the argument and <code>O</code> to the result.&#8221;</p>

<p><div>
<pre class="haskell">inO = result O . argument unO</pre>
</div></p>

<p>Matt&#8217;s idea is to package up this pattern of use of <code>result</code> and <code>argument</code> and give it a name.
And not just any name, but an infix operator that looks like an arrow and is right-associative, to mimic the notation of function types.</p>

<p><div>
<pre class="haskell"><span style="color: #050; font-weight: bold;">infixr</span> <span style="color: red;">2</span> ~&gt;
f ~&gt; g = argument f . result g</pre>
</div></p>

<p>Now <code>inO</code>, <code>inO2</code>, etc have lovely, simple definitions:</p>

<p><div>
<pre class="haskell">inO  = unO ~&gt; O
inO2 = unO ~&gt; inO
inO3 = unO ~&gt; inO2
<span style="color: #5d478b; font-style: italic;">-- ...</span></pre>
</div></p>

<p>Written out,</p>

<p><div>
<pre class="haskell">inO3 = unO ~&gt; unO ~&gt; unO ~&gt; O</pre>
</div></p>

<p>which can be read as saying that the semantic editor combinator <code>inO3</code> passes three arguments through <code>unO</code> before invoking a given editor and then the editor&#8217;s result through <code>O</code>.</p>

<p>This notational technique can be used in many other ways besides stripping and restoring <code>newtype</code> constructors.
Matt&#8217;s examples include use of <code>id</code> when arguments and/or results do not need transforming.</p>

<p>Afterthought:
SECs built up with <code>(~&gt;)</code> (or explicitly with <code>result</code> and <code>argument</code>) remind me vaguely of method combination in some object systems, like CLOS, but in a functional style &#8212; where <em>after</em> and <em>before</em> methods combine with inherited methods via function composition rather than sequential execution.  Even this apparent difference diminishes if one considers a standard denotational semantics of sequential execution <em>as</em> function composition.  For instance, a denotational semantics for method combination might be written elegantly in terms of <code>argument</code>, <code>result</code>, and <code>(~&gt;)</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; Another angle on functional future values</title>
		<link>http://conal.net/blog/posts/prettier-functions-for-wrapping-and-wrapping#comment-270</link>
		<dc:creator><![CDATA[Conal Elliott &#187; Blog Archive &#187; Another angle on functional future values]]></dc:creator>
		<pubDate>Mon, 05 Jan 2009 04:02:33 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=68#comment-270</guid>
		<description><![CDATA[&lt;p&gt;[...] definitions of these helpers are very simple with the ideas from Prettier functions for wrapping and wrapping and a lovely notation from Matt Hellige&#8217;s Pointless [...]&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] definitions of these helpers are very simple with the ideas from Prettier functions for wrapping and wrapping and a lovely notation from Matt Hellige&#8217;s Pointless [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; Sequences, segments, and signals</title>
		<link>http://conal.net/blog/posts/prettier-functions-for-wrapping-and-wrapping#comment-269</link>
		<dc:creator><![CDATA[Conal Elliott &#187; Blog Archive &#187; Sequences, segments, and signals]]></dc:creator>
		<pubDate>Fri, 05 Dec 2008 08:14:43 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=68#comment-269</guid>
		<description><![CDATA[&lt;p&gt;[...] About      &#171; Prettier functions for wrapping and wrapping [...]&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] About      &laquo; Prettier functions for wrapping and wrapping [&#8230;]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
