<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Data Structure Agnostic JSON Serialization</title>
	<atom:link href="http://blog.melding-monads.com/2012/02/24/data-structure-agnostic-json-serialization/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.melding-monads.com/2012/02/24/data-structure-agnostic-json-serialization/</link>
	<description>Math, Computer Science,  and Education</description>
	<lastBuildDate>Wed, 08 May 2013 14:59:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: lpsmith</title>
		<link>http://blog.melding-monads.com/2012/02/24/data-structure-agnostic-json-serialization/#comment-198</link>
		<dc:creator><![CDATA[lpsmith]]></dc:creator>
		<pubDate>Fri, 24 Feb 2012 18:57:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melding-monads.com/?p=415#comment-198</guid>
		<description><![CDATA[foldMap from &lt;a href=&quot;http://hackage.haskell.org/packages/archive/base/4.5.0.0/doc/html/Data-Foldable.html&quot; rel=&quot;nofollow&quot;&gt;Data.Foldable&lt;/a&gt; I assume?    Thanks for pointing that out to me...]]></description>
		<content:encoded><![CDATA[<p>foldMap from <a href="http://hackage.haskell.org/packages/archive/base/4.5.0.0/doc/html/Data-Foldable.html" rel="nofollow">Data.Foldable</a> I assume?    Thanks for pointing that out to me&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lpsmith</title>
		<link>http://blog.melding-monads.com/2012/02/24/data-structure-agnostic-json-serialization/#comment-197</link>
		<dc:creator><![CDATA[lpsmith]]></dc:creator>
		<pubDate>Fri, 24 Feb 2012 18:51:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melding-monads.com/?p=415#comment-197</guid>
		<description><![CDATA[That thought has crossed my mind,  I think,  but I haven&#039;t really looked into it.]]></description>
		<content:encoded><![CDATA[<p>That thought has crossed my mind,  I think,  but I haven&#8217;t really looked into it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ceii</title>
		<link>http://blog.melding-monads.com/2012/02/24/data-structure-agnostic-json-serialization/#comment-196</link>
		<dc:creator><![CDATA[ceii]]></dc:creator>
		<pubDate>Fri, 24 Feb 2012 16:35:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melding-monads.com/?p=415#comment-196</guid>
		<description><![CDATA[I&#039;ve just spent a few hours looking at ways to abstract this mess away, but I seem to inevitably gravitate toward a bastardized version of parsing combinators.

Looking at that, I guess providing specialized parser combinators directly would be smarter. Have you looked into that?]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve just spent a few hours looking at ways to abstract this mess away, but I seem to inevitably gravitate toward a bastardized version of parsing combinators.</p>
<p>Looking at that, I guess providing specialized parser combinators directly would be smarter. Have you looked into that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sjoerd Visscher (@sjoerd_visscher)</title>
		<link>http://blog.melding-monads.com/2012/02/24/data-structure-agnostic-json-serialization/#comment-194</link>
		<dc:creator><![CDATA[Sjoerd Visscher (@sjoerd_visscher)]]></dc:creator>
		<pubDate>Fri, 24 Feb 2012 12:20:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melding-monads.com/?p=415#comment-194</guid>
		<description><![CDATA[I&#039;m going to promote my favorite Haskell function again: Instead of &quot;foldr (\x xs -&gt; element x `mappend` xs) mempty&quot;, you can just write &quot;foldMap element&quot;.]]></description>
		<content:encoded><![CDATA[<p>I&#8217;m going to promote my favorite Haskell function again: Instead of &#8220;foldr (\x xs -&gt; element x `mappend` xs) mempty&#8221;, you can just write &#8220;foldMap element&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lpsmith</title>
		<link>http://blog.melding-monads.com/2012/02/24/data-structure-agnostic-json-serialization/#comment-193</link>
		<dc:creator><![CDATA[lpsmith]]></dc:creator>
		<pubDate>Fri, 24 Feb 2012 12:06:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melding-monads.com/?p=415#comment-193</guid>
		<description><![CDATA[Actually, I&#039;ve played around with a similar idea;  it just doesn&#039;t have the interface I want.  I wouldn&#039;t consider it a convenient way to express deserializers,  at least,  not without something sitting on top of it hiding all the arcana.   But maybe you know how to do that?]]></description>
		<content:encoded><![CDATA[<p>Actually, I&#8217;ve played around with a similar idea;  it just doesn&#8217;t have the interface I want.  I wouldn&#8217;t consider it a convenient way to express deserializers,  at least,  not without something sitting on top of it hiding all the arcana.   But maybe you know how to do that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ceii</title>
		<link>http://blog.melding-monads.com/2012/02/24/data-structure-agnostic-json-serialization/#comment-192</link>
		<dc:creator><![CDATA[ceii]]></dc:creator>
		<pubDate>Fri, 24 Feb 2012 10:51:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.melding-monads.com/?p=415#comment-192</guid>
		<description><![CDATA[What you&#039;re doing is basically making aeson&#039;s Value type virtual. Just like you can allow users to &quot;create&quot; values of that virtual type by defining functions analogous to each constructor, you can allow them to &quot;consume&quot; a value that type by offering a fold operator for it:

type FoldJSon r = (HashMap Text r -&gt; r) -&gt; (Vector r -&gt; r) -&gt; (Text -&gt; r) -&gt; (Integer -&gt; r) -&gt; (Double -&gt; r) -&gt; (Bool -&gt; r) -&gt; (() -&gt; r) -&gt; r

(The () parameter to the second-to-last argument is obviously superfluous, I&#039;ve added it to make it clear that this argument is a continuation for the Nil case.)

You could then implement a deserialization API with the following interface:

class FromJSon a where
    parseJSon :: FoldJSon (Parser a) -&gt; Parser a

decode :: FromJSon a =&gt; ByteString -&gt; Maybe a

in a way exactly analogous to what aeson does, except with some additional inversion of control and no concrete Value type.

I think the name of this game is &quot;refunctionalization&quot;, but I&#039;m not 100% sure.]]></description>
		<content:encoded><![CDATA[<p>What you&#8217;re doing is basically making aeson&#8217;s Value type virtual. Just like you can allow users to &#8220;create&#8221; values of that virtual type by defining functions analogous to each constructor, you can allow them to &#8220;consume&#8221; a value that type by offering a fold operator for it:</p>
<p>type FoldJSon r = (HashMap Text r -&gt; r) -&gt; (Vector r -&gt; r) -&gt; (Text -&gt; r) -&gt; (Integer -&gt; r) -&gt; (Double -&gt; r) -&gt; (Bool -&gt; r) -&gt; (() -&gt; r) -&gt; r</p>
<p>(The () parameter to the second-to-last argument is obviously superfluous, I&#8217;ve added it to make it clear that this argument is a continuation for the Nil case.)</p>
<p>You could then implement a deserialization API with the following interface:</p>
<p>class FromJSon a where<br />
    parseJSon :: FoldJSon (Parser a) -&gt; Parser a</p>
<p>decode :: FromJSon a =&gt; ByteString -&gt; Maybe a</p>
<p>in a way exactly analogous to what aeson does, except with some additional inversion of control and no concrete Value type.</p>
<p>I think the name of this game is &#8220;refunctionalization&#8221;, but I&#8217;m not 100% sure.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
