<?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: Circuits as a bicartesian closed category</title>
	<atom:link href="http://conal.net/blog/posts/circuits-as-a-bicartesian-closed-category/feed" rel="self" type="application/rss+xml" />
	<link>http://conal.net/blog/posts/circuits-as-a-bicartesian-closed-category</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: Kari</title>
		<link>http://conal.net/blog/posts/circuits-as-a-bicartesian-closed-category#comment-881</link>
		<dc:creator><![CDATA[Kari]]></dc:creator>
		<pubDate>Fri, 20 Sep 2013 09:50:55 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=547#comment-881</guid>
		<description><![CDATA[&lt;p&gt;Dan Ghica has suggested symmetric monoidal closed categories as models for circuits (http://www.cs.bham.ac.uk/~drg/papers/popl07x.pdf). He introduces specific categories &#039;Category of handshake circuits&#039; HC and another called SHC.&lt;/p&gt;

&lt;p&gt;I don&#039;t know how these compare to the &#039;Circuit Category&#039;
  C (Kleisli CircuitM (Pins a) (Pins b)).&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Dan Ghica has suggested symmetric monoidal closed categories as models for circuits (<a href="http://www.cs.bham.ac.uk/~drg/papers/popl07x.pdf" rel="nofollow">http://www.cs.bham.ac.uk/~drg/papers/popl07x.pdf</a>). He introduces specific categories &#8216;Category of handshake circuits&#8217; HC and another called SHC.</p>

<p>I don&#8217;t know how these compare to the &#8216;Circuit Category&#8217;
  C (Kleisli CircuitM (Pins a) (Pins b)).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sjoerd Visscher</title>
		<link>http://conal.net/blog/posts/circuits-as-a-bicartesian-closed-category#comment-880</link>
		<dc:creator><![CDATA[Sjoerd Visscher]]></dc:creator>
		<pubDate>Tue, 17 Sep 2013 22:01:50 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=547#comment-880</guid>
		<description><![CDATA[&lt;p&gt;The methods I use for CCCs in data-category are:&lt;/p&gt;

&lt;pre&gt;apply ∷ (a ⇨ b) × a ↝ b
tuple ∷ a ↝ (b ⇨ (a × b))
(^^^) ∷ (a ↝ b) → (d ↝ c) → ((c ⇨ a) ↝ (d ⇨ b))&lt;/pre&gt;

&lt;p&gt;with &lt;code&gt;curry f = (id ^^^ f) . tuple&lt;/code&gt; and &lt;code&gt;uncurry f = apply . (f *** id)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;(^^^)&lt;/code&gt; is analogous to &lt;code&gt;(+++)&lt;/code&gt; and &lt;code&gt;(***)&lt;/code&gt;.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>The methods I use for CCCs in data-category are:</p>

<pre>apply ∷ (a ⇨ b) × a ↝ b
tuple ∷ a ↝ (b ⇨ (a × b))
(^^^) ∷ (a ↝ b) → (d ↝ c) → ((c ⇨ a) ↝ (d ⇨ b))</pre>

<p>with <code>curry f = (id ^^^ f) . tuple</code> and <code>uncurry f = apply . (f *** id)</code>.</p>

<p><code>(^^^)</code> is analogous to <code>(+++)</code> and <code>(***)</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://conal.net/blog/posts/circuits-as-a-bicartesian-closed-category#comment-879</link>
		<dc:creator><![CDATA[Ryan]]></dc:creator>
		<pubDate>Tue, 17 Sep 2013 17:23:58 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=547#comment-879</guid>
		<description><![CDATA[&lt;p&gt;I think you can derive uncurry as uncurry f := apply . (f * id).  When f := curry f&#039;, you obtain that curry and uncurry are inverses by beta.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>I think you can derive uncurry as uncurry f := apply . (f * id).  When f := curry f&#8217;, you obtain that curry and uncurry are inverses by beta.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Ellis</title>
		<link>http://conal.net/blog/posts/circuits-as-a-bicartesian-closed-category#comment-878</link>
		<dc:creator><![CDATA[Tom Ellis]]></dc:creator>
		<pubDate>Tue, 17 Sep 2013 15:57:29 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=547#comment-878</guid>
		<description><![CDATA[&lt;p&gt;I have had a lot of success with a &quot;wiring diagram&quot; API based on arrows that I am using to write relational queries and compile them to SQL.  The inspiration was David Spivak&#039;s &lt;a href=&quot;http://arxiv.org/abs/1305.0297&quot; rel=&quot;nofollow&quot;&gt;The operad of wiring diagrams: formalizing a graphical language for databases...&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have managed to avoid type instances and &quot;IsSource&quot; constraints with what seems to be a cunning trick.  I used &lt;code&gt;Wire&lt;/code&gt; rather than &lt;code&gt;Pins&lt;/code&gt;, and instead of requiring &lt;code&gt;Wire&lt;/code&gt; to be the type constructor in front of every datatype that represents connectors, I just store &lt;code&gt;Wire&lt;/code&gt;s in any Haskell datatype, so for example we have &lt;code&gt;plus :: QueryArr (Wire Int, Wire Int) (Wire Int)&lt;/code&gt; and &lt;code&gt;restrict :: QueryArr (Wire Bool) ()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The definition is &lt;code&gt;data Wire a = Wire String&lt;/code&gt;, where the string field is the column name of a database table.  Typesafety is provided by ensuring that you can only produce a &lt;code&gt;Wire&lt;/code&gt; in the context of a table which contains a column which is referred to in the &lt;code&gt;Wire&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This approach has worked very well.  I haven&#039;t considered coproducts, but would probably fake them up by representing &lt;code&gt;A + B ~&gt; X&lt;/code&gt; as &lt;code&gt;(A ~&gt; X, B ~&gt; X)&lt;/code&gt; rather than trying to construct &lt;code&gt;A + B&lt;/code&gt; itself.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>I have had a lot of success with a &#8220;wiring diagram&#8221; API based on arrows that I am using to write relational queries and compile them to SQL.  The inspiration was David Spivak&#8217;s <a href="http://arxiv.org/abs/1305.0297" rel="nofollow">The operad of wiring diagrams: formalizing a graphical language for databases&#8230;</a>.</p>

<p>I have managed to avoid type instances and &#8220;IsSource&#8221; constraints with what seems to be a cunning trick.  I used <code>Wire</code> rather than <code>Pins</code>, and instead of requiring <code>Wire</code> to be the type constructor in front of every datatype that represents connectors, I just store <code>Wire</code>s in any Haskell datatype, so for example we have <code>plus :: QueryArr (Wire Int, Wire Int) (Wire Int)</code> and <code>restrict :: QueryArr (Wire Bool) ()</code>.</p>

<p>The definition is <code>data Wire a = Wire String</code>, where the string field is the column name of a database table.  Typesafety is provided by ensuring that you can only produce a <code>Wire</code> in the context of a table which contains a column which is referred to in the <code>Wire</code>.</p>

<p>This approach has worked very well.  I haven&#8217;t considered coproducts, but would probably fake them up by representing <code>A + B ~&gt; X</code> as <code>(A ~&gt; X, B ~&gt; X)</code> rather than trying to construct <code>A + B</code> itself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Ellis</title>
		<link>http://conal.net/blog/posts/circuits-as-a-bicartesian-closed-category#comment-877</link>
		<dc:creator><![CDATA[Tom Ellis]]></dc:creator>
		<pubDate>Tue, 17 Sep 2013 15:14:06 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=547#comment-877</guid>
		<description><![CDATA[&lt;p&gt;I belive Warbo&#039;s observation about selecting which output you want to keep corresponds to the identification of &lt;code&gt;A + B -&gt; X&lt;/code&gt; with &lt;code&gt;(A -&gt; X, B -&gt; X)&lt;/code&gt;.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>I belive Warbo&#8217;s observation about selecting which output you want to keep corresponds to the identification of <code>A + B -&gt; X</code> with <code>(A -&gt; X, B -&gt; X)</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jacques Carette</title>
		<link>http://conal.net/blog/posts/circuits-as-a-bicartesian-closed-category#comment-875</link>
		<dc:creator><![CDATA[Jacques Carette]]></dc:creator>
		<pubDate>Tue, 17 Sep 2013 14:38:12 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=547#comment-875</guid>
		<description><![CDATA[&lt;p&gt;I believe that the fundamental reason you are not able to implement inl/inr without constraints is that the implementation fundamentally assumes that a and b are &lt;em&gt;Finite&lt;/em&gt; [that&#039;s what numPins forces].  Which is a perfectly fine assumption, but it is not one which is &#039;native&#039; to Category.  It might be expedient to make that assumption, and work over a finite category, which you can here define as one which has a map from all objects to Nat.  You&#039;ll probably want a comonoid structure as well, which decomposes objects (aka toPins).&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>I believe that the fundamental reason you are not able to implement inl/inr without constraints is that the implementation fundamentally assumes that a and b are <em>Finite</em> [that&#8217;s what numPins forces].  Which is a perfectly fine assumption, but it is not one which is &#8216;native&#8217; to Category.  It might be expedient to make that assumption, and work over a finite category, which you can here define as one which has a map from all objects to Nat.  You&#8217;ll probably want a comonoid structure as well, which decomposes objects (aka toPins).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ao</title>
		<link>http://conal.net/blog/posts/circuits-as-a-bicartesian-closed-category#comment-874</link>
		<dc:creator><![CDATA[ao]]></dc:creator>
		<pubDate>Tue, 17 Sep 2013 11:47:34 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=547#comment-874</guid>
		<description><![CDATA[&lt;p&gt;I wonder if you tried looking into Temperley-Lieb categories (eg. http://www.math.helsinki.fi/logic/sellc-2010/course/final.pdf)?. There is a neat way to represent sums, evaluate (simply typed) lambda calculus, not to mention that representing them as circuits is as straight-forward as it gets&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>I wonder if you tried looking into Temperley-Lieb categories (eg. <a href="http://www.math.helsinki.fi/logic/sellc-2010/course/final.pdf" rel="nofollow">http://www.math.helsinki.fi/logic/sellc-2010/course/final.pdf</a>)?. There is a neat way to represent sums, evaluate (simply typed) lambda calculus, not to mention that representing them as circuits is as straight-forward as it gets</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Warbo</title>
		<link>http://conal.net/blog/posts/circuits-as-a-bicartesian-closed-category#comment-873</link>
		<dc:creator><![CDATA[Warbo]]></dc:creator>
		<pubDate>Tue, 17 Sep 2013 11:05:22 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=547#comment-873</guid>
		<description><![CDATA[&lt;p&gt;Having both sides of a sum use the largest number of pins reminds me of studying ALU design at University. Rather than selecting which circuit (operation) to send data to, we would send it to all circuits and select the output we want to keep.&lt;/p&gt;

&lt;p&gt;The type-unsafe scariness may come from the fact that this is evaluated eagerly, so all operations will be performed even if they&#039;re meaningless, as long as we select the result of a meaningful operation.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Having both sides of a sum use the largest number of pins reminds me of studying ALU design at University. Rather than selecting which circuit (operation) to send data to, we would send it to all circuits and select the output we want to keep.</p>

<p>The type-unsafe scariness may come from the fact that this is evaluated eagerly, so all operations will be performed even if they&#8217;re meaningless, as long as we select the result of a meaningful operation.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
